[elpa] master 798684a 13/36: hydra-examples.el: Don't byte-compile

2017-07-22 Thread Oleh Krehel
branch: master
commit 798684a119ade174c0241835ecff21aca6b9784a
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra-examples.el: Don't byte-compile

Avoids warnings. These are just examples anyway.
---
 hydra-examples.el | 4 
 1 file changed, 4 insertions(+)

diff --git a/hydra-examples.el b/hydra-examples.el
index f464ba1..4f12255 100644
--- a/hydra-examples.el
+++ b/hydra-examples.el
@@ -378,4 +378,8 @@ _y_: ?y? year   _q_: quit   _L__l__c_: log = 
?l?"
   (goto-char mk
 
 (provide 'hydra-examples)
+
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
 ;;; hydra-examples.el ends here



[elpa] master a85a617 03/36: Allow to use e.g. "↑" in place of "" in the docstring

2017-07-22 Thread Oleh Krehel
branch: master
commit a85a617306edccb5f61cf566a90f2cf7ac50c42e
Author: Oleh Krehel 
Commit: Oleh Krehel 

Allow to use e.g. "↑" in place of "" in the docstring

* hydra.el (hydra-docstring-keys-translate-alist): New defvar.
(hydra--format): Add "↑" to the regex, modify the head accordingly for
the `hydra-fontify-head' call.

Re #186
---
 hydra.el | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/hydra.el b/hydra.el
index d624581..a048df8 100644
--- a/hydra.el
+++ b/hydra.el
@@ -581,6 +581,9 @@ HEAD's binding is returned as a string wrapped with [] or 
{}."
 (setq str (replace-match "" nil nil str
 str))
 
+(defvar hydra-docstring-keys-translate-alist
+  '(("↑" . "")))
+
 (defun hydra--format (_name body docstring heads)
   "Generate a `format' statement from STR.
 \"%`...\" expressions are extracted into \"%S\".
@@ -594,7 +597,7 @@ The expressions can be auto-expanded according to NAME."
 offset)
 (while (setq start
  (string-match
-  "\\(?:%\\( 
?-?[0-9]*s?\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:[_?]\\( 
?-?[0-9]*?\\)\\(\\[\\|]\\|[-[:alnum:] ~.,;:/|?<>={}*+#%@!&^]+?\\)[_?]\\)"
+  "\\(?:%\\( 
?-?[0-9]*s?\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:[_?]\\( 
?-?[0-9]*?\\)\\(\\[\\|]\\|[-[:alnum:] ~.,;:/|?<>={}*+#%@!&^↑]+?\\)[_?]\\)"
   docstring start))
   (cond ((eq ?? (aref (match-string 0 docstring) 0))
  (let* ((key (match-string 4 docstring))
@@ -612,10 +615,19 @@ The expressions can be auto-expanded according to NAME."
 ((eq ?_ (aref (match-string 0 docstring) 0))
  (let* ((key (match-string 4 docstring))
 (key (if (equal key "β") "_" key))
-(head (assoc key heads)))
+normal-key
+(head (or (assoc key heads)
+  (when (setq normal-key
+  (cdr (assoc
+key 
hydra-docstring-keys-translate-alist)))
+(assoc normal-key heads)
(if head
(progn
- (push (hydra-fontify-head head body) varlist)
+ (push (hydra-fontify-head (if normal-key
+   (cons key (cdr head))
+ head)
+   body)
+   varlist)
  (setq docstring
(replace-match
 (or



[elpa] master updated (231ac7f -> 32b8352)

2017-07-22 Thread Oleh Krehel
abo_abo pushed a change to branch master.

  from  231ac7f   Merge commit 'cb57d9b67390ae3ff70ab64169bbc4f1264244bc' 
from js2-mode
   new  69529ad   hydra.el (hydra-default-hint): Add option
   new  5be27f4   Add a shortcut to supply a head's eval-able docstring
   new  a85a617   Allow to use e.g. "↑" in place of "" in the docstring
   new  f01f4a4   hydra.el (hydra-key-regex): Extract from hydra--format
   new  272dc4a   hydra.el (hydra-docstring-keys-translate-alist): Update
   new  f668f4c   hydra.el (hydra-key-regex): Add "↓←→⌫⌦⏎"
   new  83b9019   hydra.el (hydra-width-spec-regex): Update
   new  9fd53ba   hydra.el (hydra-doc-format-spec): New defcustom
   new  0a5074a   hydra.el (hydra--format): Avoid inf loops
   new  200a444   hydra.el (hydra--hint): Revert return "" for :hint nil
   new  6d5bdf7   Introduce (:hint none)
   new  f877855   hydra-examples.el (org-agenda-cts): Add
   new  798684a   hydra-examples.el: Don't byte-compile
   new  270b917   hydra.el (defhydra): Don't eval hints during the 
definition
   new  81d88e4   hydra.el (hydra-show-hint): Extract from defhydra
   new  1d378c6   Allow to set hydra verbosity
   new  585db09   hydra-examples.el: Add example of setting verbosity
   new  1eee0f3   hydra.el (hydra-get-property): New defun.
   new  9c2589f   Update the package description
   new  d2aaf86   Fix e.g. _f_(foo) in format string
   new  63de503   hydra.el (hydra-key-regex): Add "$"
   new  91f8e7c   hydra.el: Bump version
   new  76d51ec   Fix compile warnings
   new  3527b32   Fix byte compiler warnings
   new  2ebf862   Move Amaranth warning message to a defvar
   new  a07b92a   lv.el (lv-window): Rename to " *LV*"
   new  dd5f703   hydra.el: Use error-message-string, not message
   new  a72d68a   hydra.el (hydra-fontify-head-default): Fix head keys as 
"%f"
   new  3db82e5   Implement named columns
   new  95008ea   hydra.el: Add automatic lookup for remaped cmd
   new  2751f00   Remove trailing whitespace from :column docstring
   new  36fb5e0   hydra.el (defhydra): Use copy-tree on heads
   new  02f2907   hydra.el (hydra--sort-heads): change ordering method of 
columns
   new  38ce88a   hydra.el : fix some docstring warning
   new  943636f   hydra.el: Bump version
   new  32b8352   Merge commit '943636fe4a35298d9d234222bc4520dec9ef2305' 
from hydra


Summary of changes:
 packages/hydra/hydra-examples.el |  49 +-
 packages/hydra/hydra-ox.el   |   8 +-
 packages/hydra/hydra-test.el | 362 +++
 packages/hydra/hydra.el  | 322 +-
 packages/hydra/lv.el |   4 +-
 5 files changed, 584 insertions(+), 161 deletions(-)



[elpa] master f01f4a4 04/36: hydra.el (hydra-key-regex): Extract from hydra--format

2017-07-22 Thread Oleh Krehel
branch: master
commit f01f4a46f227961cd2a1571a45a174cfcfbfa81c
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-key-regex): Extract from hydra--format

* hydra.el (hydra-width-spec-regex): Extract from hydra--format.

Now the user can configure the key regex more precisely.

Fixes #187
---
 hydra.el | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/hydra.el b/hydra.el
index a048df8..a1f7a8d 100644
--- a/hydra.el
+++ b/hydra.el
@@ -584,6 +584,12 @@ HEAD's binding is returned as a string wrapped with [] or 
{}."
 (defvar hydra-docstring-keys-translate-alist
   '(("↑" . "")))
 
+(defconst hydra-width-spec-regex " ?-?[0-9]*s?"
+  "Regex for the width spec in keys and %` quoted sexps.")
+
+(defvar hydra-key-regex "\\[\\|]\\|[-[:alnum:] ~.,;:/|?<>={}*+#%@!&^↑'`()\"]+?"
+  "Regex for the key quoted in the docstring.")
+
 (defun hydra--format (_name body docstring heads)
   "Generate a `format' statement from STR.
 \"%`...\" expressions are extracted into \"%S\".
@@ -597,7 +603,11 @@ The expressions can be auto-expanded according to NAME."
 offset)
 (while (setq start
  (string-match
-  "\\(?:%\\( 
?-?[0-9]*s?\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:[_?]\\( 
?-?[0-9]*?\\)\\(\\[\\|]\\|[-[:alnum:] ~.,;:/|?<>={}*+#%@!&^↑]+?\\)[_?]\\)"
+  (format
+   
"\\(?:%%\\(%s\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:[_?]\\(%s\\)\\(%s\\)[_?]\\)"
+   hydra-width-spec-regex
+   hydra-width-spec-regex
+   hydra-key-regex)
   docstring start))
   (cond ((eq ?? (aref (match-string 0 docstring) 0))
  (let* ((key (match-string 4 docstring))



[elpa] master 69529ad 01/36: hydra.el (hydra-default-hint): Add option

2017-07-22 Thread Oleh Krehel
branch: master
commit 69529aded3009ab663b276db8f2e484d39c4ca81
Author: justbur 
Commit: justbur 

hydra.el (hydra-default-hint): Add option
---
 hydra.el | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/hydra.el b/hydra.el
index 0acd578..1260463 100644
--- a/hydra.el
+++ b/hydra.el
@@ -193,6 +193,12 @@ warn: keep KEYMAP and issue a warning instead of running 
the command."
   :type 'boolean
   :group 'hydra)
 
+(defcustom hydra-default-hint ""
+  "Default :hint property to use for heads when not specified in
+the body or the head."
+  :type 'sexp
+  :group 'hydra)
+
 (defcustom hydra-lv t
   "When non-nil, `lv-message' (not `message') will be used to display hints."
   :type 'boolean)
@@ -975,7 +981,8 @@ result of `defhydra'."
   ((= len 2)
(setcdr (cdr h)
(list
-(hydra-plist-get-default body-plist :hint "")))
+(hydra-plist-get-default
+ body-plist :hint hydra-default-hint)))
(setcdr (nthcdr 2 h) (list :exit body-exit)))
   (t
(let ((hint (cl-caddr h)))
@@ -983,7 +990,8 @@ result of `defhydra'."
  (stringp hint)
  (stringp (eval hint)))
(setcdr (cdr h) (cons
-(hydra-plist-get-default body-plist 
:hint "")
+(hydra-plist-get-default
+ body-plist :hint hydra-default-hint)
 (cddr h)
(let ((hint-and-plist (cddr h)))
  (if (null (cdr hint-and-plist))



[elpa] master 272dc4a 05/36: hydra.el (hydra-docstring-keys-translate-alist): Update

2017-07-22 Thread Oleh Krehel
branch: master
commit 272dc4ad3bf12f92105775f547dfc982bae25162
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-docstring-keys-translate-alist): Update

Fixes #186
---
 hydra.el | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hydra.el b/hydra.el
index a1f7a8d..380ffd3 100644
--- a/hydra.el
+++ b/hydra.el
@@ -582,7 +582,13 @@ HEAD's binding is returned as a string wrapped with [] or 
{}."
 str))
 
 (defvar hydra-docstring-keys-translate-alist
-  '(("↑" . "")))
+  '(("↑" . "")
+("↓" . "")
+("→" . "")
+("←" . "")
+("⌫" . "DEL")
+("⌦" . "")
+("⏎" . "RET")))
 
 (defconst hydra-width-spec-regex " ?-?[0-9]*s?"
   "Regex for the width spec in keys and %` quoted sexps.")



[elpa] master 9fd53ba 08/36: hydra.el (hydra-doc-format-spec): New defcustom

2017-07-22 Thread Oleh Krehel
branch: master
commit 9fd53baa74cdef027d01bb9364c14df48999a00a
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-doc-format-spec): New defcustom

Allows to align ?*? stuff easier.
---
 hydra.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hydra.el b/hydra.el
index f711044..573fcc0 100644
--- a/hydra.el
+++ b/hydra.el
@@ -211,6 +211,9 @@ the body or the head."
   "Default `format'-style specifier for _a_  syntax in docstrings.
 When nil, you can specify your own at each location like this: _ 5a_.")
 
+(defcustom hydra-doc-format-spec "%s"
+  "Default `format'-style specifier for ?a?  syntax in docstrings.")
+
 (make-obsolete-variable
  'hydra-key-format-spec
  "Since the docstrings are aligned by hand anyway, this isn't very useful."
@@ -623,7 +626,7 @@ The expressions can be auto-expanded according to NAME."
  (setq docstring
(replace-match
 (or
- hydra-key-format-spec
+ hydra-doc-format-spec
  (concat "%" (match-string 3 docstring) "s"))
 t nil docstring)))
  (warn "Unrecognized key: ?%s?" key



[elpa] master 5be27f4 02/36: Add a shortcut to supply a head's eval-able docstring

2017-07-22 Thread Oleh Krehel
branch: master
commit 5be27f4b61672a4b8e9dcec2e78bacd1a95fa0d7
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add a shortcut to supply a head's eval-able docstring

* hydra.el (hydra--hint): Return "" if body's :hint is nil.
(hydra--format): Extend the regex from e.g. _a_ to [_?]a[_?].
Add another cond branch for quoted docs.

Example:

(defhydra hydra-org-agenda-view (:hint nil)
  "
_d_: ?d? day_g_: time grid=?g?  _a_: arch-trees
_w_: ?w? week   _[_: inactive   _A_: arch-files
_t_: ?t? fortnight  _f_: follow=?f? _r_: clock report=?r?
_m_: ?m? month  _e_: entry text=?e? _D_: include diary=?D?
_y_: ?y? year   _q_: quit   _L__l__c_: log = ?l?"
  ("SPC" org-agenda-reset-view)
  ("d" org-agenda-day-view (if (eq 'day (org-agenda-cts)) "[x]" "[ ]"))
  ("w" org-agenda-week-view (if (eq 'week (org-agenda-cts)) "[x]" "[ ]"))
  ("t" org-agenda-fortnight-view (if (eq 'fortnight (org-agenda-cts)) "[x]" 
"[ ]"))
  ("m" org-agenda-month-view (if (eq 'month (org-agenda-cts)) "[x]" "[ ]"))
  ("y" org-agenda-year-view (if (eq 'year (org-agenda-cts)) "[x]" "[ ]"))
  ("l" org-agenda-log-mode (format "% -3S" org-agenda-show-log))
  ("L" (org-agenda-log-mode '(4)))
  ("c" (org-agenda-log-mode 'clockcheck))
  ("f" org-agenda-follow-mode (format "% -3S" org-agenda-follow-mode))
  ("a" org-agenda-archives-mode)
  ("A" (org-agenda-archives-mode 'files))
  ("r" org-agenda-clockreport-mode (format "% -3S" 
org-agenda-clockreport-mode))
  ("e" org-agenda-entry-text-mode (format "% -3S" 
org-agenda-entry-text-mode))
  ("g" org-agenda-toggle-time-grid (format "% -3S" 
org-agenda-use-time-grid))
  ("D" org-agenda-toggle-diary (format "% -3S" org-agenda-include-diary))
  ("!" org-agenda-toggle-deadlines)
  ("[" (let ((org-agenda-include-inactive-timestamps t))
 (org-agenda-check-type t 'timeline 'agenda)
 (org-agenda-redo)
 (message "Display now includes inactive timestamps as well")))
  ("q" (message "Abort") :exit t))

While e.g. "_d_" quotes the key, "?d?" will quote the docstring.
Remember that the docstrings for each head are actually sexps, not plain
strings. With a simple trick like (format "% -3S", in order to have "nil"
and "t" have the same width, everything is neatly arranged.
---
 hydra.el | 127 +++
 1 file changed, 71 insertions(+), 56 deletions(-)

diff --git a/hydra.el b/hydra.el
index 1260463..d624581 100644
--- a/hydra.el
+++ b/hydra.el
@@ -467,60 +467,62 @@ Return DEFAULT if PROP is not in H."
 (defun hydra--hint (body heads)
   "Generate a hint for the echo area.
 BODY, and HEADS are parameters to `defhydra'."
-  (let (alist)
-(dolist (h heads)
-  (let ((val (assoc (cadr h) alist))
-(pstr (hydra-fontify-head h body)))
-(unless (null (cl-caddr h))
-  (if val
-  (setf (cadr val)
-(concat (cadr val) " " pstr))
-(push
- (cons (cadr h)
-   (cons pstr (cl-caddr h)))
- alist)
-(let ((keys (nreverse (mapcar #'cdr alist)))
-  (n-cols (plist-get (cddr body) :columns))
-  res)
-  (setq res
-(if n-cols
-(let ((n-rows (1+ (/ (length keys) n-cols)))
-  (max-key-len (apply #'max (mapcar (lambda (x) (length 
(car x))) keys)))
-  (max-doc-len (apply #'max (mapcar (lambda (x)
-  (length 
(hydra--to-string (cdr x keys
-  `(concat
-"\n"
-(mapconcat #'identity
-   (mapcar
-(lambda (x)
-  (mapconcat
-   (lambda (y)
- (and y
-  (funcall hydra-key-doc-function
-   (car y)
-   ,max-key-len
-   (hydra--to-string (cdr y))
-   ,max-doc-len))) x ""))
-',(hydra--matrix keys n-cols n-rows))
-   "\n")))
-
-
-  `(concat
-(mapconcat
- (lambda (x)
-   (let ((str (hydra--to-string (cdr x
- (format
-  (if (> (length str) 0)
-  (concat hydra-head-format str)
-"%s")
-  (car x
- ',keys
- ", ")
-,(if keys "." ""
-  (if (cl-every #'stringp
-(mapcar 'cddr alist))

[elpa] master f668f4c 06/36: hydra.el (hydra-key-regex): Add "↓←→⌫⌦⏎"

2017-07-22 Thread Oleh Krehel
branch: master
commit f668f4c11477d3d38230072244cd3581aa162def
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-key-regex): Add "↓←→⌫⌦⏎"

Re #186
---
 hydra.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hydra.el b/hydra.el
index 380ffd3..ff31b3d 100644
--- a/hydra.el
+++ b/hydra.el
@@ -593,7 +593,7 @@ HEAD's binding is returned as a string wrapped with [] or 
{}."
 (defconst hydra-width-spec-regex " ?-?[0-9]*s?"
   "Regex for the width spec in keys and %` quoted sexps.")
 
-(defvar hydra-key-regex "\\[\\|]\\|[-[:alnum:] ~.,;:/|?<>={}*+#%@!&^↑'`()\"]+?"
+(defvar hydra-key-regex "\\[\\|]\\|[-[:alnum:] 
~.,;:/|?<>={}*+#%@!&^↑↓←→⌫⌦⏎'`()\"]+?"
   "Regex for the key quoted in the docstring.")
 
 (defun hydra--format (_name body docstring heads)



[elpa] master 83b9019 07/36: hydra.el (hydra-width-spec-regex): Update

2017-07-22 Thread Oleh Krehel
branch: master
commit 83b9019944b768ec4a213f99594b31209b36e8c2
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-width-spec-regex): Update

Fixes #188
---
 hydra.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hydra.el b/hydra.el
index ff31b3d..f711044 100644
--- a/hydra.el
+++ b/hydra.el
@@ -590,7 +590,7 @@ HEAD's binding is returned as a string wrapped with [] or 
{}."
 ("⌦" . "")
 ("⏎" . "RET")))
 
-(defconst hydra-width-spec-regex " ?-?[0-9]*s?"
+(defconst hydra-width-spec-regex " ?-?[0-9]*?"
   "Regex for the width spec in keys and %` quoted sexps.")
 
 (defvar hydra-key-regex "\\[\\|]\\|[-[:alnum:] 
~.,;:/|?<>={}*+#%@!&^↑↓←→⌫⌦⏎'`()\"]+?"
@@ -610,8 +610,7 @@ The expressions can be auto-expanded according to NAME."
 (while (setq start
  (string-match
   (format
-   
"\\(?:%%\\(%s\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:[_?]\\(%s\\)\\(%s\\)[_?]\\)"
-   hydra-width-spec-regex
+   "\\(?:%%\\( 
?-?[0-9]*s?\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:[_?]\\(%s\\)\\(%s\\)[_?]\\)"
hydra-width-spec-regex
hydra-key-regex)
   docstring start))



[elpa] master 1eee0f3 18/36: hydra.el (hydra-get-property): New defun.

2017-07-22 Thread Oleh Krehel
branch: master
commit 1eee0f337a8021ef5de90fdf5e6b52638efe64fc
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-get-property): New defun.

* hydra.el (hydra-set-property): Add doc.
---
 hydra.el | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/hydra.el b/hydra.el
index 67b1cb5..7166d32 100644
--- a/hydra.el
+++ b/hydra.el
@@ -782,6 +782,9 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
 (defvar hydra-props-alist nil)
 
 (defun hydra-set-property (name key val)
+  "Set hydra property.
+NAME is the symbolic name of the hydra.
+KEY and VAL are forwarded to `plist-put'."
   (let ((entry (assoc name hydra-props-alist))
 plist)
 (when (null entry)
@@ -790,6 +793,14 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
 (setq plist (cdr entry))
 (setcdr entry (plist-put plist key val
 
+(defun hydra-get-property (name key)
+  "Get hydra property.
+NAME is the symbolic name of the hydra.
+KEY is forwarded to `plist-get'."
+  (let ((entry (assoc name hydra-props-alist)))
+(when entry
+  (plist-get (cdr entry) key
+
 (defun hydra-show-hint (hint caller)
   (let ((verbosity (plist-get (cdr (assoc caller hydra-props-alist))
   :verbosity)))



[elpa] master 585db09 17/36: hydra-examples.el: Add example of setting verbosity

2017-07-22 Thread Oleh Krehel
branch: master
commit 585db09f588805f9c49f679aa1f6d702fe115665
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra-examples.el: Add example of setting verbosity
---
 hydra-examples.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hydra-examples.el b/hydra-examples.el
index 4f12255..70f75b0 100644
--- a/hydra-examples.el
+++ b/hydra-examples.el
@@ -138,7 +138,8 @@
  ("e" move-end-of-line "end")
  ("d" delete-region "del" :color blue)
  ("y" kill-ring-save "yank" :color blue)
- ("q" nil "quit"
+ ("q" nil "quit")))
+  (hydra-set-property 'hydra-vi :verbosity 1))
 
 ;; This example introduces :color amaranth. It's similar to red,
 ;; except while you can quit red with any binding which isn't a Hydra



[elpa] master 3527b32 24/36: Fix byte compiler warnings

2017-07-22 Thread Oleh Krehel
branch: master
commit 3527b321ce02b796e22a4adb2b4c3f17899ca935
Author: Oleh Krehel 
Commit: Oleh Krehel 

Fix byte compiler warnings

* hydra.el: Require ring.

* hydra-ox.el: Declare functions.
---
 hydra-ox.el | 7 +++
 hydra.el| 1 +
 2 files changed, 8 insertions(+)

diff --git a/hydra-ox.el b/hydra-ox.el
index 0d489e5..a992efc 100644
--- a/hydra-ox.el
+++ b/hydra-ox.el
@@ -27,6 +27,13 @@
 
 (require 'hydra)
 (require 'org)
+(declare-function org-html-export-as-html 'ox-html)
+(declare-function org-html-export-to-html 'ox-html)
+(declare-function org-latex-export-as-latex 'ox-latex)
+(declare-function org-latex-export-to-latex 'ox-latex)
+(declare-function org-latex-export-to-pdf 'ox-latex)
+(declare-function org-ascii-export-as-ascii 'ox-ascii)
+(declare-function org-ascii-export-to-ascii 'ox-ascii)
 
 (defhydradio hydra-ox ()
   (body-only "Export only the body.")
diff --git a/hydra.el b/hydra.el
index c6fc306..b4c1926 100644
--- a/hydra.el
+++ b/hydra.el
@@ -82,6 +82,7 @@
 ;;* Requires
 (require 'cl-lib)
 (require 'lv)
+(require 'ring)
 
 (defvar hydra-curr-map nil
   "The keymap of the current Hydra called.")



[elpa] master 91f8e7c 22/36: hydra.el: Bump version

2017-07-22 Thread Oleh Krehel
branch: master
commit 91f8e7c13bcd9629ad1678588e58576ca6806b58
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el: Bump version

Fixes #205
---
 hydra.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hydra.el b/hydra.el
index 9b81dd4..09a0052 100644
--- a/hydra.el
+++ b/hydra.el
@@ -5,7 +5,7 @@
 ;; Author: Oleh Krehel 
 ;; Maintainer: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/hydra
-;; Version: 0.13.5
+;; Version: 0.13.6
 ;; Keywords: bindings
 ;; Package-Requires: ((cl-lib "0.5"))
 



[elpa] master 943636f 35/36: hydra.el: Bump version

2017-07-22 Thread Oleh Krehel
branch: master
commit 943636fe4a35298d9d234222bc4520dec9ef2305
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el: Bump version
---
 hydra.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hydra.el b/hydra.el
index 15b4829..e3b3703 100644
--- a/hydra.el
+++ b/hydra.el
@@ -5,7 +5,7 @@
 ;; Author: Oleh Krehel 
 ;; Maintainer: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/hydra
-;; Version: 0.13.6
+;; Version: 0.14.0
 ;; Keywords: bindings
 ;; Package-Requires: ((cl-lib "0.5"))
 



[elpa] master 9c2589f 19/36: Update the package description

2017-07-22 Thread Oleh Krehel
branch: master
commit 9c2589f9ae6c026f9b35dd469f025cef2017dbed
Author: Oleh Krehel 
Commit: Oleh Krehel 

Update the package description

Remove the ancient `hydra-create' mention. Add a link to the wiki.
Mention hydra-examples.el.
---
 hydra.el | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/hydra.el b/hydra.el
index 7166d32..3322abd 100644
--- a/hydra.el
+++ b/hydra.el
@@ -69,10 +69,14 @@
 ;; you can nest Hydras if you wish, with `hydra-toggle/body' possibly
 ;; becoming a blue head of another Hydra.
 ;;
-;; Initially, Hydra shipped with a simplified `hydra-create' macro, to
-;; which you could hook up the examples from hydra-examples.el.  It's
-;; better to take the examples simply as templates and use `defhydra'
-;; instead of `hydra-create', since it's more flexible.
+;; If you want to learn all intricacies of using `defhydra' without
+;; having to figure it all out from this source code, check out the
+;; wiki: https://github.com/abo-abo/hydra/wiki. There's a wealth of
+;; information there. Everyone is welcome to bring the existing pages
+;; up to date and add new ones.
+;;
+;; Additionally, the file hydra-examples.el serves to demo most of the
+;; functionality.
 
 ;;; Code:
 ;;* Requires



[elpa] master 32b8352 36/36: Merge commit '943636fe4a35298d9d234222bc4520dec9ef2305' from hydra

2017-07-22 Thread Oleh Krehel
branch: master
commit 32b8352c57238a370661f9bac9bb2e933163848d
Merge: 231ac7f 943636f
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit '943636fe4a35298d9d234222bc4520dec9ef2305' from hydra
---
 packages/hydra/hydra-examples.el |  49 +-
 packages/hydra/hydra-ox.el   |   8 +-
 packages/hydra/hydra-test.el | 362 +++
 packages/hydra/hydra.el  | 322 +-
 packages/hydra/lv.el |   4 +-
 5 files changed, 584 insertions(+), 161 deletions(-)

diff --git a/packages/hydra/hydra-examples.el b/packages/hydra/hydra-examples.el
index 9264feb..70f75b0 100644
--- a/packages/hydra/hydra-examples.el
+++ b/packages/hydra/hydra-examples.el
@@ -138,7 +138,8 @@
  ("e" move-end-of-line "end")
  ("d" delete-region "del" :color blue)
  ("y" kill-ring-save "yank" :color blue)
- ("q" nil "quit"
+ ("q" nil "quit")))
+  (hydra-set-property 'hydra-vi :verbosity 1))
 
 ;; This example introduces :color amaranth. It's similar to red,
 ;; except while you can quit red with any binding which isn't a Hydra
@@ -290,6 +291,48 @@ _h_   _l_   _o_k_y_ank
 ;; Recommended binding:
 ;; (global-set-key (kbd "C-x SPC") 'hydra-rectangle/body)
 
+;;** Example 12: org-agenda-view
+(defun org-agenda-cts ()
+  (and (eq major-mode 'org-agenda-mode)
+   (let ((args (get-text-property
+(min (1- (point-max)) (point))
+'org-last-args)))
+ (nth 2 args
+
+(defhydra hydra-org-agenda-view (:hint none)
+  "
+_d_: ?d? day_g_: time grid=?g?  _a_: arch-trees
+_w_: ?w? week   _[_: inactive   _A_: arch-files
+_t_: ?t? fortnight  _f_: follow=?f? _r_: clock report=?r?
+_m_: ?m? month  _e_: entry text=?e? _D_: include diary=?D?
+_y_: ?y? year   _q_: quit   _L__l__c_: log = ?l?"
+  ("SPC" org-agenda-reset-view)
+  ("d" org-agenda-day-view (if (eq 'day (org-agenda-cts)) "[x]" "[ ]"))
+  ("w" org-agenda-week-view (if (eq 'week (org-agenda-cts)) "[x]" "[ ]"))
+  ("t" org-agenda-fortnight-view (if (eq 'fortnight (org-agenda-cts)) "[x]" "[ 
]"))
+  ("m" org-agenda-month-view (if (eq 'month (org-agenda-cts)) "[x]" "[ ]"))
+  ("y" org-agenda-year-view (if (eq 'year (org-agenda-cts)) "[x]" "[ ]"))
+  ("l" org-agenda-log-mode (format "% -3S" org-agenda-show-log))
+  ("L" (org-agenda-log-mode '(4)))
+  ("c" (org-agenda-log-mode 'clockcheck))
+  ("f" org-agenda-follow-mode (format "% -3S" org-agenda-follow-mode))
+  ("a" org-agenda-archives-mode)
+  ("A" (org-agenda-archives-mode 'files))
+  ("r" org-agenda-clockreport-mode (format "% -3S" 
org-agenda-clockreport-mode))
+  ("e" org-agenda-entry-text-mode (format "% -3S" org-agenda-entry-text-mode))
+  ("g" org-agenda-toggle-time-grid (format "% -3S" org-agenda-use-time-grid))
+  ("D" org-agenda-toggle-diary (format "% -3S" org-agenda-include-diary))
+  ("!" org-agenda-toggle-deadlines)
+  ("[" (let ((org-agenda-include-inactive-timestamps t))
+ (org-agenda-check-type t 'timeline 'agenda)
+ (org-agenda-redo)
+ (message "Display now includes inactive timestamps as well")))
+  ("q" (message "Abort") :exit t)
+  ("v" nil))
+
+;; Recommended binding:
+;; (define-key org-agenda-mode-map "v" 'hydra-org-agenda-view/body)
+
 ;;* Helpers
 (require 'windmove)
 
@@ -336,4 +379,8 @@ _h_   _l_   _o_k_y_ank
   (goto-char mk
 
 (provide 'hydra-examples)
+
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
 ;;; hydra-examples.el ends here
diff --git a/packages/hydra/hydra-ox.el b/packages/hydra/hydra-ox.el
index e8d48e3..a992efc 100644
--- a/packages/hydra/hydra-ox.el
+++ b/packages/hydra/hydra-ox.el
@@ -27,7 +27,13 @@
 
 (require 'hydra)
 (require 'org)
-(require 'hydra);`defhydradio' is not autoloaded!
+(declare-function org-html-export-as-html 'ox-html)
+(declare-function org-html-export-to-html 'ox-html)
+(declare-function org-latex-export-as-latex 'ox-latex)
+(declare-function org-latex-export-to-latex 'ox-latex)
+(declare-function org-latex-export-to-pdf 'ox-latex)
+(declare-function org-ascii-export-as-ascii 'ox-ascii)
+(declare-function org-ascii-export-to-ascii 'ox-ascii)
 
 (defhydradio hydra-ox ()
   (body-only "Export only the body.")
diff --git a/packages/hydra/hydra-test.el b/packages/hydra/hydra-test.el
index a988a25..4618d6b 100644
--- a/packages/hydra/hydra-test.el
+++ b/packages/hydra/hydra-test.el
@@ -121,20 +121,18 @@ Call the head: `first-error'."
   (setq hydra-curr-body-fn
 (quote hydra-error/body)))
 (condition-case err
-(progn
-  (setq this-command
-(quote first-error))
-  (call-interactively
-   (function first-error)))
-((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8
-(when 

[elpa] master dd5f703 27/36: hydra.el: Use error-message-string, not message

2017-07-22 Thread Oleh Krehel
branch: master
commit dd5f703d5257e5fbedf3e2a400a68f2e7663077c
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el: Use error-message-string, not message

* hydra.el (hydra--make-defun): Update.

* hydra-test.el: Update tests.

Fixes #209
---
 hydra-test.el | 21 ++---
 hydra.el  |  2 +-
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 4c61ea1..9a3e3d7 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -127,7 +127,8 @@ Call the head: `first-error'."
   (call-interactively
(function first-error)))
   ((quit error)
-   (message "%S" err)
+   (message
+(error-message-string err))
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
  hydra-error/hint
@@ -162,7 +163,8 @@ Call the head: `next-error'."
   (call-interactively
(function next-error)))
   ((quit error)
-   (message "%S" err)
+   (message
+(error-message-string err))
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
  hydra-error/hint
@@ -197,7 +199,8 @@ Call the head: `previous-error'."
   (call-interactively
(function previous-error)))
   ((quit error)
-   (message "%S" err)
+   (message
+(error-message-string err))
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
  hydra-error/hint
@@ -514,7 +517,8 @@ Call the head: `next-line'."
   (call-interactively
(function next-line)))
   ((quit error)
-   (message "%S" err)
+   (message
+(error-message-string err))
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
  hydra-vi/hint
@@ -549,7 +553,8 @@ Call the head: `previous-line'."
   (call-interactively
(function previous-line)))
   ((quit error)
-   (message "%S" err)
+   (message
+(error-message-string err))
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
  hydra-vi/hint
@@ -691,7 +696,8 @@ Call the head: `(text-scale-set 0)'."
(interactive)
(text-scale-set 0
   ((quit error)
-   (message "%S" err)
+   (message
+(error-message-string err))
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
  hydra-zoom/hint
@@ -836,7 +842,8 @@ Call the head: `(text-scale-set 0)'."
(interactive)
(text-scale-set 0
   ((quit error)
-   (message "%S" err)
+   (message
+(error-message-string err))
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
  hydra-zoom/hint
diff --git a/hydra.el b/hydra.el
index 6895251..61fb01c 100644
--- a/hydra.el
+++ b/hydra.el
@@ -775,7 +775,7 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
  `(condition-case err
   ,(hydra--call-interactively cmd (cadr head))
 ((quit error)
- (message "%S" err)
+ (message (error-message-string err))
  (unless hydra-lv
(sit-for 0.8)
   ,(if (and body-idle (eq (cadr head) 'body))



[elpa] master 76d51ec 23/36: Fix compile warnings

2017-07-22 Thread Oleh Krehel
branch: master
commit 76d51ecd417b426941bd84e425dcbbc72aff46af
Author: Oleh Krehel 
Commit: Oleh Krehel 

Fix compile warnings
---
 hydra.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hydra.el b/hydra.el
index 09a0052..c6fc306 100644
--- a/hydra.el
+++ b/hydra.el
@@ -213,10 +213,12 @@ the body or the head."
 
 (defcustom hydra-key-format-spec "%s"
   "Default `format'-style specifier for _a_  syntax in docstrings.
-When nil, you can specify your own at each location like this: _ 5a_.")
+When nil, you can specify your own at each location like this: _ 5a_."
+  :type 'string)
 
 (defcustom hydra-doc-format-spec "%s"
-  "Default `format'-style specifier for ?a?  syntax in docstrings.")
+  "Default `format'-style specifier for ?a?  syntax in docstrings."
+  :type 'string)
 
 (make-obsolete-variable
  'hydra-key-format-spec



[elpa] master 0a5074a 09/36: hydra.el (hydra--format): Avoid inf loops

2017-07-22 Thread Oleh Krehel
branch: master
commit 0a5074afe87ba18e192368fa751d15b79dd097e0
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--format): Avoid inf loops

When a unrecognized key is found, skip it and go on.
---
 hydra.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hydra.el b/hydra.el
index 573fcc0..e1dedd2 100644
--- a/hydra.el
+++ b/hydra.el
@@ -629,6 +629,7 @@ The expressions can be auto-expanded according to NAME."
  hydra-doc-format-spec
  (concat "%" (match-string 3 docstring) "s"))
 t nil docstring)))
+ (setq start (match-end 0))
  (warn "Unrecognized key: ?%s?" key
 ((eq ?_ (aref (match-string 0 docstring) 0))
  (let* ((key (match-string 4 docstring))
@@ -652,6 +653,7 @@ The expressions can be auto-expanded according to NAME."
  hydra-key-format-spec
  (concat "%" (match-string 3 docstring) "s"))
 t nil docstring)))
+ (setq start (match-end 0))
  (warn "Unrecognized key: _%s_" key
 
 (t



[elpa] master 38ce88a 34/36: hydra.el : fix some docstring warning

2017-07-22 Thread Oleh Krehel
branch: master
commit 38ce88a9c3be11b0431080078095159b2211ca7a
Author: David AMAR 
Commit: David AMAR 

hydra.el : fix some docstring warning
---
 hydra.el | 58 ++
 1 file changed, 30 insertions(+), 28 deletions(-)

diff --git a/hydra.el b/hydra.el
index 1e28239..15b4829 100644
--- a/hydra.el
+++ b/hydra.el
@@ -225,9 +225,10 @@ When nil, you can specify your own at each location like 
this: _ 5a_."
   :type 'string)
 
 (defcustom hydra-look-for-remap nil
-  "When non-nil and when calling a head with a simple command, hydra will 
lookup
-for a potential remap command according to the current active keymap and call 
it
-instead if found"
+  "When non-nil, hydra binding behaves as keymap binding with [remap].
+When calling a head with a simple command, hydra will lookup for a potential
+remap command according to the current active keymap and call it instead if
+found"
   :type 'boolean)
 
 (make-obsolete-variable
@@ -415,11 +416,11 @@ Return DEFAULT if PROP is not in H."
   (hydra-plist-get-default (cl-cdddr h) prop default))
 
 (defun hydra--head-set-property (h prop value)
-  "set a property PROP to the value VALUE in the hydra head H"
+  "In hydra Head H, set a property PROP to the value VALUE."
   (cons (car h) (plist-put (cdr h) prop value)))
 
 (defun hydra--head-has-property (h prop)
-  "return non nil if heads H has the property PROP"
+  "Return non nil if heads H has the property PROP."
   (plist-member (cdr h) prop))
 
 (defun hydra--body-foreign-keys (body)
@@ -747,8 +748,8 @@ HEADS is a list of heads."
(format "The body can be accessed via `%S'." body-name)))
 
 (defun hydra--call-interactively-remap-maybe (cmd)
-  "`call-interactively' the given CMD or its remapped equivalent according to
-current active keymap if applicable and if `hydra-look-for-remap' is non nil"
+  "`call-interactively' the given CMD or its remapped equivalent.
+Only when `hydra-look-for-remap' is non nil."
   (let ((remapped-cmd (if hydra-look-for-remap
   (command-remapping `,cmd)
 nil)))
@@ -1024,8 +1025,7 @@ Each head of NORMALIZED-HEADS must have a column 
property."
finally return (append heads-all-columns (list heads-one-column)
 
 (defun hydra--pad-heads (heads-groups padding-head)
-  "Return a list of heads copied from HEADS-GROUPS where each heads group have 
the same length.
-This is achieved by adding PADDING-HEAD were needed."
+  "Return a copy of HEADS-GROUPS padded where applicable with PADDING-HEAD."
   (cl-loop for heads-group in heads-groups
  for this-head-group-length = (length heads-group)
  with head-group-max-length = (apply #'max (mapcar (lambda (heads) (length 
heads)) heads-groups))
@@ -1036,29 +1036,31 @@ This is achieved by adding PADDING-HEAD were needed."
  finally return balanced-heads-groups))
 
 (defun hydra--generate-matrix (heads-groups)
-  "Return a copy of HEADS-GROUPS with following differences:
-2 virtual heads acting as table header were added to each heads-group
-each head is decorated with 2 new properties max-doc-len and max-key-len 
representing the maximum dimension of their owning group
-every heads-group have equal length by adding padding heads where applicable."
+  "Return a copy of HEADS-GROUPS decorated with table formating information.
+Details of modification:
+2 virtual heads acting as table header were added to each heads-group.
+Each head is decorated with 2 new properties max-doc-len and max-key-len
+representing the maximum dimension of their owning group.
+ Every heads-group have equal length by adding padding heads where applicable."
   (when heads-groups
 (cl-loop for heads-group in (hydra--pad-heads heads-groups '(" " nil " " 
:exit t))
-   for column-name = (hydra--head-property (nth 0 heads-group) :column)
-   for max-key-len = (apply #'max (mapcar (lambda (x) (length (car x))) 
heads-group))
-   for max-doc-len = (apply #'max
-(length column-name)
-(mapcar (lambda (x) (length (hydra--to-string 
(nth 2 x heads-group))
-   for header-virtual-head = `(" " nil ,column-name :column ,column-name 
:exit t)
-   for separator-virtual-head = `(" " nil ,(make-string (+ 2 max-doc-len 
max-key-len) ?-) :column ,column-name :exit t)
-   for decorated-heads = (copy-tree (apply 'list header-virtual-head 
separator-virtual-head heads-group))
-   collect (mapcar (lambda (it)
- (hydra--head-set-property it :max-key-len max-key-len)
- (hydra--head-set-property it :max-doc-len 
max-doc-len))
-   decorated-heads)
-   into decorated-heads-matrix
-   finally return decorated-heads-matrix)))
+ for column-name = (hydra--head-property (nth 0 heads-group) 
:column)
+ for max-key-len = (apply #'max (mapcar (lambda (x) (length (car 
x))) heads-group))
+

[elpa] master 270b917 14/36: hydra.el (defhydra): Don't eval hints during the definition

2017-07-22 Thread Oleh Krehel
branch: master
commit 270b917f1c892a2cd55321e5eea1d028896d582b
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (defhydra): Don't eval hints during the definition

It's not necessary, and sometimes not even appropriate to `eval' the
head's hint. For instance, the hint may assume being in some particular
state, like `org-agenda-mode' etc.
---
 hydra.el | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/hydra.el b/hydra.el
index 6b07dca..9e4947d 100644
--- a/hydra.el
+++ b/hydra.el
@@ -1035,11 +1035,15 @@ result of `defhydra'."
(let ((hint (cl-caddr h)))
  (unless (or (null hint)
  (stringp hint)
- (stringp (eval hint)))
-   (setcdr (cdr h) (cons
-(hydra-plist-get-default
- body-plist :hint hydra-default-hint)
-(cddr h)
+ (consp hint))
+   (let ((inherited-hint
+  (hydra-plist-get-default
+   body-plist :hint hydra-default-hint)))
+ (setcdr (cdr h) (cons
+  (if (eq 'none inherited-hint)
+  nil
+inherited-hint)
+  (cddr h))
(let ((hint-and-plist (cddr h)))
  (if (null (cdr hint-and-plist))
  (setcdr hint-and-plist (list :exit body-exit))



[elpa] master 81d88e4 15/36: hydra.el (hydra-show-hint): Extract from defhydra

2017-07-22 Thread Oleh Krehel
branch: master
commit 81d88e4c11595c2d7003546e0afbbd03a5222a37
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-show-hint): Extract from defhydra

* hydra-test.el: Update tests.

There should be no change in the behavior, but now the code that shows
the hint is all conveniently in a single defun, instead of separately in
each hydra's each head.
---
 hydra-test.el | 146 --
 hydra.el  |  16 +++
 2 files changed, 57 insertions(+), 105 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 03c20d4..1c14c70 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -121,20 +121,16 @@ Call the head: `first-error'."
   (setq hydra-curr-body-fn
 (quote hydra-error/body)))
 (condition-case err
-(progn
-  (setq this-command
-(quote first-error))
-  (call-interactively
-   (function first-error)))
-((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8
-(when hydra-is-helpful
-  (if hydra-lv
-  (lv-message
-   (eval hydra-error/hint))
-(message
- (eval hydra-error/hint
+(progn
+  (setq this-command
+(quote first-error))
+  (call-interactively
+   (function first-error)))
+  ((quit error)
+   (message "%S" err)
+   (unless hydra-lv (sit-for 0.8
+(hydra-show-hint
+ hydra-error/hint)
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -159,20 +155,16 @@ Call the head: `next-error'."
   (setq hydra-curr-body-fn
 (quote hydra-error/body)))
 (condition-case err
-(progn
-  (setq this-command
-(quote next-error))
-  (call-interactively
-   (function next-error)))
-((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8
-(when hydra-is-helpful
-  (if hydra-lv
-  (lv-message
-   (eval hydra-error/hint))
-(message
- (eval hydra-error/hint
+(progn
+  (setq this-command
+(quote next-error))
+  (call-interactively
+   (function next-error)))
+  ((quit error)
+   (message "%S" err)
+   (unless hydra-lv (sit-for 0.8
+(hydra-show-hint
+ hydra-error/hint)
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -197,20 +189,16 @@ Call the head: `previous-error'."
   (setq hydra-curr-body-fn
 (quote hydra-error/body)))
 (condition-case err
-(progn
-  (setq this-command
-(quote previous-error))
-  (call-interactively
-   (function previous-error)))
-((quit error)
- (message "%S" err)
- (unless hydra-lv (sit-for 0.8
-(when hydra-is-helpful
-  (if hydra-lv
-  (lv-message
-   (eval hydra-error/hint))
-(message
- (eval hydra-error/hint
+(progn
+  (setq this-command
+(quote previous-error))
+  (call-interactively
+   (function previous-error)))
+  ((quit error)
+   (message "%S" err)
+   (unless hydra-lv (sit-for 0.8
+(hydra-show-hint
+ hydra-error/hint)
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -224,12 +212,12 @@ Call the head: `previous-error'."
 (define-key global-map (kbd "M-g")
   nil))
   (define-key global-map [134217831 104]
-(quote hydra-error/first-error))
+   (quote hydra-error/first-error))
   (define-key global-map [134217831 106]
-(quote hydra-error/next-error))
+   (quote hydra-error/next-error))
   (define-key global-map [134217831 107]
-(quote
- hydra-error/previous-error))
+   (quote
+hydra-error/previous-error))
   (defun hydra-error/body nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -245,12 +233,8 @@ The body can be accessed via `hydra-error/body'."
   (hydra-keyboard-quit)
   (setq hydra-curr-body-fn
 (quote hydra-error/body)))
-(when hydra-is-helpful
-  (if hydra-lv
-  (lv-message
-   (ev

[elpa] master f877855 12/36: hydra-examples.el (org-agenda-cts): Add

2017-07-22 Thread Oleh Krehel
branch: master
commit f8778552841f44b206089a2b52a2bc2d5cbf7c68
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra-examples.el (org-agenda-cts): Add

Fixes #191
---
 hydra-examples.el | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/hydra-examples.el b/hydra-examples.el
index 413c937..f464ba1 100644
--- a/hydra-examples.el
+++ b/hydra-examples.el
@@ -291,6 +291,13 @@ _h_   _l_   _o_k_y_ank
 ;; (global-set-key (kbd "C-x SPC") 'hydra-rectangle/body)
 
 ;;** Example 12: org-agenda-view
+(defun org-agenda-cts ()
+  (and (eq major-mode 'org-agenda-mode)
+   (let ((args (get-text-property
+(min (1- (point-max)) (point))
+'org-last-args)))
+ (nth 2 args
+
 (defhydra hydra-org-agenda-view (:hint none)
   "
 _d_: ?d? day_g_: time grid=?g?  _a_: arch-trees



[elpa] master 95008ea 30/36: hydra.el: Add automatic lookup for remaped cmd

2017-07-22 Thread Oleh Krehel
branch: master
commit 95008ea38bc2b6420ba48d250b8a2bf6070a49e7
Author: David AMAR 
Commit: Oleh Krehel 

hydra.el: Add automatic lookup for remaped cmd

* hydra-test.el (hydra-remap-lookup-1):
(hydra-remap-lookup-2): New tests.

* hydra.el (hydra-look-for-remap): New defcustom.
(hydra--call-interactively-remap-maybe): New defun.
(hydra--call-interactively): Update.

Fixes #222
Fixes #221
---
 hydra-test.el | 52 
 hydra.el  | 20 ++--
 2 files changed, 58 insertions(+), 14 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 5181cfb..8057d80 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -124,7 +124,7 @@ Call the head: `first-error'."
 (progn
   (setq this-command
 (quote first-error))
-  (call-interactively
+  (hydra--call-interactively-remap-maybe
(function first-error)))
   ((quit error)
(message
@@ -160,7 +160,7 @@ Call the head: `next-error'."
 (progn
   (setq this-command
 (quote next-error))
-  (call-interactively
+  (hydra--call-interactively-remap-maybe
(function next-error)))
   ((quit error)
(message
@@ -196,7 +196,7 @@ Call the head: `previous-error'."
 (progn
   (setq this-command
 (quote previous-error))
-  (call-interactively
+  (hydra--call-interactively-remap-maybe
(function previous-error)))
   ((quit error)
(message
@@ -340,7 +340,7 @@ Call the head: `toggle-truncate-lines'."
 (progn
   (setq this-command
 (quote toggle-truncate-lines))
-  (call-interactively
+  (hydra--call-interactively-remap-maybe
(function
 toggle-truncate-lines
   (defun hydra-toggle/auto-fill-mode-and-exit nil
@@ -362,7 +362,7 @@ Call the head: `auto-fill-mode'."
 (progn
   (setq this-command
 (quote auto-fill-mode))
-  (call-interactively
+  (hydra--call-interactively-remap-maybe
(function auto-fill-mode
   (defun hydra-toggle/abbrev-mode-and-exit nil
 "Create a hydra with no body and the heads:
@@ -383,7 +383,7 @@ Call the head: `abbrev-mode'."
 (progn
   (setq this-command
 (quote abbrev-mode))
-  (call-interactively
+  (hydra--call-interactively-remap-maybe
(function abbrev-mode
   (defun hydra-toggle/nil nil
 "Create a hydra with no body and the heads:
@@ -514,7 +514,7 @@ Call the head: `next-line'."
 (progn
   (setq this-command
 (quote next-line))
-  (call-interactively
+  (hydra--call-interactively-remap-maybe
(function next-line)))
   ((quit error)
(message
@@ -550,7 +550,7 @@ Call the head: `previous-line'."
 (progn
   (setq this-command
 (quote previous-line))
-  (call-interactively
+  (hydra--call-interactively-remap-maybe
(function previous-line)))
   ((quit error)
(message
@@ -690,7 +690,7 @@ Call the head: `(text-scale-set 0)'."
   (setq hydra-curr-body-fn
 (quote hydra-zoom/body)))
 (condition-case err
-(call-interactively
+(hydra--call-interactively-remap-maybe
  (function
   (lambda nil
(interactive)
@@ -723,7 +723,7 @@ Call the head: `(text-scale-set 0)'."
 (hydra-keyboard-quit)
 (setq hydra-curr-body-fn
   (quote hydra-zoom/body))
-(call-interactively
+(hydra--call-interactively-remap-maybe
  (function
   (lambda nil
(interactive)
@@ -836,7 +836,7 @@ Call the head: `(text-scale-set 0)'."
   (setq hydra-curr-body-fn
 (quote hydra-zoom/body)))
 (condition-case err
-(call-interactively
+(hydra--call-interactively-remap-maybe
  (function
   (lambda nil
(interactive)
@@ -869,7 +869,7 @@ Call the head: `(text-scale-set 0)'."
 (hydra-keyboard-quit)
 (setq hydra-curr-body-fn
   (quote hydra-zoom/body))
-(call-interactively
+(hydra--call-interactively-remap-maybe
  (function
   (lambda nil
(interactive)
@@ -1290,6 +1290,19 @@ _w_ Worf:  % -8`hydra-tng/worf^^
_h_ Set phasers to
   ("1" find-file)
   ("q" nil))
 
+(defun remapable-print ()
+  (interactive)
+  (insert "remapable print was called"))
+(defun remaped-print ()
+  (interactive)
+  (insert "*remaped* print was called"))
+(define-ke

[elpa] master 63de503 21/36: hydra.el (hydra-key-regex): Add "$"

2017-07-22 Thread Oleh Krehel
branch: master
commit 63de503ee8b42812e9f7488c279e95ed24f5e7f8
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-key-regex): Add "$"

Fixes #203
---
 hydra.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hydra.el b/hydra.el
index 1ec80ea..9b81dd4 100644
--- a/hydra.el
+++ b/hydra.el
@@ -598,7 +598,7 @@ HEAD's binding is returned as a string wrapped with [] or 
{}."
 (defconst hydra-width-spec-regex " ?-?[0-9]*?"
   "Regex for the width spec in keys and %` quoted sexps.")
 
-(defvar hydra-key-regex "\\[\\|]\\|[-[:alnum:] 
~.,;:/|?<>={}*+#%@!&^↑↓←→⌫⌦⏎'`()\"]+?"
+(defvar hydra-key-regex "\\[\\|]\\|[-[:alnum:] 
~.,;:/|?<>={}*+#%@!&^↑↓←→⌫⌦⏎'`()\"$]+?"
   "Regex for the key quoted in the docstring.")
 
 (defun hydra--format (_name body docstring heads)



[elpa] master a72d68a 28/36: hydra.el (hydra-fontify-head-default): Fix head keys as "%f"

2017-07-22 Thread Oleh Krehel
branch: master
commit a72d68a0f6492af6201fbdb88211cb2f7488f3be
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-fontify-head-default): Fix head keys as "%f"

Fixes #223

For example, this should work now:

(defhydra hydra-test ()
  "test"
  ("%f" forward-char))
---
 hydra.el | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/hydra.el b/hydra.el
index 61fb01c..eaedd6c 100644
--- a/hydra.el
+++ b/hydra.el
@@ -555,18 +555,17 @@ HEAD's binding is returned as a string with a colored 
face."
 (when (and (null (cadr head))
(not head-exit))
   (hydra--complain "nil cmd can only be blue"))
-(propertize (if (string= (car head) "%")
-"%%"
-  (car head))
-'face
-(or (hydra--head-property head :face)
-(cl-case head-color
-  (blue 'hydra-face-blue)
-  (red 'hydra-face-red)
-  (amaranth 'hydra-face-amaranth)
-  (pink 'hydra-face-pink)
-  (teal 'hydra-face-teal)
-  (t (error "Unknown color for %S" head)))
+(propertize
+ (replace-regexp-in-string "%" "%%" (car head))
+ 'face
+ (or (hydra--head-property head :face)
+ (cl-case head-color
+   (blue 'hydra-face-blue)
+   (red 'hydra-face-red)
+   (amaranth 'hydra-face-amaranth)
+   (pink 'hydra-face-pink)
+   (teal 'hydra-face-teal)
+   (t (error "Unknown color for %S" head)))
 
 (defun hydra-fontify-head-greyscale (head _body)
   "Produce a pretty string from HEAD and BODY.



[elpa] master 1d378c6 16/36: Allow to set hydra verbosity

2017-07-22 Thread Oleh Krehel
branch: master
commit 1d378c6887f4ad2f7d4797274e98f020e56f375b
Author: Oleh Krehel 
Commit: Oleh Krehel 

Allow to set hydra verbosity

* hydra.el (hydra--make-defun): Rewrite `hydra-show-hint' arglist. The
  hydra name should also be passed.
(hydra-set-property): New defun.
(hydra-show-hint): Add `caller' arg - the name of the hydra. It can be
used as a key in `hydra-props-alist'.
(hydra-idle-message): Add arg.

* hydra-test.el: Update tests.
---
 hydra-test.el | 39 +++
 hydra.el  | 35 ++-
 2 files changed, 53 insertions(+), 21 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 1c14c70..88d12a8 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -130,7 +130,8 @@ Call the head: `first-error'."
(message "%S" err)
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
- hydra-error/hint)
+ hydra-error/hint
+ (quote hydra-error))
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -164,7 +165,8 @@ Call the head: `next-error'."
(message "%S" err)
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
- hydra-error/hint)
+ hydra-error/hint
+ (quote hydra-error))
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -198,7 +200,8 @@ Call the head: `previous-error'."
(message "%S" err)
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
- hydra-error/hint)
+ hydra-error/hint
+ (quote hydra-error))
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -234,7 +237,8 @@ The body can be accessed via `hydra-error/body'."
   (setq hydra-curr-body-fn
 (quote hydra-error/body)))
 (hydra-show-hint
- hydra-error/hint)
+ hydra-error/hint
+ (quote hydra-error))
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -410,7 +414,8 @@ The body can be accessed via `hydra-toggle/body'."
   (setq hydra-curr-body-fn
 (quote hydra-toggle/body)))
 (hydra-show-hint
- hydra-toggle/hint)
+ hydra-toggle/hint
+ (quote hydra-toggle))
 (hydra-set-transient-map
  hydra-toggle/keymap
  (lambda nil
@@ -511,7 +516,9 @@ Call the head: `next-line'."
   ((quit error)
(message "%S" err)
(unless hydra-lv (sit-for 0.8
-(hydra-show-hint hydra-vi/hint)
+(hydra-show-hint
+ hydra-vi/hint
+ (quote hydra-vi))
 (hydra-set-transient-map
  hydra-vi/keymap
  (lambda nil
@@ -544,7 +551,9 @@ Call the head: `previous-line'."
   ((quit error)
(message "%S" err)
(unless hydra-lv (sit-for 0.8
-(hydra-show-hint hydra-vi/hint)
+(hydra-show-hint
+ hydra-vi/hint
+ (quote hydra-vi))
 (hydra-set-transient-map
  hydra-vi/keymap
  (lambda nil
@@ -582,7 +591,9 @@ The body can be accessed via `hydra-vi/body'."
   (hydra-keyboard-quit)
   (setq hydra-curr-body-fn
 (quote hydra-vi/body)))
-(hydra-show-hint hydra-vi/hint)
+(hydra-show-hint
+ hydra-vi/hint
+ (quote hydra-vi))
 (hydra-set-transient-map
  hydra-vi/keymap
  (lambda nil
@@ -683,7 +694,8 @@ Call the head: `(text-scale-set 0)'."
(message "%S" err)
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
- hydra-zoom/hint)
+ hydra-zoom/hint
+ (quote hydra-zoom))
 (hydra-set-transient-map
  hydra-zoom/keymap
  (lambda nil
@@ -725,7 +737,8 @@ The body can be accessed via `hydra-zoom/body'."
   (setq hydra-curr-body-fn
 (quote hydra-zoom/body)))
 (hydra-show-hint
- hydra-zoom/hint)
+ hydra-zoom/hint
+ (quote hydra-zoom))
 (hydra-set-transient-map
  hydra-zoom/keymap
  (lambda nil
@@ -826,7 +839,8 @@ Call the head: `(text-scale-set 0)'."
(message "%S" err)
(unless hydra-lv (sit-for 0.8
 (hydra-show-hint
- hydra-zoom/hint)
+ hydra-zoom/hint
+ (quote hydra-zoom))
 (hydra-set-transient-map
  hydra-zoom/keymap
  (lambda nil
@@ -868,7 +882,8 @@ The body can be accessed via `hydra-zoom/body'."
   (setq hydra-curr-body-fn
 (quote hydra-zoom/body)))
 (hydra-show-hint
- hydra-zoom/hint)
+ hydra-zoom/hint
+ (quote hydra-zoom))
 (hydra-set-transient-map
  hydra-zoom/keymap
  (lambda nil
diff --git a/hydra.el b/hydra.el
index 14d275e..67b1cb5 100644
--- a/hydra.el
+++ b/hydra.el
@@ -768,8 +768,8 @@ BODY-AFTER-

[elpa] master d2aaf86 20/36: Fix e.g. _f_(foo) in format string

2017-07-22 Thread Oleh Krehel
branch: master
commit d2aaf869ecba10664e1fa8abd69689f941e3b8f8
Author: Oleh Krehel 
Commit: Oleh Krehel 

Fix e.g. _f_(foo) in format string

The "_f_" was getting replaced with "%s", which was subsequently
interpreted as "%s(foo)".

* hydra-test.el (hydra-format-9): New test.

Fixes #197
---
 hydra-test.el | 11 +++
 hydra.el  |  9 +
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 88d12a8..4c61ea1 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1114,6 +1114,17 @@ _f_ auto-fill-mode:%`auto-fill-function
   #("test: [b]: back."
 7 8 (face hydra-face-red))
 
+(ert-deftest hydra-format-9 ()
+  (should
+   (equal
+(hydra--format nil '(nil nil :hint nil) "\n_f_(foo)"
+   '(("f" forward-char nil :exit nil)))
+'(concat
+  (format
+   "%s(foo)"
+   #("f" 0 1 (face hydra-face-red)))
+  ""
+
 (ert-deftest hydra-format-with-sexp-1 ()
   (should (equal
(let ((hydra-fontify-head-function
diff --git a/hydra.el b/hydra.el
index 3322abd..1ec80ea 100644
--- a/hydra.el
+++ b/hydra.el
@@ -651,12 +651,13 @@ The expressions can be auto-expanded according to NAME."
  head)
body)
varlist)
- (setq docstring
-   (replace-match
+ (let ((replacement
 (or
  hydra-key-format-spec
- (concat "%" (match-string 3 docstring) "s"))
-t nil docstring)))
+ (concat "%" (match-string 3 docstring) "s"
+   (setq docstring
+ (replace-match replacement t nil docstring))
+   (setq start (+ start (length replacement)
  (setq start (match-end 0))
  (warn "Unrecognized key: _%s_" key
 



[elpa] master 36fb5e0 32/36: hydra.el (defhydra): Use copy-tree on heads

2017-07-22 Thread Oleh Krehel
branch: master
commit 36fb5e0149795404d0271419fd4354ba58f81dbc
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (defhydra): Use copy-tree on heads

Since HEADS arg will be modified by adding various properties, make a
deep copy of it (`copy-sequence' is not enough).

This solves the problem of using the same heads list for two different
hydras, in a macro or otherwise.

Fixes #230
---
 hydra.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hydra.el b/hydra.el
index 0fce192..79ee6f1 100644
--- a/hydra.el
+++ b/hydra.el
@@ -1155,6 +1155,7 @@ want to bind anything.  In that case, typically you will 
bind the
 generated NAME/body command.  This command is also the return
 result of `defhydra'."
   (declare (indent defun))
+  (setq heads (copy-tree heads))
   (cond ((stringp docstring))
 ((and (consp docstring)
   (memq (car docstring) '(hydra--table concat format)))



[elpa] master 2ebf862 25/36: Move Amaranth warning message to a defvar

2017-07-22 Thread Oleh Krehel
branch: master
commit 2ebf8624d563f5e5b9dd3c13b973579e8d415092
Author: jasonm23 
Commit: jasonm23 

Move Amaranth warning message to a defvar
---
 hydra.el | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hydra.el b/hydra.el
index b4c1926..6895251 100644
--- a/hydra.el
+++ b/hydra.el
@@ -100,6 +100,9 @@
   "If a Hydra head sets this to t, exit the Hydra.
 This will be done even if the head wasn't designated for exiting.")
 
+(defvar hydra-amaranth-warn-message "An amaranth Hydra can only exit through a 
blue head"
+  "Amaranth Warning message.  Shown when the user tries to press an 
unbound/non-exit key while in an amaranth head.")
+
 (defun hydra-set-transient-map (keymap on-exit &optional foreign-keys)
   "Set KEYMAP to the highest priority.
 
@@ -185,7 +188,7 @@ warn: keep KEYMAP and issue a warning instead of running 
the command."
 (defun hydra-amaranth-warn ()
   "Issue a warning that the current input was ignored."
   (interactive)
-  (message "An amaranth Hydra can only exit through a blue head"))
+  (message hydra-amaranth-warn-message))
 
 ;;* Customize
 (defgroup hydra nil



[elpa] master 3db82e5 29/36: Implement named columns

2017-07-22 Thread Oleh Krehel
branch: master
commit 3db82e5f4340e40143c594192177088fe1a61443
Author: David AMAR 
Commit: Oleh Krehel 

Implement named columns

This is a first rough implementation to gather early reviews

diff with code snippet from #147:
- Dash dependencies removed
- slight refactoring

Add basic column integration test.

Fixes #220
---
 hydra-test.el |  72 +
 hydra.el  | 114 +++---
 2 files changed, 182 insertions(+), 4 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 9a3e3d7..5181cfb 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1409,6 +1409,78 @@ t: info-to"
314 315 (face hydra-face-blue)
322 323 (face hydra-face-blue)
 
+;; checked:
+;; basic rendering
+;; column compatibility with ruby style and no colum specified
+;; column declared several time
+;; nil column 
+(ert-deftest hydra-column-1 ()
+  (should (equal (eval
+  (cadr
+   (nth 2
+(nth 3
+ (macroexpand
+  '(defhydra hydra-rectangle (:body-pre 
(rectangle-mark-mode 1)
+:color pink
+:post 
(deactivate-mark))
+ "
+  ^_k_^ ()()
+_h_   _l_   (O)(o)
+  ^_j_^ (  O )
+(’’)(’’)
+
+"
+ ("h" backward-char nil)
+ ("l" forward-char nil)
+ ("k" previous-line nil)
+ ("j" next-line nil)
+ ("Of" 5x5 "outside of table 1")
+ ("e" exchange-point-and-mark "exchange" 
:column "firstcol")
+ ("n" copy-rectangle-as-kill "new-copy")
+ ("d" delete-rectangle "delete")
+ ("r" (if (region-active-p)
+  (deactivate-mark)
+(rectangle-mark-mode 1)) "reset" 
:column "secondcol")
+ ("y" yank-rectangle "yank")
+ ("u" undo "undo")
+ ("s" string-rectangle "string")
+ ("p" kill-rectangle "paste")
+ ("o" nil "ok" :column "firstcol")
+ ("Os" 5x5-bol "outside of table 2" :column 
nil)
+ ("Ot" 5x5-eol "outside of table 3")))
+
+#("  k ()()
+h   l   (O)(o)
+  j (  O )
+(’’)(’’)
+
+
+firstcol| secondcol
+--- |  
+e: exchange | r: reset 
+n: new-copy | y: yank  
+d: delete   | u: undo  
+o: ok   | s: string
+| p: paste 
+[Of]: outside of table 1, [Os]: outside of table 2, [Ot]: outside of table 3."
+2 3 (face hydra-face-pink)
+17 18 (face hydra-face-pink)
+21 22 (face hydra-face-pink)
+38 39 (face hydra-face-pink)
+142 143 (face hydra-face-pink)
+156 157 (face hydra-face-pink)
+170 171 (face hydra-face-pink)
+184 185 (face hydra-face-pink)
+198 199 (face hydra-face-pink)
+212 213 (face hydra-face-pink)
+226 227 (face hydra-face-blue)
+240 241 (face hydra-face-pink)
+268 269 (face hydra-face-pink)
+283 285 (face hydra-face-pink)
+309 311 (face hydra-face-pink)
+335 337 (face hydra-face-pink)
+
+
 (provide 'hydra-test)
 
 ;;; hydra-test.el ends here
diff --git a/hydra.el b/hydra.el
index eaedd6c..992f9db 100644
--- a/hydra.el
+++ b/hydra.el
@@ -408,6 +408,14 @@ one of the properties on the list."
 Return DEFAULT if PROP is not in H."
   (hydra-plist-get-default (cl-cdddr h) prop default))
 
+(defun hydra--head-set-property (h prop value)
+  "set a property PROP to the value VALUE in the hydra head H"
+  (cons (car h) (plist-put (cdr h) prop value)))
+
+(defun hydra--head-has-property (h prop)
+  "return non nil if heads H has the property PROP"
+  (plist-member (cdr h) prop))
+
 (defun hydra--body-foreign-keys (body)
   "Return what BODY does with a non-head binding."
   (or
@@ -469,17 +477,19 @@ Return DEFAULT if PROP is not in H."
 
 (defun hydra-key-doc-function-default (key key-width doc doc-width)
   "Doc"
-  (format (format "%%%ds: %%%ds" key-width (- -1 doc-width))
-  key doc))
+  (cond
+   ((equal key " ") (format (format "%%-%ds" (+ 3 key-width doc-width)) doc))
+   (t (format (format "%%%ds: %%%ds" key-width (- -1 doc-width)) key doc
 
 (defun hydra--to-string (x)
   (if (stringp x)
   x
 (eval x)))
 
-(defun hydra--hint (body heads)
+(defun hydra--hint-heads-wocol (body heads)
   "Generate a hint for the echo area.
-BODY, and HEADS are parameters to `defhydra'."
+BOD

[elpa] master 2751f00 31/36: Remove trailing whitespace from :column docstring

2017-07-22 Thread Oleh Krehel
branch: master
commit 2751f00c2c3daa8cc00f0fee7d01c803ddde7bb2
Author: David AMAR 
Commit: David AMAR 

Remove trailing whitespace from :column docstring

Table doctrings generated from :column algorithm no longer have trailing
whitespace
Test hydra-column-1 modified accordingly
Trimming whitespace in hydra-test.el no longer breaks non-regression
---
 hydra-test.el | 57 -
 hydra.el  | 29 +++--
 2 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 8057d80..94a19a4 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1441,7 +1441,7 @@ t: info-to"
 ;; basic rendering
 ;; column compatibility with ruby style and no colum specified
 ;; column declared several time
-;; nil column 
+;; nil column
 (ert-deftest hydra-column-1 ()
   (should (equal (eval
   (cadr
@@ -1456,7 +1456,7 @@ t: info-to"
 _h_   _l_   (O)(o)
   ^_j_^ (  O )
 (’’)(’’)
-
+
 "
  ("h" backward-char nil)
  ("l" forward-char nil)
@@ -1476,37 +1476,36 @@ _h_   _l_   (O)(o)
  ("o" nil "ok" :column "firstcol")
  ("Os" 5x5-bol "outside of table 2" :column 
nil)
  ("Ot" 5x5-eol "outside of table 3")))
-
-#("  k ()()
+ #("  k ()()
 h   l   (O)(o)
   j (  O )
 (’’)(’’)
-
-
-firstcol| secondcol
 |  
-e: exchange | r: reset 
-n: new-copy | y: yank  
-d: delete   | u: undo  
-o: ok   | s: string
-| p: paste 
+
+
+firstcol| secondcol
+--- | 
+e: exchange | r: reset
+n: new-copy | y: yank
+d: delete   | u: undo
+o: ok   | s: string
+| p: paste
 [Of]: outside of table 1, [Os]: outside of table 2, [Ot]: outside of table 3."
-2 3 (face hydra-face-pink)
-17 18 (face hydra-face-pink)
-21 22 (face hydra-face-pink)
-38 39 (face hydra-face-pink)
-142 143 (face hydra-face-pink)
-156 157 (face hydra-face-pink)
-170 171 (face hydra-face-pink)
-184 185 (face hydra-face-pink)
-198 199 (face hydra-face-pink)
-212 213 (face hydra-face-pink)
-226 227 (face hydra-face-blue)
-240 241 (face hydra-face-pink)
-268 269 (face hydra-face-pink)
-283 285 (face hydra-face-pink)
-309 311 (face hydra-face-pink)
-335 337 (face hydra-face-pink)
+   2 3 (face hydra-face-pink)
+   17 18 (face hydra-face-pink)
+   21 22 (face hydra-face-pink)
+   38 39 (face hydra-face-pink)
+   129 130 (face hydra-face-pink)
+   143 144 (face hydra-face-pink)
+   152 153 (face hydra-face-pink)
+   166 167 (face hydra-face-pink)
+   174 175 (face hydra-face-pink)
+   188 189 (face hydra-face-pink)
+   196 197 (face hydra-face-blue)
+   210 211 (face hydra-face-pink)
+   234 235 (face hydra-face-pink)
+   244 246 (face hydra-face-pink)
+   270 272 (face hydra-face-pink)
+   296 298 (face hydra-face-pink)
 
 
 (provide 'hydra-test)
diff --git a/hydra.el b/hydra.el
index 830ac5a..0fce192 100644
--- a/hydra.el
+++ b/hydra.el
@@ -1053,25 +1053,26 @@ every heads-group have equal length by adding padding 
heads where applicable."
finally return decorated-heads-matrix)))
 
 (defun hydra--hint-from-matrix (body heads-matrix)
-  "Generate a formated table-style docstring according to HEADS-MATRIX and 
BODY data and structure
+  "Generate a formated table-style docstring according to BODY and 
HEADS-MATRIX data and structure.
 HEADS-MATRIX is expected to be a list of heads with following features:
 Each heads must have the same length
 Each head must have a property max-key-len and max-doc-len."
   (when heads-matrix
 (cl-loop with first-heads-col = (nth 0 heads-matrix)
-   with last-row-index = (- (length first-heads-col) 1)
-   for row-index from 0 to last-row-index
-   for heads-in-row = (mapcar (lambda (heads) (nth row-index heads)) 
heads-matrix)
-   concat (concat
-   (mapconcat (lambda (head)
-(funcall hydra-key-doc-function
- (hydra-fontify-head head body) ;; key
- (hydra--head-property head :max-key-len)
- (nth 2 head) ;; doc
- (hydra--head-property head :max-doc-len)))
-  heads-in-row "| ") "\n")
-   into matrix-image
-   finally return matrix-image)))
+ with last-row-index = (- (length first-heads-col) 1)
+ for row-index from 0 to last-row-inde

[elpa] master 02f2907 33/36: hydra.el (hydra--sort-heads): change ordering method of columns

2017-07-22 Thread Oleh Krehel
branch: master
commit 02f29073e0074ffc124c3545f87f21f73f3c057e
Author: David AMAR 
Commit: David AMAR 

hydra.el (hydra--sort-heads): change ordering method of columns

The order was based upon the alphabetical order of the column name.
It is now done upon the order in which column name first appear in defhydra.
---
 hydra-test.el | 50 +-
 hydra.el  | 13 +
 2 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 94a19a4..ffbfa24 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1442,7 +1442,7 @@ t: info-to"
 ;; column compatibility with ruby style and no colum specified
 ;; column declared several time
 ;; nil column
-(ert-deftest hydra-column-1 ()
+(ert-deftest hydra-column-basic ()
   (should (equal (eval
   (cadr
(nth 2
@@ -1507,6 +1507,54 @@ o: ok   | s: string
270 272 (face hydra-face-pink)
296 298 (face hydra-face-pink)
 
+;; check column order is the same as they appear in defhydra
+(ert-deftest hydra-column-order ()
+  (should (equal (eval
+  (cadr
+   (nth 2
+(nth 3
+ (macroexpand
+  '(defhydra hydra-window-order
+ (:color red :hint nil :timeout 4)
+ ("z" ace-window "ace" :color blue :column 
"Switch")
+ ("h" windmove-left "← window")
+ ("j" windmove-down "↓ window")
+ ("l" windmove-right "→ window")
+ ("s" split-window-below "split window" :color 
blue :column "Split Management")
+ ("v" split-window-right "split window 
vertically" :color blue)
+ ("d" delete-window "delete current window")
+ ("f" follow-mode "toogle follow mode")
+ ("u" winner-undo "undo window conf" :column 
"Undo/Redo")
+ ("r" winner-redo "redo window conf")
+ ("b" balance-windows "balance window height" 
:column "1-Sizing")
+ ("m" maximize-window "maximize current 
window")
+ ("k" windmove-up "↑ window" :column "Switch")
+ ("M" minimize-window "maximize current 
window" :column "1-Sizing")
+ ("q" nil "quit menu" :color blue :column 
nil)))
+ #("hydra:
+Switch  | Split Management   | Undo/Redo   | 1-Sizing
+--- | -- | --- | 
--
+z: ace  | s: split window| u: undo window conf | b: balance 
window height
+h: ← window | v: split window vertically | r: redo window conf | m: maximize 
current window
+j: ↓ window | d: delete current window   | | M: maximize 
current window
+l: → window | f: toogle follow mode  | |
+k: ↑ window || |
+[q]: quit menu."
+   173 174 (face hydra-face-blue)
+   187 188 (face hydra-face-blue)
+   216 217 (face hydra-face-red)
+   238 239 (face hydra-face-red)
+   263 264 (face hydra-face-red)
+   277 278 (face hydra-face-blue)
+   306 307 (face hydra-face-red)
+   328 329 (face hydra-face-red)
+   355 356 (face hydra-face-red)
+   369 370 (face hydra-face-red)
+   420 421 (face hydra-face-red)
+   447 448 (face hydra-face-red)
+   461 462 (face hydra-face-red)
+   512 513 (face hydra-face-red)
+   578 579 (face hydra-face-blue)
 
 (provide 'hydra-test)
 
diff --git a/hydra.el b/hydra.el
index 79ee6f1..1e28239 100644
--- a/hydra.el
+++ b/hydra.el
@@ -1002,12 +1002,17 @@ was defined."
 heads)))
 
 (defun hydra--sort-heads (normalized-heads)
-  "Return a list of heads with non-nil doc sorted by ascending column property
-each head of NORMALIZED-HEADS must have a column property"
+  "Return a list of heads with non-nil doc grouped by column property.
+Each head of NORMALIZED-HEADS must have a column property."
   (let* ((heads-wo-nil-doc (cl-remove-if-not (lambda (head) (nth 2 head)) 
normalized-heads))
+ (columns-list (delete-dups (mapcar (lambda (head) 
(hydra--head-property head :column))
+normalized-heads)))
+ (get-col-index-fun (lambda (head) (cl-position (hydra--head-property 
head :column)
+columns-list
+   

[elpa] master a07b92a 26/36: lv.el (lv-window): Rename to " *LV*"

2017-07-22 Thread Oleh Krehel
branch: master
commit a07b92a8755dfb064701210b634e2dc4839552ac
Author: Oleh Krehel 
Commit: Oleh Krehel 

lv.el (lv-window): Rename to " *LV*"

No reason to have this buffer visible by default.

Re abo-abo/swiper#666
---
 lv.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lv.el b/lv.el
index 23d2c30..87f7e5e 100644
--- a/lv.el
+++ b/lv.el
@@ -65,9 +65,9 @@ Only the background color is significant."
 (let ((ignore-window-parameters t))
   (split-window
(frame-root-window) -1 'below
-(if (setq buf (get-buffer "*LV*"))
+(if (setq buf (get-buffer " *LV*"))
 (switch-to-buffer buf)
-  (switch-to-buffer "*LV*")
+  (switch-to-buffer " *LV*")
   (set-window-hscroll lv-wnd 0)
   (setq window-size-fixed t)
   (setq mode-line-format nil)



[elpa] master 6d5bdf7 11/36: Introduce (:hint none)

2017-07-22 Thread Oleh Krehel
branch: master
commit 6d5bdf7cb06e05e4b5aa05f7bae887f213ecf10a
Author: Oleh Krehel 
Commit: Oleh Krehel 

Introduce (:hint none)

* hydra-examples.el (hydra-org-agenda-view): New example.

* hydra.el (hydra--format): Revert to the old behavior for (:hint nil).
Turn off the bottom hint completely for (:hint none).

Fixes #190
---
 hydra-examples.el | 35 +++
 hydra.el  |  3 +--
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/hydra-examples.el b/hydra-examples.el
index 9264feb..413c937 100644
--- a/hydra-examples.el
+++ b/hydra-examples.el
@@ -290,6 +290,41 @@ _h_   _l_   _o_k_y_ank
 ;; Recommended binding:
 ;; (global-set-key (kbd "C-x SPC") 'hydra-rectangle/body)
 
+;;** Example 12: org-agenda-view
+(defhydra hydra-org-agenda-view (:hint none)
+  "
+_d_: ?d? day_g_: time grid=?g?  _a_: arch-trees
+_w_: ?w? week   _[_: inactive   _A_: arch-files
+_t_: ?t? fortnight  _f_: follow=?f? _r_: clock report=?r?
+_m_: ?m? month  _e_: entry text=?e? _D_: include diary=?D?
+_y_: ?y? year   _q_: quit   _L__l__c_: log = ?l?"
+  ("SPC" org-agenda-reset-view)
+  ("d" org-agenda-day-view (if (eq 'day (org-agenda-cts)) "[x]" "[ ]"))
+  ("w" org-agenda-week-view (if (eq 'week (org-agenda-cts)) "[x]" "[ ]"))
+  ("t" org-agenda-fortnight-view (if (eq 'fortnight (org-agenda-cts)) "[x]" "[ 
]"))
+  ("m" org-agenda-month-view (if (eq 'month (org-agenda-cts)) "[x]" "[ ]"))
+  ("y" org-agenda-year-view (if (eq 'year (org-agenda-cts)) "[x]" "[ ]"))
+  ("l" org-agenda-log-mode (format "% -3S" org-agenda-show-log))
+  ("L" (org-agenda-log-mode '(4)))
+  ("c" (org-agenda-log-mode 'clockcheck))
+  ("f" org-agenda-follow-mode (format "% -3S" org-agenda-follow-mode))
+  ("a" org-agenda-archives-mode)
+  ("A" (org-agenda-archives-mode 'files))
+  ("r" org-agenda-clockreport-mode (format "% -3S" 
org-agenda-clockreport-mode))
+  ("e" org-agenda-entry-text-mode (format "% -3S" org-agenda-entry-text-mode))
+  ("g" org-agenda-toggle-time-grid (format "% -3S" org-agenda-use-time-grid))
+  ("D" org-agenda-toggle-diary (format "% -3S" org-agenda-include-diary))
+  ("!" org-agenda-toggle-deadlines)
+  ("[" (let ((org-agenda-include-inactive-timestamps t))
+ (org-agenda-check-type t 'timeline 'agenda)
+ (org-agenda-redo)
+ (message "Display now includes inactive timestamps as well")))
+  ("q" (message "Abort") :exit t)
+  ("v" nil))
+
+;; Recommended binding:
+;; (define-key org-agenda-mode-map "v" 'hydra-org-agenda-view/body)
+
 ;;* Helpers
 (require 'windmove)
 
diff --git a/hydra.el b/hydra.el
index 5626a4f..6b07dca 100644
--- a/hydra.el
+++ b/hydra.el
@@ -604,8 +604,7 @@ _NAME, BODY, DOCSTRING and HEADS are parameters of 
`defhydra'.
 The expressions can be auto-expanded according to NAME."
   (setq docstring (hydra--strip-align-markers docstring))
   (setq docstring (replace-regexp-in-string "___" "_β_" docstring))
-  (let ((rest (if (and (null (hydra-plist-get-default (cddr body) :hint 1))
-   (string-match "\\`\n" docstring))
+  (let ((rest (if (eq (plist-get (cddr body) :hint) 'none)
   ""
 (hydra--hint body heads)))
 (start 0)



[elpa] master 200a444 10/36: hydra.el (hydra--hint): Revert return "" for :hint nil

2017-07-22 Thread Oleh Krehel
branch: master
commit 200a1905f9a60b8bc7faaf793981f8363f20
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--hint): Revert return "" for :hint nil

* hydra.el (hydra--format): When body's :hint is nil /and/ the docstring
  starts with a newline, set the output of `hydra--hint' to "".
  This is necessary for the ?x? syntax.

* hydra-test.el (hydra-format-8): Add test.

Fixes #190
---
 hydra-test.el |  10 +
 hydra.el  | 115 +-
 2 files changed, 68 insertions(+), 57 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index a40a0ca..03c20d4 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1137,6 +1137,16 @@ _f_ auto-fill-mode:%`auto-fill-function
  0 2 (face hydra-face-red)))
   ""
 
+(ert-deftest hydra-format-8 ()
+  (should
+   (equal
+(hydra--format nil '(nil nil :hint nil) "test"
+   '(("f" forward-char nil :exit nil)
+ ("b" backward-char "back" :exit nil)))
+'(format
+  #("test: [b]: back."
+7 8 (face hydra-face-red))
+
 (ert-deftest hydra-format-with-sexp-1 ()
   (should (equal
(let ((hydra-fontify-head-function
diff --git a/hydra.el b/hydra.el
index e1dedd2..5626a4f 100644
--- a/hydra.el
+++ b/hydra.el
@@ -470,62 +470,60 @@ Return DEFAULT if PROP is not in H."
 (defun hydra--hint (body heads)
   "Generate a hint for the echo area.
 BODY, and HEADS are parameters to `defhydra'."
-  (if (null (hydra-plist-get-default (cddr body) :hint 1))
-  ""
-(let (alist)
-  (dolist (h heads)
-(let ((val (assoc (cadr h) alist))
-  (pstr (hydra-fontify-head h body)))
-  (unless (null (cl-caddr h))
-(if val
-(setf (cadr val)
-  (concat (cadr val) " " pstr))
-  (push
-   (cons (cadr h)
- (cons pstr (cl-caddr h)))
-   alist)
-  (let ((keys (nreverse (mapcar #'cdr alist)))
-(n-cols (plist-get (cddr body) :columns))
-res)
-(setq res
-  (if n-cols
-  (let ((n-rows (1+ (/ (length keys) n-cols)))
-(max-key-len (apply #'max (mapcar (lambda (x) (length 
(car x))) keys)))
-(max-doc-len (apply #'max (mapcar (lambda (x)
-(length 
(hydra--to-string (cdr x keys
-`(concat
-  "\n"
-  (mapconcat #'identity
- (mapcar
-  (lambda (x)
-(mapconcat
- (lambda (y)
-   (and y
-(funcall hydra-key-doc-function
- (car y)
- ,max-key-len
- (hydra--to-string (cdr y))
- ,max-doc-len))) x ""))
-  ',(hydra--matrix keys n-cols n-rows))
- "\n")))
-
-
-`(concat
-  (mapconcat
-   (lambda (x)
- (let ((str (hydra--to-string (cdr x
-   (format
-(if (> (length str) 0)
-(concat hydra-head-format str)
-  "%s")
-(car x
-   ',keys
-   ", ")
-  ,(if keys "." ""
-(if (cl-every #'stringp
-  (mapcar 'cddr alist))
-(eval res)
-  res)
+  (let (alist)
+(dolist (h heads)
+  (let ((val (assoc (cadr h) alist))
+(pstr (hydra-fontify-head h body)))
+(unless (null (cl-caddr h))
+  (if val
+  (setf (cadr val)
+(concat (cadr val) " " pstr))
+(push
+ (cons (cadr h)
+   (cons pstr (cl-caddr h)))
+ alist)
+(let ((keys (nreverse (mapcar #'cdr alist)))
+  (n-cols (plist-get (cddr body) :columns))
+  res)
+  (setq res
+(if n-cols
+(let ((n-rows (1+ (/ (length keys) n-cols)))
+  (max-key-len (apply #'max (mapcar (lambda (x) (length 
(car x))) keys)))
+  (max-doc-len (apply #'max (mapcar (lambda (x)
+  (length 
(hydra--to-string (cdr x keys
+  `(concat
+"\n"
+(mapconcat #'identity
+   (mapcar
+(lambda (x)
+