[elpa] master e7e8ee2 1/6: ace-window.el: Update comments

2015-04-16 Thread Oleh Krehel
branch: master
commit e7e8ee216a81e7acafa500b08d695817d995dcab
Author: Oleh Krehel 
Commit: Oleh Krehel 

ace-window.el: Update comments
---
 ace-window.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ace-window.el b/ace-window.el
index 5aa389d..3534160 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -26,7 +26,7 @@
 ;;; Commentary:
 ;;
 ;; The main function, `ace-window' is meant to replace `other-window'.
-;; If fact, when there are only two windows present, `other-window' is
+;; In fact, when there are only two windows present, `other-window' is
 ;; called.  If there are more, each window will have its first
 ;; character highlighted.  Pressing that character will switch to that
 ;; window.
@@ -41,7 +41,7 @@
 ;;
 ;;(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
 ;;
-;; This way they're all on the home row, although the intuitive
+;; This way they are all on the home row, although the intuitive
 ;; ordering is lost.
 ;;
 ;; If you don't want the gray background that makes the red selection
@@ -49,6 +49,9 @@
 ;;
 ;;(setq aw-background nil)
 ;;
+;; If you want to know the selection characters ahead of time, you can
+;; turn on `ace-window-display-mode'.
+;;
 ;; When prefixed with one `universal-argument', instead of switching
 ;; to selected window, the selected window is swapped with current one.
 ;;



[elpa] master 64759ec 4/6: avy-jump.el (avi--overlay-offset): Add

2015-04-16 Thread Oleh Krehel
branch: master
commit 64759ec02ea0e02c7ec549be084b17050c990096
Author: Oleh Krehel 
Commit: Oleh Krehel 

avy-jump.el (avi--overlay-offset): Add

* avy-jump.el (avi--overlay-offset): New defvar.
(avi--overlay): Use `avi--overlay-offset'. Bind it for better
flexibility.

For instance, the regex can be "[^ a-z][a-z]+". In that case, it might
be desirable to shift the overlay by one char.
---
 avy-jump.el |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/avy-jump.el b/avy-jump.el
index 9503ee9..50c7fce 100644
--- a/avy-jump.el
+++ b/avy-jump.el
@@ -94,11 +94,15 @@ When PRED is non-nil, it's a filter for matching point 
positions."
 wnd) candidates
   (nreverse candidates
 
+(defvar avi--overlay-offset 0
+  "The offset to apply in `avi--overlay'.")
+
 (defun avi--overlay (str pt wnd)
   "Create an overlay with STR at PT in WND."
-  (let ((ol (make-overlay pt (1+ pt) (window-buffer wnd)))
-(old-str (with-selected-window wnd
-   (buffer-substring pt (1+ pt)
+  (let* ((pt (+ pt avi--overlay-offset))
+ (ol (make-overlay pt (1+ pt) (window-buffer wnd)))
+ (old-str (with-selected-window wnd
+(buffer-substring pt (1+ pt)
 (when avi-background
   (setq old-str (propertize
  old-str 'face 'aw-background-face)))



[elpa] master cf04c93 6/6: Merge commit 'd592e36f33ac7e1fece462c5b7157f330c732630' from ace-window

2015-04-16 Thread Oleh Krehel
branch: master
commit cf04c931cb46d2a38e5ef8357c31df0d53414914
Merge: f0c4778 d592e36
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit 'd592e36f33ac7e1fece462c5b7157f330c732630' from ace-window
---
 packages/ace-window/ace-window.el |   14 ---
 packages/ace-window/avy-jump.el   |   45 ++--
 2 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/packages/ace-window/ace-window.el 
b/packages/ace-window/ace-window.el
index 5aa389d..68e28cf 100644
--- a/packages/ace-window/ace-window.el
+++ b/packages/ace-window/ace-window.el
@@ -26,7 +26,7 @@
 ;;; Commentary:
 ;;
 ;; The main function, `ace-window' is meant to replace `other-window'.
-;; If fact, when there are only two windows present, `other-window' is
+;; In fact, when there are only two windows present, `other-window' is
 ;; called.  If there are more, each window will have its first
 ;; character highlighted.  Pressing that character will switch to that
 ;; window.
@@ -41,7 +41,7 @@
 ;;
 ;;(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
 ;;
-;; This way they're all on the home row, although the intuitive
+;; This way they are all on the home row, although the intuitive
 ;; ordering is lost.
 ;;
 ;; If you don't want the gray background that makes the red selection
@@ -49,6 +49,9 @@
 ;;
 ;;(setq aw-background nil)
 ;;
+;; If you want to know the selection characters ahead of time, you can
+;; turn on `ace-window-display-mode'.
+;;
 ;; When prefixed with one `universal-argument', instead of switching
 ;; to selected window, the selected window is swapped with current one.
 ;;
@@ -168,8 +171,11 @@ LEAF is (PT . WND)."
   (let* ((pt (car leaf))
  (wnd (cdr leaf))
  (ol (make-overlay pt (1+ pt) (window-buffer wnd)))
- (old-str (with-selected-window wnd
-(buffer-substring pt (1+ pt
+ (old-str (or
+   (ignore-errors
+ (with-selected-window wnd
+   (buffer-substring pt (1+ pt
+   ""))
  (new-str
   (concat
(cl-case aw-leading-char-style
diff --git a/packages/ace-window/avy-jump.el b/packages/ace-window/avy-jump.el
index b83f7a8..50c7fce 100644
--- a/packages/ace-window/avy-jump.el
+++ b/packages/ace-window/avy-jump.el
@@ -75,9 +75,10 @@ POS is either a position or (BEG . END)."
   #'aw--remove-leading-chars
 (aw--done)))
 
-(defun avi--regex-candidates (regex &optional wnd beg end)
+(defun avi--regex-candidates (regex &optional wnd beg end pred)
   "Return all elements that match REGEX in WND.
-Each element of the list is ((BEG . END) . WND)."
+Each element of the list is ((BEG . END) . WND)
+When PRED is non-nil, it's a filter for matching point positions."
   (setq wnd (or wnd (selected-window)))
   (let ((we (or end (window-end (selected-window) t)))
 candidates)
@@ -86,16 +87,22 @@ Each element of the list is ((BEG . END) . WND)."
   (save-excursion
 (goto-char (or beg (window-start)))
 (while (re-search-forward regex we t)
-  (push (cons (cons (match-beginning 0)
-(match-end 0))
-  wnd) candidates)))
+  (when (or (null pred)
+(funcall pred))
+(push (cons (cons (match-beginning 0)
+  (match-end 0))
+wnd) candidates
   (nreverse candidates
 
+(defvar avi--overlay-offset 0
+  "The offset to apply in `avi--overlay'.")
+
 (defun avi--overlay (str pt wnd)
   "Create an overlay with STR at PT in WND."
-  (let ((ol (make-overlay pt (1+ pt) (window-buffer wnd)))
-(old-str (with-selected-window wnd
-   (buffer-substring pt (1+ pt)
+  (let* ((pt (+ pt avi--overlay-offset))
+ (ol (make-overlay pt (1+ pt) (window-buffer wnd)))
+ (old-str (with-selected-window wnd
+(buffer-substring pt (1+ pt)
 (when avi-background
   (setq old-str (propertize
  old-str 'face 'aw-background-face)))
@@ -115,6 +122,28 @@ LEAF is ((BEG . END) . WND)."
  (car leaf))
(cdr leaf)))
 
+(defun avi--overlay-at (path leaf)
+  "Create an overlay with STR at LEAF.
+PATH is a list of keys from tree root to LEAF.
+LEAF is ((BEG . END) . WND)."
+  (let ((str (propertize
+  (string (car (last path)))
+  'face 'avi-lead-face))
+(pt (if (consp (car leaf))
+(caar leaf)
+  (car leaf)))
+(wnd (cdr leaf)))
+(let ((ol (make-overlay pt (1+ pt)
+(window-buffer wnd)))
+  (old-str (with-selected-window wnd
+ (buffer-substring pt (1+ pt)
+  (when avi-background
+(setq old-str (propertize
+   old-str 'face 'aw-background-face)))
+  (overlay-put ol 'window wnd)
+  (overlay-put ol 'display str)
+  (push ol aw-o

[elpa] master c581478 3/6: avy-jump.el (avi--overlay-at): New overlay style

2015-04-16 Thread Oleh Krehel
branch: master
commit c581478c2434bcbfb9567a39f16aab2e07be3c59
Author: Oleh Krehel 
Commit: Oleh Krehel 

avy-jump.el (avi--overlay-at): New overlay style
---
 avy-jump.el |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/avy-jump.el b/avy-jump.el
index 7419319..9503ee9 100644
--- a/avy-jump.el
+++ b/avy-jump.el
@@ -118,6 +118,28 @@ LEAF is ((BEG . END) . WND)."
  (car leaf))
(cdr leaf)))
 
+(defun avi--overlay-at (path leaf)
+  "Create an overlay with STR at LEAF.
+PATH is a list of keys from tree root to LEAF.
+LEAF is ((BEG . END) . WND)."
+  (let ((str (propertize
+  (string (car (last path)))
+  'face 'avi-lead-face))
+(pt (if (consp (car leaf))
+(caar leaf)
+  (car leaf)))
+(wnd (cdr leaf)))
+(let ((ol (make-overlay pt (1+ pt)
+(window-buffer wnd)))
+  (old-str (with-selected-window wnd
+ (buffer-substring pt (1+ pt)
+  (when avi-background
+(setq old-str (propertize
+   old-str 'face 'aw-background-face)))
+  (overlay-put ol 'window wnd)
+  (overlay-put ol 'display str)
+  (push ol aw-overlays-lead
+
 (defun avi--overlay-post (path leaf)
   "Create an overlay with STR at LEAF.
 PATH is a list of keys from tree root to LEAF.



[elpa] master updated (f0c4778 -> cf04c93)

2015-04-16 Thread Oleh Krehel
abo_abo pushed a change to branch master.

  from  f0c4778   (csv-mode): Set mode-line-position rather than 
mode-line-format.
   new  e7e8ee2   ace-window.el: Update comments
   new  1273871   avy-jump.el (avi--regex-candidates): Allow for a predicate
   new  c581478   avy-jump.el (avi--overlay-at): New overlay style
   new  64759ec   avy-jump.el (avi--overlay-offset): Add
   new  d592e36   ace-window.el (aw--lead-overlay): Work around 
args-out-of-range
   new  cf04c93   Merge commit 'd592e36f33ac7e1fece462c5b7157f330c732630' 
from ace-window


Summary of changes:
 packages/ace-window/ace-window.el |   14 ---
 packages/ace-window/avy-jump.el   |   45 ++--
 2 files changed, 47 insertions(+), 12 deletions(-)



[elpa] master 1273871 2/6: avy-jump.el (avi--regex-candidates): Allow for a predicate

2015-04-16 Thread Oleh Krehel
branch: master
commit 1273871f444afe6db7f5e4881abd3d3b82653149
Author: Oleh Krehel 
Commit: Oleh Krehel 

avy-jump.el (avi--regex-candidates): Allow for a predicate
---
 avy-jump.el |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/avy-jump.el b/avy-jump.el
index b83f7a8..7419319 100644
--- a/avy-jump.el
+++ b/avy-jump.el
@@ -75,9 +75,10 @@ POS is either a position or (BEG . END)."
   #'aw--remove-leading-chars
 (aw--done)))
 
-(defun avi--regex-candidates (regex &optional wnd beg end)
+(defun avi--regex-candidates (regex &optional wnd beg end pred)
   "Return all elements that match REGEX in WND.
-Each element of the list is ((BEG . END) . WND)."
+Each element of the list is ((BEG . END) . WND)
+When PRED is non-nil, it's a filter for matching point positions."
   (setq wnd (or wnd (selected-window)))
   (let ((we (or end (window-end (selected-window) t)))
 candidates)
@@ -86,9 +87,11 @@ Each element of the list is ((BEG . END) . WND)."
   (save-excursion
 (goto-char (or beg (window-start)))
 (while (re-search-forward regex we t)
-  (push (cons (cons (match-beginning 0)
-(match-end 0))
-  wnd) candidates)))
+  (when (or (null pred)
+(funcall pred))
+(push (cons (cons (match-beginning 0)
+  (match-end 0))
+wnd) candidates
   (nreverse candidates
 
 (defun avi--overlay (str pt wnd)



[elpa] master d592e36 5/6: ace-window.el (aw--lead-overlay): Work around args-out-of-range

2015-04-16 Thread Oleh Krehel
branch: master
commit d592e36f33ac7e1fece462c5b7157f330c732630
Author: Oleh Krehel 
Commit: Oleh Krehel 

ace-window.el (aw--lead-overlay): Work around args-out-of-range

Re #31
---
 ace-window.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ace-window.el b/ace-window.el
index 3534160..68e28cf 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -171,8 +171,11 @@ LEAF is (PT . WND)."
   (let* ((pt (car leaf))
  (wnd (cdr leaf))
  (ol (make-overlay pt (1+ pt) (window-buffer wnd)))
- (old-str (with-selected-window wnd
-(buffer-substring pt (1+ pt
+ (old-str (or
+   (ignore-errors
+ (with-selected-window wnd
+   (buffer-substring pt (1+ pt
+   ""))
  (new-str
   (concat
(cl-case aw-leading-char-style



[elpa] master 0477214 08/19: Fix `ivy-backward-delete-char-function'

2015-04-16 Thread Oleh Krehel
branch: master
commit 04772141473c07172434a1cdb1cef248de518351
Author: Oleh Krehel 
Commit: Oleh Krehel 

Fix `ivy-backward-delete-char-function'

* ivy.el (ivy-on-del-error-function): Rename from
  `ivy-backward-delete-char-function'.
(ivy-backward-delete-char): Don't use eval.
---
 ivy.el |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index c2749c9..b1fd85c 100644
--- a/ivy.el
+++ b/ivy.el
@@ -59,8 +59,9 @@ Set this to nil if you don't want the count."
   "Whether to wrap around after the first and last candidate."
   :type 'boolean)
 
-(defcustom ivy-backward-delete-char-function `(minibuffer-keyboard-quit)
-  "Function called when ivy-backward-delete-char throws an error."
+(defcustom ivy-on-del-error-function 'minibuffer-keyboard-quit
+  "The handler for when `ivy-backward-delete-char' throws.
+This is usually meant as a quick exit out of the minibuffer."
   :type 'function)
 
 ;;* User Visible
@@ -159,12 +160,13 @@ If the input is empty, select the previous history 
element instead."
 
 (defun ivy-backward-delete-char ()
   "Forward to `backward-delete-char'.
-On error (read-only), call ivy-backward-delete-char-function."
+On error (read-only), call `ivy-on-del-error-function'."
   (interactive)
   (condition-case nil
   (backward-delete-char 1)
 (error
- (eval ivy-backward-delete-char-function
+ (when ivy-on-del-error-function
+   (funcall ivy-on-del-error-function)
 
 ;;** Entry Point
 (defun ivy-read (prompt collection



[elpa] master 6dd1068 04/19: swiper.el (swiper-query-replace): Enable recursive minibuffers

2015-04-16 Thread Oleh Krehel
branch: master
commit 6dd10680cee22a959112e285fd2c160f1d46cc1d
Author: Oleh Krehel 
Commit: Oleh Krehel 

swiper.el (swiper-query-replace): Enable recursive minibuffers

* swiper.el (swiper-query-replace): Update.

Fixes #31.
---
 swiper.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/swiper.el b/swiper.el
index cb8e91b..ffb0f4a 100644
--- a/swiper.el
+++ b/swiper.el
@@ -83,7 +83,8 @@
   (interactive)
   (if (null (window-minibuffer-p))
   (user-error "Should only be called in the minibuffer through 
`swiper-map'")
-(let* ((from (ivy--regex ivy-text))
+(let* ((enable-recursive-minibuffers t)
+   (from (ivy--regex ivy-text))
(to (query-replace-read-to from "Query replace" t)))
   (delete-minibuffer-contents)
   (setq ivy--action



[elpa] master e816884 03/19: Default ARG to 1 for arrows

2015-04-16 Thread Oleh Krehel
branch: master
commit e8168847ee08672dd84de7a7c777ab7ca8850688
Author: Oleh Krehel 
Commit: Oleh Krehel 

Default ARG to 1 for arrows

* ivy.el (ivy-next-line): Update.
(ivy-previous-line): Update.
---
 ivy.el |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ivy.el b/ivy.el
index 25b45dd..3e22968 100644
--- a/ivy.el
+++ b/ivy.el
@@ -108,6 +108,7 @@ of `history-length', which see.")
 (defun ivy-next-line (&optional arg)
   "Move cursor vertically down ARG candidates."
   (interactive "p")
+  (setq arg (or arg 1))
   (cl-incf ivy--index arg)
   (when (>= ivy--index (1- ivy--length))
 (if ivy-wrap
@@ -125,6 +126,7 @@ If the input is empty, select the previous history element 
instead."
 (defun ivy-previous-line (&optional arg)
   "Move cursor vertically up ARG candidates."
   (interactive "p")
+  (setq arg (or arg 1))
   (cl-decf ivy--index arg)
   (when (< ivy--index 0)
 (if ivy-wrap



[elpa] master 0d619ea 10/19: counsel.el (couns-clj): Add with-no-warnings

2015-04-16 Thread Oleh Krehel
branch: master
commit 0d619ea71f156e97c534bf96e38590933e0921f3
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (couns-clj): Add with-no-warnings
---
 counsel.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/counsel.el b/counsel.el
index 2456068..9a4cc81 100644
--- a/counsel.el
+++ b/counsel.el
@@ -47,7 +47,8 @@
(lambda (str)
  (mapcar
   #'cl-caddr
-  (cider-sync-request:complete str ":same")
+  (with-no-warnings
+(cider-sync-request:complete str ":same"))
 
 (defun couns-git ()
   "Find file in the current Git repository."



[elpa] master 841d59b 01/19: "C-s" should forward to "C-n" etc

2015-04-16 Thread Oleh Krehel
branch: master
commit 841d59b8aedb42d20b758a04a4236756ba5c9a62
Author: Oleh Krehel 
Commit: Oleh Krehel 

"C-s" should forward to "C-n" etc

* ivy.el (ivy-next-line-or-history): Update.
(ivy-previous-line-or-history): Update.
---
 ivy.el |   10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/ivy.el b/ivy.el
index 180f081..c6ec991 100644
--- a/ivy.el
+++ b/ivy.el
@@ -119,10 +119,7 @@ If the input is empty, select the previous history element 
instead."
   (interactive)
   (when (string= ivy-text "")
 (ivy-previous-history-element 1))
-  (if (>= ivy--index (1- ivy--length))
-  (when ivy-wrap
-(ivy-beginning-of-buffer))
-(cl-incf ivy--index)))
+  (ivy-next-line))
 
 (defun ivy-previous-line ()
   "Select the previous completion candidate."
@@ -138,10 +135,7 @@ If the input is empty, select the previous history element 
instead."
   (interactive)
   (when (string= ivy-text "")
 (ivy-previous-history-element 1))
-  (if (zerop ivy--index)
-  (when ivy-wrap
-(ivy-end-of-buffer))
-(cl-decf ivy--index)))
+  (ivy-previous-line))
 
 (defun ivy-previous-history-element (arg)
   "Forward to `previous-history-element' with ARG."



[elpa] master 49321c0 06/19: Allow duplicate candidates in `ivy-read'

2015-04-16 Thread Oleh Krehel
branch: master
commit 49321c022d4aa3c9fb17f783ab2ee6f02462e4de
Author: Oleh Krehel 
Commit: Oleh Krehel 

Allow duplicate candidates in `ivy-read'

* ivy.el (ivy-completions): Use `eq' instead of `equal' in
  `cl-position'.
---
 ivy.el|6 +++---
 swiper.el |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index 3e22968..2b7af6a 100644
--- a/ivy.el
+++ b/ivy.el
@@ -393,9 +393,9 @@ CANDIDATES is a list of strings."
  idx)
 (setq ivy--length (length cands))
 (when (and tail ivy--old-cands)
-  (while (and tail
-  (null (setq idx (cl-position (pop tail) cands
-   :test #'equal)
+  (while (and tail (null idx))
+;; Compare with eq to handle equal duplicates in cands
+(setq idx (cl-position (pop tail) cands)))
   (setq ivy--index (or idx 0)))
 (setq ivy--old-cands cands)
 (when (>= ivy--index ivy--length)
diff --git a/swiper.el b/swiper.el
index 7a418c9..8a5e811 100644
--- a/swiper.el
+++ b/swiper.el
@@ -137,7 +137,7 @@
(line-beginning-position)
(line-end-position)))
   candidates)
-(zerop (forward-line 1)))
+(forward-line 1))
   (nreverse candidates))
 
 (defvar swiper--opoint 1



[elpa] master 609577e 12/19: Fix invalid package header line

2015-04-16 Thread Oleh Krehel
branch: master
commit 609577ed29e2d8e78b64dd8e4d664958b15ce4ba
Author: Steve Purcell 
Commit: Steve Purcell 

Fix invalid package header line
---
 counsel.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/counsel.el b/counsel.el
index 3814f3c..22884ea 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1,4 +1,4 @@
-;;; consel.el --- Various completion functions using Ivy -*- lexical-binding: 
t -*-
+;;; counsel.el --- Various completion functions using Ivy -*- lexical-binding: 
t -*-
 
 ;; Copyright (C) 2015  Free Software Foundation, Inc.
 



[elpa] master a8a1f65 02/19: Add numeric arguments to arrows

2015-04-16 Thread Oleh Krehel
branch: master
commit a8a1f652de4f2681976a69a57123841f7e590724
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add numeric arguments to arrows

* ivy.el (ivy-next-line): Update.
(ivy-next-line-or-history): Update.
(ivy-previous-line): Update.
(ivy-previous-line-or-history): Update.
(ivy-read): Update doc.
---
 ivy.el |   55 +--
 1 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/ivy.el b/ivy.el
index c6ec991..25b45dd 100644
--- a/ivy.el
+++ b/ivy.el
@@ -105,37 +105,39 @@ of `history-length', which see.")
   (interactive)
   (setq ivy--index (1- ivy--length)))
 
-(defun ivy-next-line ()
-  "Select the next completion candidate."
-  (interactive)
-  (if (>= ivy--index (1- ivy--length))
-  (when ivy-wrap
-(ivy-beginning-of-buffer))
-(cl-incf ivy--index)))
-
-(defun ivy-next-line-or-history ()
-  "Select the next completion candidate.
+(defun ivy-next-line (&optional arg)
+  "Move cursor vertically down ARG candidates."
+  (interactive "p")
+  (cl-incf ivy--index arg)
+  (when (>= ivy--index (1- ivy--length))
+(if ivy-wrap
+(ivy-beginning-of-buffer)
+  (setq ivy--index (1- ivy--length)
+
+(defun ivy-next-line-or-history (&optional arg)
+  "Move cursor vertically down ARG candidates.
 If the input is empty, select the previous history element instead."
-  (interactive)
+  (interactive "p")
   (when (string= ivy-text "")
 (ivy-previous-history-element 1))
-  (ivy-next-line))
+  (ivy-next-line arg))
 
-(defun ivy-previous-line ()
-  "Select the previous completion candidate."
-  (interactive)
-  (if (zerop ivy--index)
-  (when ivy-wrap
-(ivy-end-of-buffer))
-(cl-decf ivy--index)))
-
-(defun ivy-previous-line-or-history ()
-  "Select the previous completion candidate.
+(defun ivy-previous-line (&optional arg)
+  "Move cursor vertically up ARG candidates."
+  (interactive "p")
+  (cl-decf ivy--index arg)
+  (when (< ivy--index 0)
+(if ivy-wrap
+(ivy-end-of-buffer)
+  (setq ivy--index 0
+
+(defun ivy-previous-line-or-history (arg)
+  "Move cursor vertically up ARG candidates.
 If the input is empty, select the previous history element instead."
-  (interactive)
+  (interactive "p")
   (when (string= ivy-text "")
 (ivy-previous-history-element 1))
-  (ivy-previous-line))
+  (ivy-previous-line arg))
 
 (defun ivy-previous-history-element (arg)
   "Forward to `previous-history-element' with ARG."
@@ -166,17 +168,18 @@ On error (read-only), quit without selecting."
 PROMPT is a string to prompt with; normally it ends in a colon
 and a space.  When PROMPT contains %d, it will be updated with
 the current number of matching candidates.
+See also `ivy-count-format'.
 
 COLLECTION is a list of strings.
 
 If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
 
-UPDATE-FN is called each time the current candidate(s) is changed.
+KEYMAP is composed together with `ivy-minibuffer-map'.
 
 If PRESELECT is non-nil select the corresponding candidate out of
 the ones that match INITIAL-INPUT.
 
-KEYMAP is composed together with `ivy-minibuffer-map'."
+UPDATE-FN is called each time the current candidate(s) is changed."
   (cl-case (length collection)
 (0 nil)
 (1 (car collection))



[elpa] master updated (cf04c93 -> 22139ae)

2015-04-16 Thread Oleh Krehel
abo_abo pushed a change to branch master.

  from  cf04c93   Merge commit 'd592e36f33ac7e1fece462c5b7157f330c732630' 
from ace-window
   new  841d59b   "C-s" should forward to "C-n" etc
   new  a8a1f65   Add numeric arguments to arrows
   new  e816884   Default ARG to 1 for arrows
   new  6dd1068   swiper.el (swiper-query-replace): Enable recursive 
minibuffers
   new  6dd560c   swiper.el (swiper-map): Bind "C-l" to recenter
   new  49321c0   Allow duplicate candidates in `ivy-read'
   new  592b692   Add defcustom for ivy-backward-delete-char
   new  0477214   Fix `ivy-backward-delete-char-function'
   new  ba0590f   counsel.el: Update comments
   new  0d619ea   counsel.el (couns-clj): Add with-no-warnings
   new  f72a860   counsel.el: Fixup prefixes
   new  609577e   Fix invalid package header line
   new  048f479   Add four more commands
   new  be452cc   swiper.el (swiper-font-lock-ensure): Exclude 
org-agenda-mode
   new  6a098c6   Add ivy-mode
   new  c59752b   Update sorting order, make sure that perfect match is 
selected
   new  75aa14d   Fix thing-at-point in describe-function and -variable
   new  3b78e0e   swiper.el: Bump version
   new  22139ae   Merge commit '3b78e0e503f4763f8a2d77eeacfc91213ec5532e' 
from swiper


Summary of changes:
 packages/swiper/Makefile   |2 +-
 packages/swiper/counsel.el |  106 ++---
 packages/swiper/ivy.el |  128 ++--
 packages/swiper/swiper.el  |   23 ++---
 4 files changed, 203 insertions(+), 56 deletions(-)



[elpa] master 6dd560c 05/19: swiper.el (swiper-map): Bind "C-l" to recenter

2015-04-16 Thread Oleh Krehel
branch: master
commit 6dd560cd2f79bbaad2e0bb757e195f2c32d2cce7
Author: Oleh Krehel 
Commit: Oleh Krehel 

swiper.el (swiper-map): Bind "C-l" to recenter

* swiper.el (swiper-map): Update.
(swiper-recenter-top-bottom): New defun.
(swiper--update-input-ivy): Use `<=' in order for `recenter-top-bottom'
to work.
---
 swiper.el |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/swiper.el b/swiper.el
index ffb0f4a..7a418c9 100644
--- a/swiper.el
+++ b/swiper.el
@@ -75,6 +75,7 @@
 (defvar swiper-map
   (let ((map (make-sparse-keymap)))
 (define-key map (kbd "M-q") 'swiper-query-replace)
+(define-key map (kbd "C-l") 'swiper-recenter-top-bottom)
 map)
   "Keymap for swiper.")
 
@@ -94,6 +95,12 @@
   (swiper--cleanup)
   (exit-minibuffer
 
+(defun swiper-recenter-top-bottom (&optional arg)
+  "Call (`recenter-top-bottom' ARG) in `swiper--window'."
+  (interactive "P")
+  (with-selected-window swiper--window
+(recenter-top-bottom arg)))
+
 (defvar swiper--window nil
   "Store the current window.")
 
@@ -222,8 +229,8 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
 (forward-line (1- num))
 (isearch-range-invisible (line-beginning-position)
  (line-end-position))
-(unless (and (> (point) (window-start))
- (< (point) (window-end swiper--window t)))
+(unless (and (>= (point) (window-start))
+ (<= (point) (window-end swiper--window t)))
   (recenter)))
   (let ((ov (make-overlay
  (line-beginning-position)



[elpa] master ba0590f 09/19: counsel.el: Update comments

2015-04-16 Thread Oleh Krehel
branch: master
commit ba0590f4ef73c9f69a56c160c1c927a9773f2435
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el: Update comments
---
 counsel.el |   12 +---
 swiper.el  |2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/counsel.el b/counsel.el
index 28d10bd..2456068 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1,8 +1,12 @@
-;;; consel.el --- Elisp completion at point -*- lexical-binding: t -*-
+;;; consel.el --- Various completion functions using Ivy -*- lexical-binding: 
t -*-
 
 ;; Copyright (C) 2015  Free Software Foundation, Inc.
 
 ;; Author: Oleh Krehel 
+;; URL: https://github.com/abo-abo/swiper
+;; Version: 0.1.0
+;; Package-Requires: ((emacs "24.1") (ivy "0.2.0"))
+;; Keywords: completion, matching
 
 ;; This file is part of GNU Emacs.
 
@@ -21,8 +25,10 @@
 
 ;;; Commentary:
 ;;
-;; Just call `counsel' to start completing the `obarray'.
-;; The initial (optional) input is thing-at-point.
+;; Just call one of the interactive functions in this file to complete
+;; the corresponding thing using `ivy'.
+;;
+;; Currently available: Elisp symbols, Clojure symbols, Git files.
 
 ;;; Code:
 
diff --git a/swiper.el b/swiper.el
index 8a5e811..0c4aafb 100644
--- a/swiper.el
+++ b/swiper.el
@@ -5,7 +5,7 @@
 ;; Author: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/swiper
 ;; Version: 0.2.0
-;; Package-Requires: ((emacs "24.1") (ivy "0.1.0"))
+;; Package-Requires: ((emacs "24.1") (ivy "0.2.0"))
 ;; Keywords: matching
 
 ;; This file is part of GNU Emacs.



[elpa] master be452cc 14/19: swiper.el (swiper-font-lock-ensure): Exclude org-agenda-mode

2015-04-16 Thread Oleh Krehel
branch: master
commit be452ccb5c05c29d79630bc4e1da8457fc17178c
Author: Oleh Krehel 
Commit: Oleh Krehel 

swiper.el (swiper-font-lock-ensure): Exclude org-agenda-mode

Re #19
---
 swiper.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/swiper.el b/swiper.el
index 0c4aafb..36a2223 100644
--- a/swiper.el
+++ b/swiper.el
@@ -111,7 +111,8 @@
  gnus-summary-mode
  gnus-article-mode
  gnus-group-mode
- emms-playlist-mode erc-mode)))
+ emms-playlist-mode erc-mode
+ org-agenda-mode)))
 (if (fboundp 'font-lock-ensure)
 (font-lock-ensure)
   (font-lock-fontify-buffer



[elpa] master 592b692 07/19: Add defcustom for ivy-backward-delete-char

2015-04-16 Thread Oleh Krehel
branch: master
commit 592b692b61e320a13621961d60765899d2ccbe15
Author: Kevin 
Commit: Kevin 

Add defcustom for ivy-backward-delete-char
---
 ivy.el |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 2b7af6a..c2749c9 100644
--- a/ivy.el
+++ b/ivy.el
@@ -59,6 +59,10 @@ Set this to nil if you don't want the count."
   "Whether to wrap around after the first and last candidate."
   :type 'boolean)
 
+(defcustom ivy-backward-delete-char-function `(minibuffer-keyboard-quit)
+  "Function called when ivy-backward-delete-char throws an error."
+  :type 'function)
+
 ;;* User Visible
 ;;** Keymap
 (require 'delsel)
@@ -155,12 +159,12 @@ If the input is empty, select the previous history 
element instead."
 
 (defun ivy-backward-delete-char ()
   "Forward to `backward-delete-char'.
-On error (read-only), quit without selecting."
+On error (read-only), call ivy-backward-delete-char-function."
   (interactive)
   (condition-case nil
   (backward-delete-char 1)
 (error
- (minibuffer-keyboard-quit
+ (eval ivy-backward-delete-char-function
 
 ;;** Entry Point
 (defun ivy-read (prompt collection



[elpa] master c59752b 16/19: Update sorting order, make sure that perfect match is selected

2015-04-16 Thread Oleh Krehel
branch: master
commit c59752b67ef952feb17b2fa2fcb520a53e8fde84
Author: Oleh Krehel 
Commit: Oleh Krehel 

Update sorting order, make sure that perfect match is selected

ivy.el (ivy-completions): Update.

When the regex matches perfectly, select it.
---
 ivy.el |   15 +--
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/ivy.el b/ivy.el
index 3ac5931..0bb58fe 100644
--- a/ivy.el
+++ b/ivy.el
@@ -265,6 +265,7 @@ Turning on Ivy mode will set `completing-read-function' to
 `ivy-completing-read'."
   :group 'ivy
   :global t
+  :lighter " ivy"
   (if ivy-mode
   (setq completing-read-function 'ivy-completing-read)
 (setq completing-read-function 'completing-read-default)))
@@ -427,7 +428,6 @@ CANDIDATES is a list of strings."
  (cands (if (and (equal re ivy--old-re)
  ivy--old-cands)
 ivy--old-cands
-  (setq ivy--old-re re)
   (ignore-errors
 (cl-remove-if-not
  (lambda (x) (string-match re x))
@@ -435,12 +435,15 @@ CANDIDATES is a list of strings."
  (tail (nthcdr ivy--index ivy--old-cands))
  (ww (window-width))
  idx)
-(setq ivy--length (length cands))
 (when (and tail ivy--old-cands)
-  (while (and tail (null idx))
-;; Compare with eq to handle equal duplicates in cands
-(setq idx (cl-position (pop tail) cands)))
-  (setq ivy--index (or idx 0)))
+  (unless (and (not (equal re ivy--old-re))
+   (setq ivy--index (cl-position re cands :test 'equal)))
+(while (and tail (null idx))
+  ;; Compare with eq to handle equal duplicates in cands
+  (setq idx (cl-position (pop tail) cands)))
+(setq ivy--index (or idx 0
+(setq ivy--old-re re)
+(setq ivy--length (length cands))
 (setq ivy--old-cands cands)
 (when (>= ivy--index ivy--length)
   (setq ivy--index (max (1- ivy--length) 0)))



[elpa] master 3b78e0e 18/19: swiper.el: Bump version

2015-04-16 Thread Oleh Krehel
branch: master
commit 3b78e0e503f4763f8a2d77eeacfc91213ec5532e
Author: Oleh Krehel 
Commit: Oleh Krehel 

swiper.el: Bump version
---
 counsel.el |2 +-
 ivy.el |2 +-
 swiper.el  |4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/counsel.el b/counsel.el
index 4c720f2..fc62ade 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5,7 +5,7 @@
 ;; Author: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/swiper
 ;; Version: 0.1.0
-;; Package-Requires: ((emacs "24.1") (ivy "0.2.0"))
+;; Package-Requires: ((emacs "24.1") (ivy "0.2.1"))
 ;; Keywords: completion, matching
 
 ;; This file is part of GNU Emacs.
diff --git a/ivy.el b/ivy.el
index 0bb58fe..38a8ff4 100644
--- a/ivy.el
+++ b/ivy.el
@@ -4,7 +4,7 @@
 
 ;; Author: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.2.0
+;; Version: 0.2.1
 ;; Package-Requires: ((emacs "24.1"))
 ;; Keywords: matching
 
diff --git a/swiper.el b/swiper.el
index 36a2223..a3143f7 100644
--- a/swiper.el
+++ b/swiper.el
@@ -4,8 +4,8 @@
 
 ;; Author: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.2.0
-;; Package-Requires: ((emacs "24.1") (ivy "0.2.0"))
+;; Version: 0.2.1
+;; Package-Requires: ((emacs "24.1") (ivy "0.2.1"))
 ;; Keywords: matching
 
 ;; This file is part of GNU Emacs.



[elpa] master 75aa14d 17/19: Fix thing-at-point in describe-function and -variable

2015-04-16 Thread Oleh Krehel
branch: master
commit 75aa14d736de018875bc7f859c019f01286021ef
Author: Oleh Krehel 
Commit: Oleh Krehel 

Fix thing-at-point in describe-function and -variable

* counsel.el (counsel-describe-variable): Update.
(counsel-describe-function): Update.
---
 counsel.el |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/counsel.el b/counsel.el
index 24e9d6d..4c720f2 100644
--- a/counsel.el
+++ b/counsel.el
@@ -45,6 +45,7 @@
   (interactive
(let ((v (variable-at-point))
  (enable-recursive-minibuffers t)
+ (preselect (thing-at-point 'symbol))
  val)
  (setq val (ivy-read
 (if (symbolp v)
@@ -57,7 +58,8 @@
  (when (or (get vv 'variable-documentation)
(and (boundp vv) (not (keywordp vv
(push (symbol-name vv) cands
-  cands)))
+  cands)
+nil nil preselect))
  (list (if (equal val "")
v
  (intern val)
@@ -68,6 +70,7 @@
   (interactive
(let ((fn (function-called-at-point))
  (enable-recursive-minibuffers t)
+ (preselect (thing-at-point 'symbol))
  val)
  (setq val (ivy-read (if fn
  (format "Describe function (default %s): " fn)
@@ -77,7 +80,8 @@
 (lambda (x)
   (when (fboundp x)
 (push (symbol-name x) cands
-   cands)))
+   cands)
+ nil nil preselect))
  (list (if (equal val "")
fn (intern val)
   (describe-function function))



[elpa] master 048f479 13/19: Add four more commands

2015-04-16 Thread Oleh Krehel
branch: master
commit 048f4794bf1798ec5391bef6c89457303dbc6692
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add four more commands

* counsel.el (counsel-describe-variable): New defun.
(counsel-describe-function): New defun.
(counsel-info-lookup-symbol): New defun.
(counsel-unicode-char): New defun.

* Makefile: Compile counsel.el as well.
---
 Makefile   |2 +-
 counsel.el |   81 
 2 files changed, 82 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 453f709..7c9910e 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ test:
$(emacs) -batch $(LOAD) -l ivy-test.el -f ert-run-tests-batch-and-exit
 
 compile:
-   $(emacs) -batch $(LOAD) --eval "(mapc #'byte-compile-file '(\"ivy.el\" 
\"swiper.el\"))"
+   $(emacs) -batch $(LOAD) --eval "(mapc #'byte-compile-file '(\"ivy.el\" 
\"swiper.el\" \"counsel.el\"))"
 
 clean:
rm -f *.elc
diff --git a/counsel.el b/counsel.el
index 22884ea..24e9d6d 100644
--- a/counsel.el
+++ b/counsel.el
@@ -40,6 +40,87 @@
   (counsel--generic
(lambda (str) (all-completions str obarray
 
+(defun counsel-describe-variable (variable &optional buffer frame)
+  "Forward to (`describe-variable' VARIABLE BUFFER FRAME)."
+  (interactive
+   (let ((v (variable-at-point))
+ (enable-recursive-minibuffers t)
+ val)
+ (setq val (ivy-read
+(if (symbolp v)
+(format
+ "Describe variable (default %s): " v)
+  "Describe variable: ")
+(let (cands)
+  (mapatoms
+   (lambda (vv)
+ (when (or (get vv 'variable-documentation)
+   (and (boundp vv) (not (keywordp vv
+   (push (symbol-name vv) cands
+  cands)))
+ (list (if (equal val "")
+   v
+ (intern val)
+  (describe-variable variable buffer frame))
+
+(defun counsel-describe-function (function)
+  "Forward to (`describe-function' FUNCTION) with ivy completion."
+  (interactive
+   (let ((fn (function-called-at-point))
+ (enable-recursive-minibuffers t)
+ val)
+ (setq val (ivy-read (if fn
+ (format "Describe function (default %s): " fn)
+   "Describe function: ")
+ (let (cands)
+   (mapatoms
+(lambda (x)
+  (when (fboundp x)
+(push (symbol-name x) cands
+   cands)))
+ (list (if (equal val "")
+   fn (intern val)
+  (describe-function function))
+
+(defvar info-lookup-mode)
+(declare-function info-lookup->completions "info-look")
+(declare-function info-lookup->mode-value "info-look")
+(declare-function info-lookup-select-mode "info-look")
+(declare-function info-lookup-change-mode "info-look")
+(declare-function info-lookup "info-look")
+
+(defun counsel-info-lookup-symbol (symbol &optional mode)
+  "Forward to (`info-describe-symbol' SYMBOL MODE) with ivy completion."
+  (interactive
+   (progn
+ (require 'info-look)
+ (let* ((topic 'symbol)
+(mode (cond (current-prefix-arg
+ (info-lookup-change-mode topic))
+((info-lookup->mode-value
+  topic (info-lookup-select-mode))
+ info-lookup-mode)
+((info-lookup-change-mode topic
+(completions (info-lookup->completions topic mode))
+(enable-recursive-minibuffers t)
+(value (ivy-read
+"Describe symbol: "
+(mapcar #'car completions
+   (list value info-lookup-mode
+  (info-lookup 'symbol symbol mode))
+
+(defun counsel-unicode-char ()
+  "Insert a Unicode character at point."
+  (interactive)
+  (let* ((minibuffer-allow-text-properties t)
+ (char (ivy-read "Unicode name: "
+ (mapcar (lambda (x)
+   (propertize
+(format "% -60s%c" (car x) (cdr x))
+'result (cdr x)))
+ (ucs-names)
+(insert-char (get-text-property 0 'result char
+
 (defun counsel-clj ()
   "Clojure completion at point."
   (interactive)



[elpa] master 22139ae 19/19: Merge commit '3b78e0e503f4763f8a2d77eeacfc91213ec5532e' from swiper

2015-04-16 Thread Oleh Krehel
branch: master
commit 22139aea022e817c98de331919bbe60cbca54f52
Merge: cf04c93 3b78e0e
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit '3b78e0e503f4763f8a2d77eeacfc91213ec5532e' from swiper
---
 packages/swiper/Makefile   |2 +-
 packages/swiper/counsel.el |  106 ++---
 packages/swiper/ivy.el |  128 ++--
 packages/swiper/swiper.el  |   23 ++---
 4 files changed, 203 insertions(+), 56 deletions(-)

diff --git a/packages/swiper/Makefile b/packages/swiper/Makefile
index 453f709..7c9910e 100644
--- a/packages/swiper/Makefile
+++ b/packages/swiper/Makefile
@@ -10,7 +10,7 @@ test:
$(emacs) -batch $(LOAD) -l ivy-test.el -f ert-run-tests-batch-and-exit
 
 compile:
-   $(emacs) -batch $(LOAD) --eval "(mapc #'byte-compile-file '(\"ivy.el\" 
\"swiper.el\"))"
+   $(emacs) -batch $(LOAD) --eval "(mapc #'byte-compile-file '(\"ivy.el\" 
\"swiper.el\" \"counsel.el\"))"
 
 clean:
rm -f *.elc
diff --git a/packages/swiper/counsel.el b/packages/swiper/counsel.el
index 28d10bd..fc62ade 100644
--- a/packages/swiper/counsel.el
+++ b/packages/swiper/counsel.el
@@ -1,8 +1,12 @@
-;;; consel.el --- Elisp completion at point -*- lexical-binding: t -*-
+;;; counsel.el --- Various completion functions using Ivy -*- lexical-binding: 
t -*-
 
 ;; Copyright (C) 2015  Free Software Foundation, Inc.
 
 ;; Author: Oleh Krehel 
+;; URL: https://github.com/abo-abo/swiper
+;; Version: 0.1.0
+;; Package-Requires: ((emacs "24.1") (ivy "0.2.1"))
+;; Keywords: completion, matching
 
 ;; This file is part of GNU Emacs.
 
@@ -21,29 +25,117 @@
 
 ;;; Commentary:
 ;;
-;; Just call `counsel' to start completing the `obarray'.
-;; The initial (optional) input is thing-at-point.
+;; Just call one of the interactive functions in this file to complete
+;; the corresponding thing using `ivy'.
+;;
+;; Currently available: Elisp symbols, Clojure symbols, Git files.
 
 ;;; Code:
 
 (require 'ivy)
 
-(defun counsel ()
+(defun counsel-el ()
   "Elisp completion at point."
   (interactive)
   (counsel--generic
(lambda (str) (all-completions str obarray
 
-(defun couns-clj ()
+(defun counsel-describe-variable (variable &optional buffer frame)
+  "Forward to (`describe-variable' VARIABLE BUFFER FRAME)."
+  (interactive
+   (let ((v (variable-at-point))
+ (enable-recursive-minibuffers t)
+ (preselect (thing-at-point 'symbol))
+ val)
+ (setq val (ivy-read
+(if (symbolp v)
+(format
+ "Describe variable (default %s): " v)
+  "Describe variable: ")
+(let (cands)
+  (mapatoms
+   (lambda (vv)
+ (when (or (get vv 'variable-documentation)
+   (and (boundp vv) (not (keywordp vv
+   (push (symbol-name vv) cands
+  cands)
+nil nil preselect))
+ (list (if (equal val "")
+   v
+ (intern val)
+  (describe-variable variable buffer frame))
+
+(defun counsel-describe-function (function)
+  "Forward to (`describe-function' FUNCTION) with ivy completion."
+  (interactive
+   (let ((fn (function-called-at-point))
+ (enable-recursive-minibuffers t)
+ (preselect (thing-at-point 'symbol))
+ val)
+ (setq val (ivy-read (if fn
+ (format "Describe function (default %s): " fn)
+   "Describe function: ")
+ (let (cands)
+   (mapatoms
+(lambda (x)
+  (when (fboundp x)
+(push (symbol-name x) cands
+   cands)
+ nil nil preselect))
+ (list (if (equal val "")
+   fn (intern val)
+  (describe-function function))
+
+(defvar info-lookup-mode)
+(declare-function info-lookup->completions "info-look")
+(declare-function info-lookup->mode-value "info-look")
+(declare-function info-lookup-select-mode "info-look")
+(declare-function info-lookup-change-mode "info-look")
+(declare-function info-lookup "info-look")
+
+(defun counsel-info-lookup-symbol (symbol &optional mode)
+  "Forward to (`info-describe-symbol' SYMBOL MODE) with ivy completion."
+  (interactive
+   (progn
+ (require 'info-look)
+ (let* ((topic 'symbol)
+(mode (cond (current-prefix-arg
+ (info-lookup-change-mode topic))
+((info-lookup->mode-value
+  topic (info-lookup-select-mode))
+ info-lookup-mode)
+((info-lookup-change-mode topic
+(completions (info-lookup->completions topic mode))
+(enable-recursive-minibuffers t)
+(value (ivy-read
+"Describe symbol: "
+ 

[elpa] master f72a860 11/19: counsel.el: Fixup prefixes

2015-04-16 Thread Oleh Krehel
branch: master
commit f72a86089f3dfc5bd9d276a1fc176a3c03666fc4
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el: Fixup prefixes
---
 counsel.el |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index 9a4cc81..3814f3c 100644
--- a/counsel.el
+++ b/counsel.el
@@ -34,13 +34,13 @@
 
 (require 'ivy)
 
-(defun counsel ()
+(defun counsel-el ()
   "Elisp completion at point."
   (interactive)
   (counsel--generic
(lambda (str) (all-completions str obarray
 
-(defun couns-clj ()
+(defun counsel-clj ()
   "Clojure completion at point."
   (interactive)
   (counsel--generic
@@ -50,7 +50,7 @@
   (with-no-warnings
 (cider-sync-request:complete str ":same"))
 
-(defun couns-git ()
+(defun counsel-git ()
   "Find file in the current Git repository."
   (interactive)
   (let* ((default-directory (locate-dominating-file



[elpa] master 6a098c6 15/19: Add ivy-mode

2015-04-16 Thread Oleh Krehel
branch: master
commit 6a098c66a915a26d59bb87e34678094c5ceac18c
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add ivy-mode

* ivy.el (ivy-completing-read): New defun.
(ivy-mode): New global minor mode.
---
 ivy.el |   38 ++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/ivy.el b/ivy.el
index b1fd85c..3ac5931 100644
--- a/ivy.el
+++ b/ivy.el
@@ -231,6 +231,44 @@ UPDATE-FN is called each time the current candidate(s) is 
changed."
(when ivy--action
  (funcall ivy--action))
 
+(defun ivy-completing-read (prompt collection
+&optional predicate _require-match initial-input
+&rest _ignore)
+  "Read a string in the minibuffer, with completion.
+
+This is an interface that conforms to `completing-read', so that
+it can be used for `completing-read-function'.
+
+PROMPT is a string to prompt with; normally it ends in a colon and a space.
+COLLECTION can be a list of strings, an alist, an obarray or a hash table.
+PREDICATE limits completion to a subset of COLLECTION.
+
+_REQUIRE-MATCH is ignored for now.
+INITIAL-INPUT is a string that can be inserted into the minibuffer initially.
+
+The history, defaults and input-method arguments are ignored for now."
+  (cond ((functionp collection)
+ (error "Function as a collection unsupported"))
+((hash-table-p collection)
+ (error "Hash table as a collection unsupported"))
+((listp (car collection))
+ (setq collection (mapcar #'car collection
+  (when predicate
+(setq collection (cl-remove-if-not predicate collection)))
+  (ivy-read prompt collection initial-input))
+
+;;;###autoload
+(define-minor-mode ivy-mode
+"Toggle Ivy mode on or off.
+With ARG, turn Ivy mode on if arg is positive, off otherwise.
+Turning on Ivy mode will set `completing-read-function' to
+`ivy-completing-read'."
+  :group 'ivy
+  :global t
+  (if ivy-mode
+  (setq completing-read-function 'ivy-completing-read)
+(setq completing-read-function 'completing-read-default)))
+
 (defvar ivy--action nil
   "Store a function to call at the end of `ivy--read'.")
 



[elpa] master d0cc1c5 01/45: Define a keymap var for each hydra and re-use it

2015-04-16 Thread Oleh Krehel
branch: master
commit d0cc1c5f5b3bfdf1b92e359d8ca6259345c1db0d
Author: Oleh Krehel 
Commit: Oleh Krehel 

Define a keymap var for each hydra and re-use it

* hydra.el (hydra--make-defun): It will receive not the keymap, but the
  variable that hold the keymap.
(defhydra): Define keymap as a variable.

* hydra-test.el (hydra-red-error): Update test.
(hydra-blue-toggle): Update test.
(hydra-amaranth-vi): Update test.
(hydra-zoom-duplicate-1): Update test.
(hydra-zoom-duplicate-2): Update test.
---
 hydra-test.el |  620 ++---
 hydra.el  |   17 +-
 2 files changed, 207 insertions(+), 430 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 155c047..9fc4ad0 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -37,6 +37,37 @@
("k" previous-error "prev")
("SPC" hydra-repeat "rep" :bind nil)))
 '(progn
+  (defvar hydra-error/keymap
+(quote (keymap (7 . hydra-keyboard-quit)
+   (32 . hydra-repeat)
+   (107 . hydra-error/previous-error)
+   (106 . hydra-error/next-error)
+   (104 . hydra-error/first-error)
+   (switch-frame . hydra--handle-switch-frame)
+   (kp-subtract . hydra--negative-argument)
+   (kp-9 . hydra--digit-argument)
+   (kp-8 . hydra--digit-argument)
+   (kp-7 . hydra--digit-argument)
+   (kp-6 . hydra--digit-argument)
+   (kp-5 . hydra--digit-argument)
+   (kp-4 . hydra--digit-argument)
+   (kp-3 . hydra--digit-argument)
+   (kp-2 . hydra--digit-argument)
+   (kp-1 . hydra--digit-argument)
+   (kp-0 . hydra--digit-argument)
+   (57 . hydra--digit-argument)
+   (56 . hydra--digit-argument)
+   (55 . hydra--digit-argument)
+   (54 . hydra--digit-argument)
+   (53 . hydra--digit-argument)
+   (52 . hydra--digit-argument)
+   (51 . hydra--digit-argument)
+   (50 . hydra--digit-argument)
+   (49 . hydra--digit-argument)
+   (48 . hydra--digit-argument)
+   (45 . hydra--negative-argument)
+   (21 . hydra--universal-argument)))
+"Keymap for hydra-error.")
   (defun hydra-error/first-error nil "Create a hydra with a \"M-g\" body 
and the heads:
 
 \"h\":`first-error',
@@ -51,45 +82,13 @@ Call the head: `first-error'."
  (hydra-default-pre)
  (hydra-disable)
  (catch (quote hydra-disable)
-   (condition-case err (prog1 t (call-interactively (function 
first-error)))
+   (condition-case err (call-interactively (function first-error))
  ((quit error)
   (message "%S" err)
-  (unless hydra-lv (sit-for 0.8))
-  nil))
+  (unless hydra-lv (sit-for 0.8
(when hydra-is-helpful (hydra-error/hint))
-   (setq hydra-last
- (hydra-set-transient-map
-  (setq hydra-curr-map
-(quote (keymap (7 . hydra-keyboard-quit)
-   (32 . hydra-repeat)
-   (107 . hydra-error/previous-error)
-   (106 . hydra-error/next-error)
-   (104 . hydra-error/first-error)
-   (switch-frame . 
hydra--handle-switch-frame)
-   (kp-subtract . 
hydra--negative-argument)
-   (kp-9 . hydra--digit-argument)
-   (kp-8 . hydra--digit-argument)
-   (kp-7 . hydra--digit-argument)
-   (kp-6 . hydra--digit-argument)
-   (kp-5 . hydra--digit-argument)
-   (kp-4 . hydra--digit-argument)
-   (kp-3 . hydra--digit-argument)
-   (kp-2 . hydra--digit-argument)
-   (kp-1 . hydra--digit-argument)
-   (kp-0 . hydra--digit-argument)
-   (57 . hydra--digit-argument)
-   (56 . hydra--digit-argument)
-   (55 . hydra--digit-argument)
-   (54 . hydra--digit-

[elpa] master e7aaafb 07/45: hydra.el (hydra-pink-fallback): Allow prefix arguments

2015-04-16 Thread Oleh Krehel
branch: master
commit e7aaafbdbc870388043c391dc8dc52a62dd1c1e2
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-pink-fallback): Allow prefix arguments

* hydra.el (hydra-pink-fallback): Update.

Fixes #93
---
 hydra.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hydra.el b/hydra.el
index 60e1e65..2c06c66 100644
--- a/hydra.el
+++ b/hydra.el
@@ -623,7 +623,7 @@ OTHER-POST is an optional extension to the :post key of 
BODY."
 
 (defun hydra-pink-fallback ()
   "On intercepting a non-head, try to run it."
-  (let ((keys (this-command-keys))
+  (let ((keys (this-single-command-keys))
 kb)
 (when (equal keys [backspace])
   (setq keys ""))



[elpa] master 3fce2bd 12/45: Try to re-encode the input in the terminal

2015-04-16 Thread Oleh Krehel
branch: master
commit 3fce2bd1cde60017ddce529f353151a51a2106b4
Author: Oleh Krehel 
Commit: Oleh Krehel 

Try to re-encode the input in the terminal

* hydra.el (hydra--handle-nonhead): Update. Most interesting sequences
  start with [27 91] or [27 79]. It's hard to do it for all of them.

Re #90
---
 hydra.el |   19 +++
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/hydra.el b/hydra.el
index c817a3f..1cac1f5 100644
--- a/hydra.el
+++ b/hydra.el
@@ -682,10 +682,21 @@ NAME, BODY and HEADS are parameters to `defhydra'."
  `(lambda ()
 (interactive)
 ,(cond
-  ((memq body-color '(amaranth teal))
-   '(message "An amaranth Hydra can only exit through 
a blue head"))
-  (t
-   '(hydra-pink-fallback)))
+   ((memq body-color '(amaranth teal))
+'(let ((k (or (lookup-key
+   input-decode-map
+   (vconcat [27 91]
+
(this-command-keys-vector)))
+  (lookup-key
+   input-decode-map
+   (vconcat [27 79]
+
(this-command-keys-vector)
+   f)
+  (if (and k (setq f (lookup-key test/keymap k)))
+  (funcall f)
+(message "An amaranth Hydra can only exit 
through a blue head"
+   (t
+'(hydra-pink-fallback)))
 (hydra-set-transient-map hydra-curr-map t)
 (when hydra-is-helpful
   (unless hydra-lv



[elpa] master 1a54e09 05/45: hydra.el (hydra--make-funcall): Update location

2015-04-16 Thread Oleh Krehel
branch: master
commit 1a54e09bce6dee649222a1808e57deda046f3f3f
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--make-funcall): Update location

Fixes #99
---
 hydra.el |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hydra.el b/hydra.el
index 91a154e..f6c83a1 100644
--- a/hydra.el
+++ b/hydra.el
@@ -659,6 +659,11 @@ OTHER-POST is an optional extension to the :post key of 
BODY."
   (recur (cdr map)))
 (recur keymap)))
 
+(defmacro hydra--make-funcall (sym)
+  "Transform SYM into a `funcall' that calls it."
+  `(when (and ,sym (symbolp ,sym))
+ (setq ,sym `(funcall #',,sym
+
 (defun hydra--handle-nonhead (keymap name body heads)
   "Setup KEYMAP for intercepting non-head bindings.
 NAME, BODY and HEADS are parameters to `defhydra'."
@@ -985,11 +990,6 @@ result of `defhydra'."
(or body-body-pre body-pre) body-post
'(setq prefix-arg current-prefix-arg))
 
-(defmacro hydra--make-funcall (sym)
-  "Transform SYM into a `funcall' that calls it."
-  `(when (and ,sym (symbolp ,sym))
- (setq ,sym `(funcall #',,sym
-
 (defmacro defhydradio (name _body &rest heads)
   "Create radios with prefix NAME.
 _BODY specifies the options; there are none currently.



[elpa] master f9bf8fe 08/45: hydra.el (hydra-set-transient-map): Update

2015-04-16 Thread Oleh Krehel
branch: master
commit f9bf8feeb0e139e13bdb9d9722201c9a3879cef7
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra-set-transient-map): Update

A quick fix for the recursion issue in Emacs 25.

I'll have to see at some point why the recursion was happening.

Fixes #101
---
 hydra.el |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/hydra.el b/hydra.el
index 2c06c66..da7f58e 100644
--- a/hydra.el
+++ b/hydra.el
@@ -79,12 +79,11 @@
 (require 'cl-lib)
 (require 'lv)
 
-(defalias 'hydra-set-transient-map
-(if (fboundp 'set-transient-map)
-'set-transient-map
-  (lambda (map _keep-pred &optional on-exit)
-(with-no-warnings
-  (set-temporary-overlay-map map (hydra--pred on-exit))
+(defun hydra-set-transient-map (map _keep-pred &optional on-exit)
+  (if (fboundp 'set-transient-map)
+  (set-transient-map map (hydra--pred on-exit))
+(with-no-warnings
+  (set-temporary-overlay-map map (hydra--pred on-exit)
 
 (defun hydra--pred (on-exit)
   "Generate a predicate on whether to continue the Hydra state.



[elpa] master 5379642 06/45: Use `hydra-keyboard-quit' instead of `hydra-cleanup'

2015-04-16 Thread Oleh Krehel
branch: master
commit 5379642fb311ebf262e56173f4318e4e6f86ee4c
Author: Oleh Krehel 
Commit: Oleh Krehel 

Use `hydra-keyboard-quit' instead of `hydra-cleanup'

* hydra.el (hydra--pred): Update.
(hydra--make-defun): Update.
(hydra-cleanup): Remove.
(hydra-keyboard-quit): Absorb `hydra-cleanup'.

* hydra-test.el (hydra-red-error): Update test.
(hydra-blue-toggle): Update test.
(hydra-amaranth-vi): Update test.
(hydra-zoom-duplicate-1): Update test.
(hydra-zoom-duplicate-2): Update test.

Fixes #100
---
 hydra-test.el |  160 
 hydra.el  |   28 --
 2 files changed, 92 insertions(+), 96 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index de699f9..bea27407 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -38,35 +38,35 @@
("SPC" hydra-repeat "rep" :bind nil)))
 '(progn
   (set (defvar hydra-error/keymap nil "Keymap for hydra-error.")
-   (quote (keymap (7 . hydra-keyboard-quit)
-  (32 . hydra-repeat)
-  (107 . hydra-error/previous-error)
-  (106 . hydra-error/next-error)
-  (104 . hydra-error/first-error)
-  (switch-frame . hydra--handle-switch-frame)
-  (kp-subtract . hydra--negative-argument)
-  (kp-9 . hydra--digit-argument)
-  (kp-8 . hydra--digit-argument)
-  (kp-7 . hydra--digit-argument)
-  (kp-6 . hydra--digit-argument)
-  (kp-5 . hydra--digit-argument)
-  (kp-4 . hydra--digit-argument)
-  (kp-3 . hydra--digit-argument)
-  (kp-2 . hydra--digit-argument)
-  (kp-1 . hydra--digit-argument)
-  (kp-0 . hydra--digit-argument)
-  (57 . hydra--digit-argument)
-  (56 . hydra--digit-argument)
-  (55 . hydra--digit-argument)
-  (54 . hydra--digit-argument)
-  (53 . hydra--digit-argument)
-  (52 . hydra--digit-argument)
-  (51 . hydra--digit-argument)
-  (50 . hydra--digit-argument)
-  (49 . hydra--digit-argument)
-  (48 . hydra--digit-argument)
-  (45 . hydra--negative-argument)
-  (21 . hydra--universal-argument
+   (quote (keymap (7 . hydra-keyboard-quit)
+  (32 . hydra-repeat)
+  (107 . hydra-error/previous-error)
+  (106 . hydra-error/next-error)
+  (104 . hydra-error/first-error)
+  (switch-frame . hydra--handle-switch-frame)
+  (kp-subtract . hydra--negative-argument)
+  (kp-9 . hydra--digit-argument)
+  (kp-8 . hydra--digit-argument)
+  (kp-7 . hydra--digit-argument)
+  (kp-6 . hydra--digit-argument)
+  (kp-5 . hydra--digit-argument)
+  (kp-4 . hydra--digit-argument)
+  (kp-3 . hydra--digit-argument)
+  (kp-2 . hydra--digit-argument)
+  (kp-1 . hydra--digit-argument)
+  (kp-0 . hydra--digit-argument)
+  (57 . hydra--digit-argument)
+  (56 . hydra--digit-argument)
+  (55 . hydra--digit-argument)
+  (54 . hydra--digit-argument)
+  (53 . hydra--digit-argument)
+  (52 . hydra--digit-argument)
+  (51 . hydra--digit-argument)
+  (50 . hydra--digit-argument)
+  (49 . hydra--digit-argument)
+  (48 . hydra--digit-argument)
+  (45 . hydra--negative-argument)
+  (21 . hydra--universal-argument
   (defun hydra-error/first-error nil "Create a hydra with a \"M-g\" body 
and the heads:
 
 \"h\":`first-error',
@@ -87,7 +87,7 @@ Call the head: `first-error'."
   (unless hydra-lv (sit-for 0.8
(when hydra-is-helpful (hydra-error/hint))
(setq hydra-last (hydra-set-transient-map (setq hydra-curr-map 
hydra-error/keymap)
- t (lambda nil 
(hydra-cleanup))
+ t (lambda nil 
(hydra-keyboard-quit))
   (defun hydra-error/next-error nil "Create a hydra with a \"M-g\" body 
and the heads:
 
 \"h\":`first-error',
@@ -108,7 +108,7 @@ Call the head: `next-error'."

[elpa] master 60483cb 09/45: Add integration testing

2015-04-16 Thread Oleh Krehel
branch: master
commit 60483cb282b2b6eb40585decb781f2ae2bed44a0
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add integration testing

* hydra-test.el (hydra-simple): Add example hydra that will be run.
(hydra-with): New defmacro.
(hydra-integration-1): Add test.

Re #101
---
 hydra-test.el |   42 ++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index bea27407..c101e2b 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -968,6 +968,48 @@ _w_ Worf:  % -8`hydra-tng/worf^^
_h_ Set phasers to
body-pre)
  '(funcall (function foo)
 
+(defhydra hydra-simple (global-map "C-c")
+  ("a" (insert "j"))
+  ("b" (insert "k"))
+  ("q" nil))
+
+(defmacro hydra-with (in &rest body)
+  `(let ((temp-buffer (generate-new-buffer " *temp*")))
+ (save-window-excursion
+   (unwind-protect
+(progn
+  (switch-to-buffer temp-buffer)
+  (transient-mark-mode 1)
+  (insert ,in)
+  (goto-char (point-min))
+  (when (search-forward "~" nil t)
+(backward-delete-char 1)
+(set-mark (point)))
+  (goto-char (point-max))
+  (search-backward "|")
+  (delete-char 1)
+  (setq current-prefix-arg)
+  ,@body
+  (insert "|")
+  (when (region-active-p)
+(exchange-point-and-mark)
+(insert "~"))
+  (buffer-substring-no-properties
+   (point-min)
+   (point-max)))
+ (and (buffer-name temp-buffer)
+  (kill-buffer temp-buffer))
+
+(ert-deftest hydra-integration-1 ()
+  (should (string= (hydra-with "|"
+   (execute-kbd-macro
+(kbd "C-c aabbaaqaabbaa")))
+   "jjkkjjaabbaa|"))
+  (should (string= (hydra-with "|"
+   (execute-kbd-macro
+(kbd "C-c aabb C-g aaqaabbaa")))
+   "jjkkaaqaabbaa|")))
+
 (provide 'hydra-test)
 
 ;;; hydra-test.el ends here



[elpa] master acdec5b 27/45: Add an integration test for digit args in amaranth

2015-04-16 Thread Oleh Krehel
branch: master
commit acdec5b3923373ca00af0c4905765f95ac80fcde
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add an integration test for digit args in amaranth

* hydra-test.el (hydra-simple-1): Rename.
(hydra-simple-2): New auxiliary hydra.
(hydra-integration-2): Add test.

Re #104
---
 hydra-test.el |   17 -
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index fcb34c5..23616ee 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1172,11 +1172,16 @@ _w_ Worf:  % -8`hydra-tng/worf^^
_h_ Set phasers to
body-pre)
  '(funcall (function foo)
 
-(defhydra hydra-simple (global-map "C-c")
+(defhydra hydra-simple-1 (global-map "C-c")
   ("a" (insert "j"))
   ("b" (insert "k"))
   ("q" nil))
 
+(defhydra hydra-simple-2 (global-map "C-c" :color amaranth)
+  ("c" self-insert-command)
+  ("d" self-insert-command)
+  ("q" nil))
+
 (defmacro hydra-with (in &rest body)
   `(let ((temp-buffer (generate-new-buffer " *temp*")))
  (save-window-excursion
@@ -1217,6 +1222,16 @@ _w_ Worf:  % -8`hydra-tng/worf^^
_h_ Set phasers to
(execute-kbd-macro "aaqaabbaa"))
"jjkkaaqaabbaa|")))
 
+(ert-deftest hydra-integration-2 ()
+  (should (string= (hydra-with "|"
+   (execute-kbd-macro
+(kbd "C-c c 1 c 2 d 4 c q")))
+   "ccdd|"))
+  (should (string= (hydra-with "|"
+   (execute-kbd-macro
+(kbd "C-c c 1 c C-u d C-u 10 c q")))
+   "cccc|")))
+
 (provide 'hydra-test)
 
 ;;; hydra-test.el ends here



[elpa] master af39a98 14/45: Adapt to the new `hydra-set-transient-map'

2015-04-16 Thread Oleh Krehel
branch: master
commit af39a9885a2a9b1960ff03a1cdc78dfacf00785c
Author: Oleh Krehel 
Commit: Oleh Krehel 

Adapt to the new `hydra-set-transient-map'

* hydra.el (hydra-set-transient-map): Amend arglist.
(hydra--clearfun): Don't count on there being another transient map.
(hydra-disable): Update.
(internal-push-keymap): Define unless defined.
(internal-pop-keymap): Define unless defined.
(hydra--pred): Remove.
(hydra--universal-argument): Update.
(hydra-last): Remove.
(hydra--aggregate-color): Remove.
(hydra--unalias-var): Remove.
(hydra-pink-fallback): Remove.
(hydra--modify-keymap): Remove.
(hydra--make-defun): Update.

Re #90
---
 hydra.el |  266 ++
 1 files changed, 93 insertions(+), 173 deletions(-)

diff --git a/hydra.el b/hydra.el
index fea0e9a..1234cac 100644
--- a/hydra.el
+++ b/hydra.el
@@ -79,59 +79,77 @@
 (require 'cl-lib)
 (require 'lv)
 
+(defvar hydra-curr-map nil
+  "The keymap of the current Hydra called.")
+
 (defvar hydra-curr-on-exit nil
   "The on-exit predicate for the current Hydra.")
 
 (defvar hydra-curr-foreign-keys nil
   "The current :foreign-keys behavior.")
 
-(defun hydra-clearfun ()
-  (with-demoted-errors "set-transient-map PCH: %S"
-(unless (or
- (not (eq hydra-curr-map (cadr overriding-terminal-local-map)))
- ;; There's presumably some other transient-map in
- ;; effect.  Wait for that one to terminate before we
- ;; remove ourselves.
- ;; For example, if isearch and C-u both use transient
- ;; maps, then the lifetime of the C-u should be nested
- ;; within isearch's, so the pre-command-hook of
- ;; isearch should be suspended during the C-u one so
- ;; we don't exit isearch just because we hit 1 after
- ;; C-u and that 1 exits isearch whereas it doesn't
- ;; exit C-u.
- (eq this-command
- (lookup-key hydra-curr-map (this-command-keys-vector
-  (unless (cl-case hydra-curr-foreign-keys
-(warn
- (setq this-command 'hydra-amaranth-warn))
-(run
- t)
-(t nil))
-(remove-hook 'pre-command-hook 'hydra-clearfun)
-(internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map)
-(when hydra-curr-on-exit (funcall hydra-curr-on-exit))
+(defun hydra-set-transient-map (keymap on-exit &optional foreign-keys)
+  "Set KEYMAP to the highest priority.
+
+Call ON-EXIT when the KEYMAP is deactivated.
+
+FOREIGN-KEYS determines the deactivation behavior, when a command
+that isn't in KEYMAP is called:
+
+nil: deactivate KEYMAP and run the command.
+run: keep KEYMAP and run the command.
+warn: keep KEYMAP and issue a warning instead of running the command."
+  (setq hydra-curr-map keymap)
+  (setq hydra-curr-on-exit on-exit)
+  (setq hydra-curr-foreign-keys foreign-keys)
+  (add-hook 'pre-command-hook 'hydra--clearfun)
+  (internal-push-keymap keymap 'overriding-terminal-local-map))
+
+(defun hydra--clearfun ()
+  "Disable the current Hydra unless `this-command' is a head."
+  (unless (eq this-command
+  (lookup-key hydra-curr-map (this-command-keys-vector)))
+(unless (cl-case hydra-curr-foreign-keys
+  (warn
+   (setq this-command 'hydra-amaranth-warn))
+  (run
+   t)
+  (t nil))
+  (hydra-disable
+
+(defun hydra-disable ()
+  "Disable the current Hydra."
+  (remove-hook 'pre-command-hook 'hydra--clearfun)
+  (internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map)
+  (when hydra-curr-on-exit
+(let ((on-exit hydra-curr-on-exit))
+  (setq hydra-curr-on-exit nil)
+  (funcall on-exit
+
+(unless (fboundp 'internal-push-keymap)
+  (defun internal-push-keymap (keymap symbol)
+(let ((map (symbol-value symbol)))
+  (unless (memq keymap map)
+(unless (memq 'add-keymap-witness (symbol-value symbol))
+  (setq map (make-composed-keymap nil (symbol-value symbol)))
+  (push 'add-keymap-witness (cdr map))
+  (set symbol map))
+(push keymap (cdr map))
+
+(unless (fboundp 'internal-pop-keymap)
+  (defun internal-pop-keymap (keymap symbol)
+(let ((map (symbol-value symbol)))
+  (when (memq keymap map)
+(setf (cdr map) (delq keymap (cdr map
+  (let ((tail (cddr map)))
+(and (or (null tail) (keymapp tail))
+ (eq 'add-keymap-witness (nth 1 map))
+ (set symbol tail))
 
 (defun hydra-amaranth-warn ()
   (interactive)
   (message "An amaranth Hydra can only exit through a blue head"))
 
-(defun hydra-set-transient-map (map on-exit)
-  (setq hydra-curr-on-exit on-exit)
-  (add-hook 'pre-command-hook 'hydra-clearfun)
-  (internal-push-keymap map 'overriding-terminal-local-map))
-
-(defun hydra--pre

[elpa] master cc6accd 04/45: hydra.el (hydra--digit-argument): Fix for Emacs 24.3

2015-04-16 Thread Oleh Krehel
branch: master
commit cc6accde9f4056018a0a5f30d8aef81073d1b404
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--digit-argument): Fix for Emacs 24.3

* hydra.el (hydra--digit-argument): Update.

Fixes #98
---
 hydra.el |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/hydra.el b/hydra.el
index 22f522c..91a154e 100644
--- a/hydra.el
+++ b/hydra.el
@@ -215,7 +215,10 @@ Vanquishable only through a blue head.")
 (defun hydra--digit-argument (arg)
   "Forward to (`digit-argument' ARG)."
   (interactive "P")
-  (let ((universal-argument-map hydra-curr-map))
+  (let ((universal-argument-map
+ (if (fboundp 'universal-argument--mode)
+ hydra-curr-map
+   universal-argument-map)))
 (digit-argument arg)))
 
 (defun hydra--negative-argument (arg)



[elpa] master d3d435d 25/45: Finalize head inheritance

2015-04-16 Thread Oleh Krehel
branch: master
commit d3d435deb6e1405d846c2296f7e41a956c519b06
Author: Oleh Krehel 
Commit: Oleh Krehel 

Finalize head inheritance

* hydra.el (hydra--body-exit): New defun.
(defhydra): Ensure that each head doesn't need the :exit info from the
body any more by putting the aggregated :exit in the head's own plist.

* hydra-test.el: Update tests.

Each hydra will now declare its own heads as a variable `foo/heads`.
It's possible to inherit them like this:

(defhydra hydra-zoom-child (:inherit (hydra-zoom/heads))
  "zoom"
  ("q" nil))

One hydra can inherit from multiple parents. This one just adds a single
"q" head to the familiar hydra-zoom.

Fixes #57.
---
 hydra-test.el |   84 +
 hydra.el  |   61 -
 2 files changed, 126 insertions(+), 19 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 54da5d0..fcb34c5 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -70,6 +70,27 @@
  (48 . hydra--digit-argument)
  (45 . hydra--negative-argument)
  (21 . hydra--universal-argument
+  (set
+   (defvar hydra-error/heads nil
+ "Heads for hydra-error.")
+   (quote
+(("h"
+  first-error
+  "first"
+  :exit nil)
+ ("j"
+  next-error
+  "next"
+  :exit nil)
+ ("k"
+  previous-error
+  "prev"
+  :exit nil)
+ ("SPC"
+  hydra-repeat
+  "rep"
+  :bind nil
+  :exit nil
   (defun hydra-error/first-error nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -257,6 +278,23 @@ The body can be accessed via `hydra-error/body'."
  (48 . hydra--digit-argument)
  (45 . hydra--negative-argument)
  (21 . hydra--universal-argument
+  (set
+   (defvar hydra-toggle/heads nil
+ "Heads for hydra-toggle.")
+   (quote
+(("t"
+  toggle-truncate-lines
+  "truncate"
+  :exit t)
+ ("f"
+  auto-fill-mode
+  "fill"
+  :exit t)
+ ("a"
+  abbrev-mode
+  "abbrev"
+  :exit t)
+ ("q" nil "cancel" :exit t
   (defun hydra-toggle/toggle-truncate-lines-and-exit nil
 "Create a hydra with no body and the heads:
 
@@ -403,6 +441,16 @@ The body can be accessed via `hydra-toggle/body'."
  (48 . hydra--digit-argument)
  (45 . hydra--negative-argument)
  (21 . hydra--universal-argument
+  (set
+   (defvar hydra-vi/heads nil
+ "Heads for hydra-vi.")
+   (quote
+(("j" next-line "" :exit nil)
+ ("k"
+  previous-line
+  ""
+  :exit nil)
+ ("q" nil "quit" :exit nil
   (defun hydra-vi/next-line nil
 "Create a hydra with no body and the heads:
 
@@ -551,6 +599,24 @@ The body can be accessed via `hydra-vi/body'."
  (48 . hydra-zoom/lambda-0-and-exit)
  (45 . hydra--negative-argument)
  (21 . hydra--universal-argument
+  (set
+   (defvar hydra-zoom/heads nil
+ "Heads for hydra-zoom.")
+   (quote
+(("r"
+  (text-scale-set 0)
+  "reset"
+  :exit nil)
+ ("0"
+  (text-scale-set 0)
+  ""
+  :bind nil
+  :exit t)
+ ("1"
+  (text-scale-set 0)
+  nil
+  :bind nil
+  :exit t
   (defun hydra-zoom/lambda-r nil
 "Create a hydra with no body and the heads:
 
@@ -674,6 +740,24 @@ The body can be accessed via `hydra-zoom/body'."
  (48 . hydra-zoom/lambda-0-and-exit)
  (45 . hydra--negative-argument)
  (21 . hydra--universal-argument
+  (set
+   (defvar hydra-zoom/heads nil
+ "Heads for hydra-zoom.")
+   (quote
+(("r"
+  (text-scale-set 0)
+  "reset"
+  :exit nil)
+ ("0"
+  (text-scale-set 0)
+  ""
+  :bind nil
+  :exit t)
+ ("1"
+  (text-scale-set 0)
+  nil
+  :bind nil
+  :exit nil
   (defun hydra-zoom/lambda-r nil
 "Create a hydra with no body and the heads:
 
diff --git a/hydra.el b/hydra.el
index 599ad47..1397035 100644
--- a/hydra.el
+++ b/hydra.el
@@ -380,6 +380,15 @@ Return DEFAULT if PROP is not in H."
((amaranth teal) 'warn)
(pink 'run)
 
+(defun hydra--body-exit (body)
+  "Return the exit behavior of BODY."
+  (or
+   (plist-get (cddr body) :exit)
+   (let ((color (plist-get (cddr body) :color)))
+ (cl-case color
+   ((blue teal) t)
+   (t nil)
+
 (defvar hydra--input-method-function nil
   "Store overridden `input-method-function' here.")
 
@@ -798,7 +807,8 @@ result of `defhydra'."
(plist-get body-plist

[elpa] master c06c006 02/45: Use set/defvar for keymap

2015-04-16 Thread Oleh Krehel
branch: master
commit c06c006b69c321937a3798ed6798a47d6a6dccd2
Author: Oleh Krehel 
Commit: Oleh Krehel 

Use set/defvar for keymap

* hydra.el (defhydra): Update. This should facilitate debugging, since a
  plain defvar wouldn't be re-evaluated.

* hydra-test.el (hydra-red-error): Update test.
(hydra-blue-toggle): Update test.
(hydra-amaranth-vi): Update test.
(hydra-zoom-duplicate-1): Update test.
(hydra-zoom-duplicate-2): Update test.
---
 hydra-test.el |  301 -
 hydra.el  |7 +-
 2 files changed, 152 insertions(+), 156 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 9fc4ad0..de699f9 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -37,37 +37,36 @@
("k" previous-error "prev")
("SPC" hydra-repeat "rep" :bind nil)))
 '(progn
-  (defvar hydra-error/keymap
-(quote (keymap (7 . hydra-keyboard-quit)
-   (32 . hydra-repeat)
-   (107 . hydra-error/previous-error)
-   (106 . hydra-error/next-error)
-   (104 . hydra-error/first-error)
-   (switch-frame . hydra--handle-switch-frame)
-   (kp-subtract . hydra--negative-argument)
-   (kp-9 . hydra--digit-argument)
-   (kp-8 . hydra--digit-argument)
-   (kp-7 . hydra--digit-argument)
-   (kp-6 . hydra--digit-argument)
-   (kp-5 . hydra--digit-argument)
-   (kp-4 . hydra--digit-argument)
-   (kp-3 . hydra--digit-argument)
-   (kp-2 . hydra--digit-argument)
-   (kp-1 . hydra--digit-argument)
-   (kp-0 . hydra--digit-argument)
-   (57 . hydra--digit-argument)
-   (56 . hydra--digit-argument)
-   (55 . hydra--digit-argument)
-   (54 . hydra--digit-argument)
-   (53 . hydra--digit-argument)
-   (52 . hydra--digit-argument)
-   (51 . hydra--digit-argument)
-   (50 . hydra--digit-argument)
-   (49 . hydra--digit-argument)
-   (48 . hydra--digit-argument)
-   (45 . hydra--negative-argument)
-   (21 . hydra--universal-argument)))
-"Keymap for hydra-error.")
+  (set (defvar hydra-error/keymap nil "Keymap for hydra-error.")
+   (quote (keymap (7 . hydra-keyboard-quit)
+  (32 . hydra-repeat)
+  (107 . hydra-error/previous-error)
+  (106 . hydra-error/next-error)
+  (104 . hydra-error/first-error)
+  (switch-frame . hydra--handle-switch-frame)
+  (kp-subtract . hydra--negative-argument)
+  (kp-9 . hydra--digit-argument)
+  (kp-8 . hydra--digit-argument)
+  (kp-7 . hydra--digit-argument)
+  (kp-6 . hydra--digit-argument)
+  (kp-5 . hydra--digit-argument)
+  (kp-4 . hydra--digit-argument)
+  (kp-3 . hydra--digit-argument)
+  (kp-2 . hydra--digit-argument)
+  (kp-1 . hydra--digit-argument)
+  (kp-0 . hydra--digit-argument)
+  (57 . hydra--digit-argument)
+  (56 . hydra--digit-argument)
+  (55 . hydra--digit-argument)
+  (54 . hydra--digit-argument)
+  (53 . hydra--digit-argument)
+  (52 . hydra--digit-argument)
+  (51 . hydra--digit-argument)
+  (50 . hydra--digit-argument)
+  (49 . hydra--digit-argument)
+  (48 . hydra--digit-argument)
+  (45 . hydra--negative-argument)
+  (21 . hydra--universal-argument
   (defun hydra-error/first-error nil "Create a hydra with a \"M-g\" body 
and the heads:
 
 \"h\":`first-error',
@@ -177,37 +176,36 @@ The body can be accessed via `hydra-error/body'."
("a" abbrev-mode "abbrev")
("q" nil "cancel")))
 '(progn
-  (defvar hydra-toggle/keymap
-(quote (keymap (7 . hydra-keyboard-quit)
-   (113 . hydra-toggle/nil)
-   (97 . hydra-toggle/abbrev-mode-and-exit)
-   (102 . hydra-toggle/auto-fill-mode-and-exit)
-   (116 . hydra-toggle/toggle-truncate-lines-and-exit)
-   (switch-frame . hydra--handle-switch-frame)
-   (kp-s

[elpa] master updated (22139ae -> f972634)

2015-04-16 Thread Oleh Krehel
abo_abo pushed a change to branch master.

  from  22139ae   Merge commit '3b78e0e503f4763f8a2d77eeacfc91213ec5532e' 
from swiper
   new  d0cc1c5   Define a keymap var for each hydra and re-use it
   new  c06c006   Use set/defvar for keymap
   new  e4cae0a   hydra.el (defhydra): Simplify :cmd-name part
   new  cc6accd   hydra.el (hydra--digit-argument): Fix for Emacs 24.3
   new  1a54e09   hydra.el (hydra--make-funcall): Update location
   new  5379642   Use `hydra-keyboard-quit' instead of `hydra-cleanup'
   new  e7aaafb   hydra.el (hydra-pink-fallback): Allow prefix arguments
   new  f9bf8fe   hydra.el (hydra-set-transient-map): Update
   new  60483cb   Add integration testing
   new  666048c   Update testing setup
   new  4dde4f7   hydra.el (hydra--format): Add some more symbols
   new  3fce2bd   Try to re-encode the input in the terminal
   new  5787a4d   Move away from setting "t" in keymaps
   new  af39a98   Adapt to the new `hydra-set-transient-map'
   new  fa5643f   Quit Hydra for `handle-switch-frame'
   new  cb630df   Update the tests for the new `hydra-set-transient-map'
   new  e88839c   Don't double-call :post
   new  986226f   Simplify `keyboard-quit'
   new  51e7753   Alias :post to :before-exit, and add :after-exit
   new  3d7d8c7   Add basic error handling
   new  19cc1be   Use `unwind-protect' for :after-exit
   new  0ae639f   Use a variable instead of a function for the hint
   new  22348d7   hydra.el (hydra--face): Remove
   new  b351b7c   hydra.el (hydra--body-color): Remove
   new  d3d435d   Finalize head inheritance
   new  2f07e50   Account for digit argument
   new  acdec5b   Add an integration test for digit args in amaranth
   new  8875bf1   Make digit and negative arguments work in 24.3
   new  d71386b   hydra.el (hydra--head-color): Simplify
   new  88f14a0   hydra.el (hydra--head-color): Remove
   new  566aab7   Set `this-command' when appropriate
   new  97c9b9b   Move `this-command' setter
   new  d6e00ed   README.md: Add video demo link
   new  d678cc0   Work around `overriding-terminal-local-map' being 
terminal-local
   new  99b2aea   hydra.el (hydra--format): Match alnum for the "_..._" 
syntax
   new  b2c9ea6   README.md: Update intro
   new  cab5a73   README.md: Update `hydra-zoom/body'
   new  f01c87e   Fix red heads not exiting temporarily
   new  684f8a2   Add integration test for red hydras temporarily exiting
   new  00aef59   hydra.el (hydra--format): Fix "s-t" issue
   new  60ce256   Add an idle message timeout option
   new  aeaabd3   hydra.el (defhydra): Re-throw a caught error when 
debug-on-error
   new  09b63b5   Don't re-activate key chords too early
   new  742d66a   hydra.el: Bump version
   new  f972634   Merge commit '742d66a63e86ac740e610faa5abba97e7f8ad5c2' 
from hydra


Summary of changes:
 packages/hydra/.travis.yml   |6 +-
 packages/hydra/Makefile  |1 +
 packages/hydra/README.md |   68 +-
 packages/hydra/hydra-test.el | 1518 ++
 packages/hydra/hydra.el  |  783 +++
 5 files changed, 1202 insertions(+), 1174 deletions(-)



[elpa] master 60ce256 41/45: Add an idle message timeout option

2015-04-16 Thread Oleh Krehel
branch: master
commit 60ce25698b90b388cb1332137c85a504bc09ed77
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add an idle message timeout option

* hydra.el (hydra-keyboard-quit): Update.
(hydra--make-defun): Update.
(hydra-timeout-timer): Rename from `hydra-timer'.
(hydra-message-timer): New defvar.
(hydra-idle-message): New defun.
(hydra-timeout): Update.

Small example:

(defhydra hydra-zoom (:idle 1.0)
  "zoom"
  ("g" text-scale-increase "in")
  ("l" text-scale-decrease "out"))
(global-set-key (kbd " g") 'hydra-zoom/body)

With this code, `hydra-zoom/body' will display the hint not immediately
but after 1.0 seconds. If you manage to exit the hydra by then, the hint
will not be displayed. Other functions will display the hint
immediately.

Fixes #108
---
 hydra.el |   47 +++
 1 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/hydra.el b/hydra.el
index 0ce5e44..d81ac2a 100644
--- a/hydra.el
+++ b/hydra.el
@@ -369,7 +369,8 @@ Return DEFAULT if PROP is not in H."
   "Quitting function similar to `keyboard-quit'."
   (interactive)
   (hydra-disable)
-  (cancel-timer hydra-timer)
+  (cancel-timer hydra-timeout-timer)
+  (cancel-timer hydra-message-timer)
   (when hydra--input-method-function
 (setq input-method-function hydra--input-method-function)
 (setq hydra--input-method-function nil))
@@ -550,7 +551,8 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
doc))
 (hint (intern (format "%S/hint" name)))
 (body-foreign-keys (hydra--body-foreign-keys body))
-(body-timeout (plist-get body :timeout)))
+(body-timeout (plist-get body :timeout))
+(body-idle (plist-get body :idle)))
 `(defun ,name ()
,doc
(interactive)
@@ -576,10 +578,12 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
(message "%S" err)
(unless hydra-lv
  (sit-for 0.8)
-(when hydra-is-helpful
-  (if hydra-lv
-  (lv-message (eval ,hint))
-(message (eval ,hint
+,(if (and body-idle (eq (cadr head) 'body))
+ `(hydra-idle-message ,body-idle ,hint)
+ `(when hydra-is-helpful
+(if hydra-lv
+(lv-message (eval ,hint))
+  (message (eval ,hint)
 (hydra-set-transient-map
  ,keymap
  (lambda () (hydra-keyboard-quit) ,body-before-exit)
@@ -705,23 +709,42 @@ NAMES should be defined by `defhydradio' or similar."
   (dolist (n names)
 (set n (aref (get n 'range) 0
 
-(defvar hydra-timer (timer-create)
+(defvar hydra-timeout-timer (timer-create)
   "Timer for `hydra-timeout'.")
 
+(defvar hydra-message-timer (timer-create)
+  "Timer for the hint.")
+
+(defun hydra-idle-message (secs hint)
+  "In SECS seconds display HINT."
+  (cancel-timer hydra-message-timer)
+  (setq hydra-message-timer (timer-create))
+  (timer-set-time hydra-message-timer
+  (timer-relative-time (current-time) secs))
+  (timer-set-function
+   hydra-message-timer
+   (lambda ()
+ (when hydra-is-helpful
+   (if hydra-lv
+   (lv-message (eval hint))
+ (message (eval hint
+ (cancel-timer hydra-message-timer)))
+  (timer-activate hydra-message-timer))
+
 (defun hydra-timeout (secs &optional function)
   "In SECS seconds call FUNCTION, then function `hydra-keyboard-quit'.
 Cancel the previous `hydra-timeout'."
-  (cancel-timer hydra-timer)
-  (setq hydra-timer (timer-create))
-  (timer-set-time hydra-timer
+  (cancel-timer hydra-timeout-timer)
+  (setq hydra-timeout-timer (timer-create))
+  (timer-set-time hydra-timeout-timer
   (timer-relative-time (current-time) secs))
   (timer-set-function
-   hydra-timer
+   hydra-timeout-timer
`(lambda ()
   ,(when function
  `(funcall ,function))
   (hydra-keyboard-quit)))
-  (timer-activate hydra-timer))
+  (timer-activate hydra-timeout-timer))
 
 ;;* Macros
 ;;;###autoload



[elpa] master 5787a4d 13/45: Move away from setting "t" in keymaps

2015-04-16 Thread Oleh Krehel
branch: master
commit 5787a4d4d5e3f522893f2422eb3eacda42bb56ec
Author: Oleh Krehel 
Commit: Oleh Krehel 

Move away from setting "t" in keymaps

* hydra.el (hydra-curr-on-exit): New defvar.
(hydra-curr-foreign-keys): New defvar.
(hydra-clearfun): New defun.
(hydra-amaranth-warn): New defun.
(hydra-set-transient-map): Use own defun instead of `set-transient-map'.
(hydra--universal-argument): Update.
(hydra--make-defun): Update.
(hydra--handle-nonhead): Remove.
(defhydra): Update.

Re #90
---
 hydra.el |  138 --
 1 files changed, 71 insertions(+), 67 deletions(-)

diff --git a/hydra.el b/hydra.el
index 1cac1f5..fea0e9a 100644
--- a/hydra.el
+++ b/hydra.el
@@ -79,11 +79,46 @@
 (require 'cl-lib)
 (require 'lv)
 
-(defun hydra-set-transient-map (map _keep-pred &optional on-exit)
-  (if (fboundp 'set-transient-map)
-  (set-transient-map map (hydra--pred on-exit))
-(with-no-warnings
-  (set-temporary-overlay-map map (hydra--pred on-exit)
+(defvar hydra-curr-on-exit nil
+  "The on-exit predicate for the current Hydra.")
+
+(defvar hydra-curr-foreign-keys nil
+  "The current :foreign-keys behavior.")
+
+(defun hydra-clearfun ()
+  (with-demoted-errors "set-transient-map PCH: %S"
+(unless (or
+ (not (eq hydra-curr-map (cadr overriding-terminal-local-map)))
+ ;; There's presumably some other transient-map in
+ ;; effect.  Wait for that one to terminate before we
+ ;; remove ourselves.
+ ;; For example, if isearch and C-u both use transient
+ ;; maps, then the lifetime of the C-u should be nested
+ ;; within isearch's, so the pre-command-hook of
+ ;; isearch should be suspended during the C-u one so
+ ;; we don't exit isearch just because we hit 1 after
+ ;; C-u and that 1 exits isearch whereas it doesn't
+ ;; exit C-u.
+ (eq this-command
+ (lookup-key hydra-curr-map (this-command-keys-vector
+  (unless (cl-case hydra-curr-foreign-keys
+(warn
+ (setq this-command 'hydra-amaranth-warn))
+(run
+ t)
+(t nil))
+(remove-hook 'pre-command-hook 'hydra-clearfun)
+(internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map)
+(when hydra-curr-on-exit (funcall hydra-curr-on-exit))
+
+(defun hydra-amaranth-warn ()
+  (interactive)
+  (message "An amaranth Hydra can only exit through a blue head"))
+
+(defun hydra-set-transient-map (map on-exit)
+  (setq hydra-curr-on-exit on-exit)
+  (add-hook 'pre-command-hook 'hydra-clearfun)
+  (internal-push-keymap map 'overriding-terminal-local-map))
 
 (defun hydra--pred (on-exit)
   "Generate a predicate on whether to continue the Hydra state.
@@ -209,7 +244,7 @@ Vanquishable only through a blue head.")
  (if (eq arg '-)
  (list -4)
'(4
-  (hydra-set-transient-map hydra-curr-map t))
+  (hydra-set-transient-map hydra-curr-map hydra-curr-on-exit))
 
 (defun hydra--digit-argument (arg)
   "Forward to (`digit-argument' ARG)."
@@ -603,16 +638,23 @@ OTHER-POST is an optional extension to the :post key of 
BODY."
   (sit-for 0.8)
   (when hydra-is-helpful
 (,hint))
+  (setq hydra-curr-map ,keymap)
+  (setq hydra-curr-foreign-keys
+,(cond
+  ((memq body-color '(amaranth teal))
+   ''warn)
+  ((eq body-color 'pink)
+   ''run)
+  (t
+   nil)))
+  (setq hydra-curr-on-exit
+(lambda ()
+  (hydra-keyboard-quit)
+  ,body-post))
   (setq hydra-last
 (hydra-set-transient-map
- (setq hydra-curr-map ,keymap)
- t
- ,(if (and
-   (not (memq body-color
-  '(amaranth pink teal)))
-   body-post)
-  `(lambda () (hydra-keyboard-quit) ,body-post)
-  `(lambda () (hydra-keyboard-quit)
+ hydra-curr-map
+ hydra-curr-on-exit))
   ,(or other-post
(when body-timeout
  (list 'hydra-timeout
@@ -659,54 +701,6 @@ OTHER-POST is an optional extension to the :post key of 
BODY."
   `(when (and ,sym (symbolp ,

[elpa] master 4dde4f7 11/45: hydra.el (hydra--format): Add some more symbols

2015-04-16 Thread Oleh Krehel
branch: master
commit 4dde4f7fc377aa9aa5dfed9e74f9d18bf99fb201
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--format): Add some more symbols

Re #103 #102
---
 hydra.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hydra.el b/hydra.el
index da7f58e..c817a3f 100644
--- a/hydra.el
+++ b/hydra.el
@@ -492,7 +492,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]*\\)\\([a-z-A-Z~.,;:0-9/|?<>={}]+\\)_\\)"
+  "\\(?:%\\( 
?-?[0-9]*s?\\)\\(`[a-z-A-Z/0-9]+\\|(\\)\\)\\|\\(?:_\\( 
?-?[0-9]*\\)\\([a-z-A-Z~.,;:0-9/|?<>={}*+#]+\\)_\\)"
   docstring start))
   (cond ((eq ?_ (aref (match-string 0 docstring) 0))
  (let* ((key (match-string 4 docstring))



[elpa] master fa5643f 15/45: Quit Hydra for `handle-switch-frame'

2015-04-16 Thread Oleh Krehel
branch: master
commit fa5643f318539a800f93e9cb5b574b24c8d3879d
Author: Oleh Krehel 
Commit: Oleh Krehel 

Quit Hydra for `handle-switch-frame'

* hydra.el (hydra--clearfun): Update.
(hydra-base-map): Update.
(hydra--handle-switch-frame): Remove.

Re #90, #73.
---
 hydra.el |   27 +++
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/hydra.el b/hydra.el
index 1234cac..d302de8 100644
--- a/hydra.el
+++ b/hydra.el
@@ -107,15 +107,17 @@ warn: keep KEYMAP and issue a warning instead of running 
the command."
 
 (defun hydra--clearfun ()
   "Disable the current Hydra unless `this-command' is a head."
-  (unless (eq this-command
-  (lookup-key hydra-curr-map (this-command-keys-vector)))
-(unless (cl-case hydra-curr-foreign-keys
-  (warn
-   (setq this-command 'hydra-amaranth-warn))
-  (run
-   t)
-  (t nil))
-  (hydra-disable
+  (if (eq this-command 'handle-switch-frame)
+  (hydra-disable)
+(unless (eq this-command
+(lookup-key hydra-curr-map (this-command-keys-vector)))
+  (unless (cl-case hydra-curr-foreign-keys
+(warn
+ (setq this-command 'hydra-amaranth-warn))
+(run
+ t)
+(t nil))
+(hydra-disable)
 
 (defun hydra-disable ()
   "Disable the current Hydra."
@@ -240,16 +242,9 @@ Vanquishable only through a blue head.")
 (define-key map [kp-8] 'hydra--digit-argument)
 (define-key map [kp-9] 'hydra--digit-argument)
 (define-key map [kp-subtract] 'hydra--negative-argument)
-(define-key map [switch-frame] 'hydra--handle-switch-frame)
 map)
   "Keymap that all Hydras inherit.  See `universal-argument-map'.")
 
-(defun hydra--handle-switch-frame (evt)
-  "Quit hydra and call old switch-frame event handler for EVT."
-  (interactive "e")
-  (hydra-keyboard-quit)
-  (funcall (lookup-key (current-global-map) [switch-frame]) evt))
-
 (defun hydra--universal-argument (arg)
   "Forward to (`universal-argument' ARG)."
   (interactive "P")



[elpa] master 666048c 10/45: Update testing setup

2015-04-16 Thread Oleh Krehel
branch: master
commit 666048cec6e8b54e4a43dd13f40f298c685283f8
Author: Oleh Krehel 
Commit: Oleh Krehel 

Update testing setup

* .travis.yml: Add emacs-snapshot.

* Makefile: Echo the path to the emacs binary.

* hydra-test.el: Echo Emacs version.
---
 .travis.yml   |6 --
 Makefile  |1 +
 hydra-test.el |1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 1f5dbc7..e97acdb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,14 @@
 language: emacs-lisp
 env:
   matrix:
-- EMACS=emacs24
+- emacs=emacs24
+- emacs=emacs-snapshot
 
 before_install:
   - sudo add-apt-repository -y ppa:cassou/emacs
+  - sudo add-apt-repository -y ppa:ubuntu-elisp
   - sudo apt-get update -qq
-  - sudo apt-get install -qq $EMACS
+  - sudo apt-get install -qq $emacs
 
 script:
   - make test
diff --git a/Makefile b/Makefile
index 35709e1..43bcb5a 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ LOAD = -l lv.el -l hydra.el -l hydra-test.el
 all: test
 
 test:
+   @echo "Using $(shell which $(emacs))..."
$(emacs) -batch $(LOAD) -f ert-run-tests-batch-and-exit
 
 compile:
diff --git a/hydra-test.el b/hydra-test.el
index c101e2b..2dd5883 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -25,6 +25,7 @@
 ;;; Code:
 
 (require 'ert)
+(message "Emacs version: %s" emacs-version)
 
 (ert-deftest hydra-red-error ()
   (should



[elpa] master 22348d7 23/45: hydra.el (hydra--face): Remove

2015-04-16 Thread Oleh Krehel
branch: master
commit 22348d7db18e72978c44a997a46dacf7bfa848a1
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--face): Remove

* hydra.el (hydra-fontify-head-default): Update.
---
 hydra.el |   19 ---
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/hydra.el b/hydra.el
index 66a8f26..e5152c0 100644
--- a/hydra.el
+++ b/hydra.el
@@ -385,16 +385,6 @@ BODY is the second argument to `defhydra'"
   (color color)
   (t 'red
 
-(defun hydra--face (h body)
-  "Return the face for a Hydra head H with BODY."
-  (cl-case (hydra--head-color h body)
-(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" h
-
 (defvar hydra--input-method-function nil
   "Store overridden `input-method-function' here.")
 
@@ -452,7 +442,14 @@ BODY, and HEADS are parameters to `defhydra'."
 (defun hydra-fontify-head-default (head body)
   "Produce a pretty string from HEAD and BODY.
 HEAD's binding is returned as a string with a colored face."
-  (propertize (car head) 'face (hydra--face head body)))
+  (propertize (car head) 'face
+  (cl-case (hydra--head-color head body)
+(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 e4cae0a 03/45: hydra.el (defhydra): Simplify :cmd-name part

2015-04-16 Thread Oleh Krehel
branch: master
commit e4cae0a0ddca9c6928a7ff5607949adb5c743bb5
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (defhydra): Simplify :cmd-name part

* hydra.el (defhydra): When a plist isn't nil, `plist-put' can be used,
which is useful to overwrite :cmd-name if it's present. When plist is
nil, use the old code.
---
 hydra.el |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hydra.el b/hydra.el
index f228e97..22f522c 100644
--- a/hydra.el
+++ b/hydra.el
@@ -914,10 +914,14 @@ result of `defhydra'."
(setcdr (cdr h) (cons
 (hydra-plist-get-default body-plist :hint 
"")
 (cddr h
- (setcdr (cddr h)
- `(:cmd-name
-   ,(hydra--head-name h name body)
-   ,@(cl-cdddr h
+ (let ((hint-and-plist (cddr h)))
+   (if (null (cdr hint-and-plist))
+   (setcdr hint-and-plist
+   (list :cmd-name
+ (hydra--head-name h name body)))
+ (plist-put (cdr hint-and-plist)
+:cmd-name
+(hydra--head-name h name body)
 (let ((doc (hydra--doc body-key body-name heads))
   (heads-nodup (hydra--delete-duplicates heads)))
   (mapc



[elpa] master 88f14a0 30/45: hydra.el (hydra--head-color): Remove

2015-04-16 Thread Oleh Krehel
branch: master
commit 88f14a04a3fe723753a7139a400b690bbeb40bd7
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--head-color): Remove

* hydra.el (hydra-fontify-head-default): Move `hydra--head-color' body
  here.
(hydra-fontify-head-greyscale): Simplify.
(hydra--make-defun): Simplify.
(hydra--head-name): Simplify.
(hydra--delete-duplicates): Update.
(defhydra): Update.
---
 hydra-test.el |   26 -
 hydra.el  |   71 +---
 2 files changed, 32 insertions(+), 65 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 635a53f..a8facfe 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1029,32 +1029,6 @@ _f_ auto-fill-mode:%`auto-fill-function
(buffer-narrowed-p)))
  "[[q]]: cancel"
 
-(ert-deftest hydra-compat-colors-1 ()
-  (should (equal (hydra--head-color
-  '("e" (message "Exiting now") "blue" :exit t)
-  '(nil nil :color blue))
- 'blue))
-  (should (equal (hydra--head-color
-  '("c" (message "Continuing") "red" :color red)
-  '(nil nil :color blue))
- 'red))
-  (should (equal (hydra--head-color
-  '("j" next-line "" :exit t)
-  '(nil nil))
- 'blue))
-  (should (equal (hydra--head-color
-  '("c" (message "Continuing") "red" :exit nil)
-  '(nil nil :exit t))
- 'red))
-  (equal (hydra--head-color
-  '("a" abbrev-mode nil :exit t)
-  '(nil nil :color teal))
- 'teal)
-  (equal (hydra--head-color
-  '("a" abbrev-mode :exit nil)
-  '(nil nil :color teal))
- 'amaranth))
-
 (ert-deftest hydra-compat-colors-2 ()
   (should
(equal
diff --git a/hydra.el b/hydra.el
index 61d4d4a..57a78fc 100644
--- a/hydra.el
+++ b/hydra.el
@@ -330,24 +330,6 @@ 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-color (h body)
-  "Return the color of a Hydra head H with BODY."
-  (let* ((foreign-keys (hydra--body-foreign-keys body))
- (head-exit (hydra--head-property h :exit))
- (head-color
-  (if head-exit
-  (if (eq foreign-keys 'warn)
-  'teal
-'blue)
-(cl-case foreign-keys
-  (warn 'amaranth)
-  (run 'pink)
-  (t 'red)
-(when (and (null (cadr h))
-   (not (eq head-color 'blue)))
-  (hydra--complain "nil cmd can only be blue"))
-head-color))
-
 (defun hydra--body-foreign-keys (body)
   "Return what BODY does with a non-head binding."
   (or
@@ -423,23 +405,36 @@ BODY, and HEADS are parameters to `defhydra'."
 (defun hydra-fontify-head-default (head body)
   "Produce a pretty string from HEAD and BODY.
 HEAD's binding is returned as a string with a colored face."
-  (propertize (car head) 'face
-  (cl-case (hydra--head-color head body)
-(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)
+  (let* ((foreign-keys (hydra--body-foreign-keys body))
+ (head-exit (hydra--head-property head :exit))
+ (head-color
+  (if head-exit
+  (if (eq foreign-keys 'warn)
+  'teal
+'blue)
+(cl-case foreign-keys
+  (warn 'amaranth)
+  (run 'pink)
+  (t 'red)
+(when (and (null (cadr head))
+   (not (eq head-color 'blue)))
+  (hydra--complain "nil cmd can only be blue"))
+(propertize (car 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.
 HEAD's binding is returned as a string wrapped with [] or {}."
-  (let ((color (hydra--head-color head body)))
-(format
- (if (eq color 'blue)
- "[%s]"
-   "{%s}") (car head
+  (format
+   (if (hydra--head-property head :exit)
+   "[%s]"
+ "{%s}") (car head)))
 
 (defun hydra-fontify-head (head body)
   "Produce a pretty string from HEAD and BODY."
@@ -533,8 +528,6 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
 (cmd (when (car head)
(hydra--make-callable
 (cadr head
-(color (when (car head)
- (hydra--head-color head body)))
  

[elpa] master 684f8a2 39/45: Add integration test for red hydras temporarily exiting

2015-04-16 Thread Oleh Krehel
branch: master
commit 684f8a2d71ea7b515fd1de3b6d15973a40002576
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add integration test for red hydras temporarily exiting

* hydra-test.el (hydra-simple-3): Add.
(hydra-integration-3): Add.

Re #109
---
 hydra-test.el |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 7d361e6..d9adba6 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -1198,6 +1198,11 @@ _w_ Worf:  % -8`hydra-tng/worf^^
_h_ Set phasers to
   ("d" self-insert-command)
   ("q" nil))
 
+(defhydra hydra-simple-3 (global-map "C-c")
+  ("g" goto-line)
+  ("1" find-file)
+  ("q" nil))
+
 (defmacro hydra-with (in &rest body)
   `(let ((temp-buffer (generate-new-buffer " *temp*")))
  (save-window-excursion
@@ -1248,6 +1253,12 @@ _w_ Worf:  % -8`hydra-tng/worf^^
_h_ Set phasers to
 (kbd "C-c c 1 c C-u d C-u 10 c q")))
"cccc|")))
 
+(ert-deftest hydra-integration-3 ()
+  (should (string= (hydra-with "foo\nbar|"
+   (execute-kbd-macro
+(kbd "C-c g 1 RET q")))
+   "|foo\nbar")))
+
 (provide 'hydra-test)
 
 ;;; hydra-test.el ends here



[elpa] master 566aab7 31/45: Set `this-command' when appropriate

2015-04-16 Thread Oleh Krehel
branch: master
commit 566aab77e92e98f6ca317a9a6646e219b2ef85c7
Author: Oleh Krehel 
Commit: Oleh Krehel 

Set `this-command' when appropriate

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

* hydra-test.el: Update tests.

Re #79
---
 hydra-test.el |   32 
 hydra.el  |9 ++---
 2 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index a8facfe..28b4519 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -121,7 +121,9 @@ Call the head: `first-error'."
  (lambda nil
(hydra-keyboard-quit)
nil)
- nil))
+ nil)
+(setq this-command
+  (quote first-error)))
   (defun hydra-error/next-error nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -152,7 +154,9 @@ Call the head: `next-error'."
  (lambda nil
(hydra-keyboard-quit)
nil)
- nil))
+ nil)
+(setq this-command
+  (quote next-error)))
   (defun hydra-error/previous-error nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -183,7 +187,9 @@ Call the head: `previous-error'."
  (lambda nil
(hydra-keyboard-quit)
nil)
- nil))
+ nil)
+(setq this-command
+  (quote previous-error)))
   (unless (keymapp
(lookup-key
 global-map
@@ -311,7 +317,9 @@ Call the head: `toggle-truncate-lines'."
 (hydra-keyboard-quit)
 (call-interactively
  (function
-  toggle-truncate-lines)))
+  toggle-truncate-lines))
+(setq this-command
+  (quote toggle-truncate-lines)))
   (defun hydra-toggle/auto-fill-mode-and-exit nil
 "Create a hydra with no body and the heads:
 
@@ -327,7 +335,9 @@ Call the head: `auto-fill-mode'."
 (hydra-default-pre)
 (hydra-keyboard-quit)
 (call-interactively
- (function auto-fill-mode)))
+ (function auto-fill-mode))
+(setq this-command
+  (quote auto-fill-mode)))
   (defun hydra-toggle/abbrev-mode-and-exit nil
 "Create a hydra with no body and the heads:
 
@@ -343,7 +353,9 @@ Call the head: `abbrev-mode'."
 (hydra-default-pre)
 (hydra-keyboard-quit)
 (call-interactively
- (function abbrev-mode)))
+ (function abbrev-mode))
+(setq this-command
+  (quote abbrev-mode)))
   (defun hydra-toggle/nil nil
 "Create a hydra with no body and the heads:
 
@@ -480,7 +492,9 @@ Call the head: `next-line'."
  (lambda nil
(hydra-keyboard-quit)
(set-cursor-color "#ff"))
- (quote warn)))
+ (quote warn))
+(setq this-command
+  (quote next-line)))
   (defun hydra-vi/previous-line nil
 "Create a hydra with no body and the heads:
 
@@ -510,7 +524,9 @@ Call the head: `previous-line'."
  (lambda nil
(hydra-keyboard-quit)
(set-cursor-color "#ff"))
- (quote warn)))
+ (quote warn))
+(setq this-command
+  (quote previous-line)))
   (defun hydra-vi/nil nil
 "Create a hydra with no body and the heads:
 
diff --git a/hydra.el b/hydra.el
index 57a78fc..e002c8a 100644
--- a/hydra.el
+++ b/hydra.el
@@ -566,7 +566,10 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
  (list 'quote body-foreign-keys)))
  ,body-after-exit
  ,(when body-timeout
-`(hydra-timeout ,body-timeout
+`(hydra-timeout ,body-timeout)
+   ,@(when (and (symbolp (cadr head))
+(not (memq (cadr head) '(nil body
+   `((setq this-command ',(cadr head)))
 
 (defmacro hydra--make-funcall (sym)
   "Transform SYM into a `funcall' to call it."
@@ -779,8 +782,6 @@ result of `defhydra'."
  (body-inherit (plist-get body-plist :inherit))
  (body-foreign-keys (hydra--body-foreign-keys body))
  (body-exit (hydra--body-exit body)))
-(hydra--make-funcall body-before-exit)
-(hydra--make-funcall body-after-exit)
 (dolist (base body-inherit)
   (setq heads (append heads (copy-sequence (eval base)
 (dolist (h heads)
@@ -827,6 +828,8 @@ result of `defhydra'."
heads)
   (hydra--make-funcall body-pre)
   (hydra--make-funcall body-body-pre)
+  (hydra--make-funcall body-before-exit)
+  (hydra--make-funcall body-after-exit)
   (when (memq body-foreign-keys '(run warn))
 (unless (cl-some
  (lambda (h)



[elpa] master e88839c 17/45: Don't double-call :post

2015-04-16 Thread Oleh Krehel
branch: master
commit e88839ca5fa1b48082d2443e262cdf372f9e3702
Author: Oleh Krehel 
Commit: Oleh Krehel 

Don't double-call :post

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

* hydra-test.el: Update tests.

:post will be called via `hydra-curr-on-exit' in `hydra-disable'.

Re #90
---
 hydra-test.el |   22 +++---
 hydra.el  |8 ++--
 2 files changed, 9 insertions(+), 21 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index d079451..0ac6a8f 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -261,8 +261,7 @@ Call the head: `toggle-truncate-lines'."
 (hydra-keyboard-quit)
 (call-interactively
  (function
-  toggle-truncate-lines))
-nil)
+  toggle-truncate-lines)))
   (defun hydra-toggle/auto-fill-mode-and-exit nil
 "Create a hydra with no body and the heads:
 
@@ -278,8 +277,7 @@ Call the head: `auto-fill-mode'."
 (hydra-default-pre)
 (hydra-keyboard-quit)
 (call-interactively
- (function auto-fill-mode))
-nil)
+ (function auto-fill-mode)))
   (defun hydra-toggle/abbrev-mode-and-exit nil
 "Create a hydra with no body and the heads:
 
@@ -295,8 +293,7 @@ Call the head: `abbrev-mode'."
 (hydra-default-pre)
 (hydra-keyboard-quit)
 (call-interactively
- (function abbrev-mode))
-nil)
+ (function abbrev-mode)))
   (defun hydra-toggle/nil nil
 "Create a hydra with no body and the heads:
 
@@ -311,7 +308,6 @@ Call the head: `nil'."
 (interactive)
 (hydra-default-pre)
 (hydra-keyboard-quit)
-nil
 nil)
   (defun hydra-toggle/hint nil
 (if hydra-lv
@@ -412,8 +408,7 @@ Call the head: `hydra-keyboard-quit'."
 (set-cursor-color "#e52b50")
 (hydra-keyboard-quit)
 (call-interactively
- (function hydra-keyboard-quit))
-(set-cursor-color "#ff"))
+ (function hydra-keyboard-quit)))
   (defun hydra-vi/next-line nil
 "Create a hydra with no body and the heads:
 
@@ -485,8 +480,7 @@ Call the head: `nil'."
 (hydra-default-pre)
 (set-cursor-color "#e52b50")
 (hydra-keyboard-quit)
-nil
-(set-cursor-color "#ff"))
+nil)
   (defun hydra-vi/hint nil
 (if hydra-lv
 (lv-message
@@ -608,8 +602,7 @@ Call the head: `(text-scale-set 0)'."
  (function
   (lambda nil
(interactive)
-   (text-scale-set 0
-nil)
+   (text-scale-set 0)
   (defun hydra-zoom/hint nil
 (if hydra-lv
 (lv-message
@@ -727,8 +720,7 @@ Call the head: `(text-scale-set 0)'."
  (function
   (lambda nil
(interactive)
-   (text-scale-set 0
-nil)
+   (text-scale-set 0)
   (defun hydra-zoom/hint nil
 (if hydra-lv
 (lv-message
diff --git a/hydra.el b/hydra.el
index d302de8..502b6a8 100644
--- a/hydra.el
+++ b/hydra.el
@@ -581,8 +581,7 @@ OTHER-POST is an optional extension to the :post key of 
BODY."
,@(when body-pre (list body-pre))
,@(if (memq color '(blue teal))
  `((hydra-keyboard-quit)
-   ,(when cmd `(call-interactively #',cmd))
-   ,body-post)
+   ,(when cmd `(call-interactively #',cmd)))
  (delq
   nil
   `(,(when cmd
@@ -606,10 +605,7 @@ OTHER-POST is an optional extension to the :post key of 
BODY."
  nil)))
  ,(or other-post
   (when body-timeout
-`(hydra-timeout
-  ,body-timeout
-  ,(when body-post
- (hydra--make-callable body-post)))
+`(hydra-timeout ,body-timeout)
 
 (defmacro hydra--make-funcall (sym)
   "Transform SYM into a `funcall' that calls it."



[elpa] master aeaabd3 42/45: hydra.el (defhydra): Re-throw a caught error when debug-on-error

2015-04-16 Thread Oleh Krehel
branch: master
commit aeaabd3c8a76920e839ce05add7278e575f201e6
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (defhydra): Re-throw a caught error when debug-on-error

* hydra.el (defhydra): Update.
---
 hydra.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/hydra.el b/hydra.el
index d81ac2a..50eb901 100644
--- a/hydra.el
+++ b/hydra.el
@@ -941,7 +941,9 @@ result of `defhydra'."
(or body-body-pre body-pre) body-before-exit
'(setq prefix-arg current-prefix-arg)
 (error
- (message "Error in defhydra %S: %s" name (cdr err))
+ (if debug-on-error
+ (signal (car err) (cdr err))
+   (message "Error in defhydra %S: %s" name (cdr err)))
  nil)))
 
 (defmacro defhydradio (name _body &rest heads)



[elpa] master d678cc0 34/45: Work around `overriding-terminal-local-map' being terminal-local

2015-04-16 Thread Oleh Krehel
branch: master
commit d678cc06cc245d0fedc6242fe8ee1bed764477ac
Author: Oleh Krehel 
Commit: Oleh Krehel 

Work around `overriding-terminal-local-map' being terminal-local

* hydra.el (hydra-disable): Try to reset `overriding-terminal-local-map'
  for each frame, so that it doesn't happen that the hydra is cancelled
  in one frame, but not in the other. `hydra-curr-on-exit' is called in
  the first frame for which there's a transient map.

(hydra--clearfun): Disable when `overriding-terminal-local-map' is nil.

Fixes #105
---
 hydra.el |   37 -
 1 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/hydra.el b/hydra.el
index fea8701..39c027c 100644
--- a/hydra.el
+++ b/hydra.el
@@ -107,27 +107,30 @@ warn: keep KEYMAP and issue a warning instead of running 
the command."
 
 (defun hydra--clearfun ()
   "Disable the current Hydra unless `this-command' is a head."
-  (if (memq this-command '(handle-switch-frame
-   keyboard-quit))
-  (hydra-disable)
-(unless (eq this-command
-(lookup-key hydra-curr-map (this-single-command-keys)))
-  (unless (cl-case hydra-curr-foreign-keys
-(warn
- (setq this-command 'hydra-amaranth-warn))
-(run
- t)
-(t nil))
-(hydra-disable)
+  (when (or
+ (memq this-command '(handle-switch-frame keyboard-quit))
+ (null overriding-terminal-local-map)
+ (not (or (eq this-command
+  (lookup-key hydra-curr-map (this-single-command-keys)))
+  (cl-case hydra-curr-foreign-keys
+(warn
+ (setq this-command 'hydra-amaranth-warn))
+(run
+ t)
+(t nil)
+(hydra-disable)))
 
 (defun hydra-disable ()
   "Disable the current Hydra."
   (remove-hook 'pre-command-hook 'hydra--clearfun)
-  (internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map)
-  (when hydra-curr-on-exit
-(let ((on-exit hydra-curr-on-exit))
-  (setq hydra-curr-on-exit nil)
-  (funcall on-exit
+  (dolist (frame (frame-list))
+(with-selected-frame frame
+  (when overriding-terminal-local-map
+(internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map)
+(when hydra-curr-on-exit
+  (let ((on-exit hydra-curr-on-exit))
+(setq hydra-curr-on-exit nil)
+(funcall on-exit)))
 
 (unless (fboundp 'internal-push-keymap)
   (defun internal-push-keymap (keymap symbol)



[elpa] master 09b63b5 43/45: Don't re-activate key chords too early

2015-04-16 Thread Oleh Krehel
branch: master
commit 09b63b5b3407ab34210e81eca4fba7378f1e9f4e
Author: Oleh Krehel 
Commit: Oleh Krehel 

Don't re-activate key chords too early

* hydra.el (hydra-disable): Re-activate key chords only if
  `hydra--ignore' is nil.
(hydra-keyboard-quit): Update.

Re #97
---
 hydra.el |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hydra.el b/hydra.el
index 50eb901..1c19b79 100644
--- a/hydra.el
+++ b/hydra.el
@@ -131,10 +131,13 @@ warn: keep KEYMAP and issue a warning instead of running 
the command."
   (when overriding-terminal-local-map
 (internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map)
 (unless hydra--ignore
- (when hydra-curr-on-exit
-   (let ((on-exit hydra-curr-on-exit))
- (setq hydra-curr-on-exit nil)
- (funcall on-exit
+  (when hydra--input-method-function
+(setq input-method-function hydra--input-method-function)
+(setq hydra--input-method-function nil))
+  (when hydra-curr-on-exit
+(let ((on-exit hydra-curr-on-exit))
+  (setq hydra-curr-on-exit nil)
+  (funcall on-exit
 
 (unless (fboundp 'internal-push-keymap)
   (defun internal-push-keymap (keymap symbol)
@@ -371,9 +374,6 @@ Return DEFAULT if PROP is not in H."
   (hydra-disable)
   (cancel-timer hydra-timeout-timer)
   (cancel-timer hydra-message-timer)
-  (when hydra--input-method-function
-(setq input-method-function hydra--input-method-function)
-(setq hydra--input-method-function nil))
   (if hydra-lv
   (when (window-live-p lv-wnd)
 (let ((buf (window-buffer lv-wnd)))



[elpa] master 8875bf1 28/45: Make digit and negative arguments work in 24.3

2015-04-16 Thread Oleh Krehel
branch: master
commit 8875bf1b16c2f74fa3855d9ec8eddfe49edbb5c4
Author: Oleh Krehel 
Commit: Oleh Krehel 

Make digit and negative arguments work in 24.3

* hydra.el (hydra--digit-argument): Update.
(hydra--negative-argument): Update.

Just flatten these two functions to their 25.2 bodies, and don't call
the `set-transient-map' variants, since the map remains anyway because
of `hydra-base-map'.
---
 hydra.el |   25 ++---
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/hydra.el b/hydra.el
index 0d219e3..15ef310 100644
--- a/hydra.el
+++ b/hydra.el
@@ -253,17 +253,28 @@ Vanquishable only through a blue head.")
 (defun hydra--digit-argument (arg)
   "Forward to (`digit-argument' ARG)."
   (interactive "P")
-  (let ((universal-argument-map
- (if (fboundp 'universal-argument--mode)
- hydra-curr-map
-   universal-argument-map)))
-(digit-argument arg)))
+  (let* ((char (if (integerp last-command-event)
+   last-command-event
+ (get last-command-event 'ascii-character)))
+ (digit (- (logand char ?\177) ?0)))
+(setq prefix-arg (cond ((integerp arg)
+(+ (* arg 10)
+   (if (< arg 0)
+   (- digit)
+ digit)))
+   ((eq arg '-)
+(if (zerop digit)
+'-
+  (- digit)))
+   (t
+digit)
 
 (defun hydra--negative-argument (arg)
   "Forward to (`negative-argument' ARG)."
   (interactive "P")
-  (let ((universal-argument-map hydra-curr-map))
-(negative-argument arg)))
+  (setq prefix-arg (cond ((integerp arg) (- arg))
+ ((eq arg '-) nil)
+ (t '-
 
 ;;* Repeat
 (defvar hydra-repeat--prefix-arg nil



[elpa] master 99b2aea 35/45: hydra.el (hydra--format): Match alnum for the "_..._" syntax

2015-04-16 Thread Oleh Krehel
branch: master
commit 99b2aea8a178986a76ba52a3f1659d7099ddbfa1
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--format): Match alnum for the "_..._" syntax

Fixes #106
---
 hydra.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hydra.el b/hydra.el
index 39c027c..970716f 100644
--- a/hydra.el
+++ b/hydra.el
@@ -456,7 +456,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]*\\)\\([a-z-A-Z~.,;:0-9/|?<>={}*+#]+\\)_\\)"
+  "\\(?:%\\( 
?-?[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))



[elpa] master 986226f 18/45: Simplify `keyboard-quit'

2015-04-16 Thread Oleh Krehel
branch: master
commit 986226f8652743881d282bd2de81b7bc11ddaf31
Author: Oleh Krehel 
Commit: Oleh Krehel 

Simplify `keyboard-quit'

* hydra.el (hydra--clearfun): Update.
(hydra-keyboard-quit): Remove defcustom.
(defhydra): Update.

* hydra-test.el: Update tests.
(hydra-integration-1): Catch the 'quit signal, since now "C-g" is just a
plain `keyboard-quit'.
---
 hydra-test.el |   33 +
 hydra.el  |   14 ++
 2 files changed, 7 insertions(+), 40 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 0ac6a8f..9fe3fb1 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -45,7 +45,6 @@
   (107 . hydra-error/previous-error)
   (106 . hydra-error/next-error)
   (104 . hydra-error/first-error)
-  (7 . hydra-keyboard-quit)
   (kp-subtract . hydra--negative-argument)
   (kp-9 . hydra--digit-argument)
   (kp-8 . hydra--digit-argument)
@@ -221,7 +220,6 @@ The body can be accessed via `hydra-error/body'."
   (97 . hydra-toggle/abbrev-mode-and-exit)
   (102 . hydra-toggle/auto-fill-mode-and-exit)
   (116 . hydra-toggle/toggle-truncate-lines-and-exit)
-  (7 . hydra-keyboard-quit)
   (kp-subtract . hydra--negative-argument)
   (kp-9 . hydra--digit-argument)
   (kp-8 . hydra--digit-argument)
@@ -368,7 +366,6 @@ The body can be accessed via `hydra-toggle/body'."
(quote (keymap (113 . hydra-vi/nil)
   (107 . hydra-vi/previous-line)
   (106 . hydra-vi/next-line)
-  (7 . hydra-vi/hydra-keyboard-quit-and-exit)
   (kp-subtract . hydra--negative-argument)
   (kp-9 . hydra--digit-argument)
   (kp-8 . hydra--digit-argument)
@@ -392,27 +389,9 @@ The body can be accessed via `hydra-toggle/body'."
   (48 . hydra--digit-argument)
   (45 . hydra--negative-argument)
   (21 . hydra--universal-argument
-  (defun hydra-vi/hydra-keyboard-quit-and-exit nil
-"Create a hydra with no body and the heads:
-
-\"\":`hydra-keyboard-quit',
-\"j\":`next-line',
-\"k\":`previous-line',
-\"q\":`nil'
-
-The body can be accessed via `hydra-vi/body'.
-
-Call the head: `hydra-keyboard-quit'."
-(interactive)
-(hydra-default-pre)
-(set-cursor-color "#e52b50")
-(hydra-keyboard-quit)
-(call-interactively
- (function hydra-keyboard-quit)))
   (defun hydra-vi/next-line nil
 "Create a hydra with no body and the heads:
 
-\"\":`hydra-keyboard-quit',
 \"j\":`next-line',
 \"k\":`previous-line',
 \"q\":`nil'
@@ -440,7 +419,6 @@ Call the head: `next-line'."
   (defun hydra-vi/previous-line nil
 "Create a hydra with no body and the heads:
 
-\"\":`hydra-keyboard-quit',
 \"j\":`next-line',
 \"k\":`previous-line',
 \"q\":`nil'
@@ -468,7 +446,6 @@ Call the head: `previous-line'."
   (defun hydra-vi/nil nil
 "Create a hydra with no body and the heads:
 
-\"\":`hydra-keyboard-quit',
 \"j\":`next-line',
 \"k\":`previous-line',
 \"q\":`nil'
@@ -498,7 +475,6 @@ Call the head: `nil'."
   (defun hydra-vi/body nil
 "Create a hydra with no body and the heads:
 
-\"\":`hydra-keyboard-quit',
 \"j\":`next-line',
 \"k\":`previous-line',
 \"q\":`nil'
@@ -532,7 +508,6 @@ The body can be accessed via `hydra-vi/body'."
(defvar hydra-zoom/keymap nil
  "Keymap for hydra-zoom.")
(quote (keymap (114 . hydra-zoom/lambda-r)
-  (7 . hydra-keyboard-quit)
   (kp-subtract . hydra--negative-argument)
   (kp-9 . hydra--digit-argument)
   (kp-8 . hydra--digit-argument)
@@ -650,7 +625,6 @@ The body can be accessed via `hydra-zoom/body'."
(defvar hydra-zoom/keymap nil
  "Keymap for hydra-zoom.")
(quote (keymap (114 . hydra-zoom/lambda-r)
-  (7 . hydra-keyboard-quit)
   (kp-subtract . hydra--negative-argument)
   (kp-9 . hydra--digit-argument)
   (kp-8 . hydra--digit-argument)
@@ -1122,8 +1096,11 @@ _w_ Worf:  % -8`hydra-tng/worf^^
_h_ Set phasers to
 (kbd "C-c aabbaaqaabbaa")))
"jjkkjjaabbaa|"))
   (should (string= (hydra-with "|"
-   (execute-kbd-macro
-(kbd "C-c aabb C-g aaqaabbaa")))
+   (condition-case nil
+   (execute-kbd-macro
+(kb

[elpa] master 19cc1be 21/45: Use `unwind-protect' for :after-exit

2015-04-16 Thread Oleh Krehel
branch: master
commit 19cc1be6ffbe16a6c6b86ec202ffc83e614e451b
Author: Oleh Krehel 
Commit: Oleh Krehel 

Use `unwind-protect' for :after-exit

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

This change makes "C-g" work for this hydra:

(defhydra hydra-goto-line (global-map "M-g"
   :pre (linum-mode 1)
   :after-exit (linum-mode -1)
   :exit t)
  ("g" goto-line "line")
  ("c" goto-char "char"))

Re #90
---
 hydra.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hydra.el b/hydra.el
index bfb003b..3dd7459 100644
--- a/hydra.el
+++ b/hydra.el
@@ -579,8 +579,11 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
,@(when body-pre (list body-pre))
,@(if (memq color '(blue teal))
  `((hydra-keyboard-quit)
-   ,(when cmd `(call-interactively #',cmd))
-   ,@(when body-after-exit (list body-after-exit)))
+   ,(if body-after-exit
+`(unwind-protect
+  ,(when cmd `(call-interactively #',cmd))
+   ,body-after-exit)
+(when cmd `(call-interactively #',cmd
  (delq
   nil
   `(,(when cmd



[elpa] master d6e00ed 33/45: README.md: Add video demo link

2015-04-16 Thread Oleh Krehel
branch: master
commit d6e00edd63e056e60f0ab7db96875f818beb0770
Author: Oleh Krehel 
Commit: Oleh Krehel 

README.md: Add video demo link
---
 README.md |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md
index 172524e..7e7cf3f 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,8 @@ Hercules, besides vanquishing the Hydra, will still serve his 
original purpose,
 command.  This makes the Hydra very seamless, it's like a minor mode that 
disables itself
 auto-magically.
 
+If you want to quickly understand the concept, see [the video 
demo](https://www.youtube.com/watch?v=_qZliI1BKzI).
+
 
 **Table of Contents**
 



[elpa] master 0ae639f 22/45: Use a variable instead of a function for the hint

2015-04-16 Thread Oleh Krehel
branch: master
commit 0ae639f7bc3b7ef72bd5f6fcc57f89be8bdd9d37
Author: Oleh Krehel 
Commit: Oleh Krehel 

Use a variable instead of a function for the hint

* hydra.el (hydra--message): Remove.
(hydra--make-defun): Update.
(defhydra): Replace "defun foo/hint" with "defvar foo/hint".

This will allow to dynamically modify the hint in the future.

* hydra-test.el: Update tests.
---
 hydra-test.el |  450 ++---
 hydra.el  |   19 +--
 2 files changed, 247 insertions(+), 222 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 9fe3fb1..54da5d0 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -41,33 +41,35 @@
   (set
(defvar hydra-error/keymap nil
  "Keymap for hydra-error.")
-   (quote (keymap (32 . hydra-repeat)
-  (107 . hydra-error/previous-error)
-  (106 . hydra-error/next-error)
-  (104 . hydra-error/first-error)
-  (kp-subtract . hydra--negative-argument)
-  (kp-9 . hydra--digit-argument)
-  (kp-8 . hydra--digit-argument)
-  (kp-7 . hydra--digit-argument)
-  (kp-6 . hydra--digit-argument)
-  (kp-5 . hydra--digit-argument)
-  (kp-4 . hydra--digit-argument)
-  (kp-3 . hydra--digit-argument)
-  (kp-2 . hydra--digit-argument)
-  (kp-1 . hydra--digit-argument)
-  (kp-0 . hydra--digit-argument)
-  (57 . hydra--digit-argument)
-  (56 . hydra--digit-argument)
-  (55 . hydra--digit-argument)
-  (54 . hydra--digit-argument)
-  (53 . hydra--digit-argument)
-  (52 . hydra--digit-argument)
-  (51 . hydra--digit-argument)
-  (50 . hydra--digit-argument)
-  (49 . hydra--digit-argument)
-  (48 . hydra--digit-argument)
-  (45 . hydra--negative-argument)
-  (21 . hydra--universal-argument
+   (quote
+(keymap
+ (32 . hydra-repeat)
+ (107 . hydra-error/previous-error)
+ (106 . hydra-error/next-error)
+ (104 . hydra-error/first-error)
+ (kp-subtract . hydra--negative-argument)
+ (kp-9 . hydra--digit-argument)
+ (kp-8 . hydra--digit-argument)
+ (kp-7 . hydra--digit-argument)
+ (kp-6 . hydra--digit-argument)
+ (kp-5 . hydra--digit-argument)
+ (kp-4 . hydra--digit-argument)
+ (kp-3 . hydra--digit-argument)
+ (kp-2 . hydra--digit-argument)
+ (kp-1 . hydra--digit-argument)
+ (kp-0 . hydra--digit-argument)
+ (57 . hydra--digit-argument)
+ (56 . hydra--digit-argument)
+ (55 . hydra--digit-argument)
+ (54 . hydra--digit-argument)
+ (53 . hydra--digit-argument)
+ (52 . hydra--digit-argument)
+ (51 . hydra--digit-argument)
+ (50 . hydra--digit-argument)
+ (49 . hydra--digit-argument)
+ (48 . hydra--digit-argument)
+ (45 . hydra--negative-argument)
+ (21 . hydra--universal-argument
   (defun hydra-error/first-error nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -88,7 +90,11 @@ Call the head: `first-error'."
(message "%S" err)
(unless hydra-lv (sit-for 0.8
 (when hydra-is-helpful
-  (hydra-error/hint))
+  (if hydra-lv
+  (lv-message
+   (eval hydra-error/hint))
+(message
+ (eval hydra-error/hint
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -115,7 +121,11 @@ Call the head: `next-error'."
(message "%S" err)
(unless hydra-lv (sit-for 0.8
 (when hydra-is-helpful
-  (hydra-error/hint))
+  (if hydra-lv
+  (lv-message
+   (eval hydra-error/hint))
+(message
+ (eval hydra-error/hint
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -142,7 +152,11 @@ Call the head: `previous-error'."
(message "%S" err)
(unless hydra-lv (sit-for 0.8
 (when hydra-is-helpful
-  (hydra-error/hint))
+  (if hydra-lv
+  (lv-message
+   (eval hydra-error/hint))
+(message
+ (eval hydra-error/hint
 (hydra-set-transient-map
  hydra-error/keymap
  (lambda nil
@@ -164,22 +178,16 @@ Call the head: `previous-error'."
   (define-key global-map [134217831 107]
(function
 hydra-error/previous-error))
-  (defun hydra-error/hint nil
-(if hydra-lv
- 

[elpa] master 742d66a 44/45: hydra.el: Bump version

2015-04-16 Thread Oleh Krehel
branch: master
commit 742d66a63e86ac740e610faa5abba97e7f8ad5c2
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el: Bump version
---
 hydra.el |   34 +-
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/hydra.el b/hydra.el
index 1c19b79..27d48d5 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.12.1
+;; Version: 0.13.0
 ;; Keywords: bindings
 ;; Package-Requires: ((cl-lib "0.5"))
 
@@ -368,6 +368,12 @@ Return DEFAULT if PROP is not in H."
   (setq hydra--input-method-function input-method-function)
   (setq input-method-function nil
 
+(defvar hydra-timeout-timer (timer-create)
+  "Timer for `hydra-timeout'.")
+
+(defvar hydra-message-timer (timer-create)
+  "Timer for the hint.")
+
 (defun hydra-keyboard-quit ()
   "Quitting function similar to `keyboard-quit'."
   (interactive)
@@ -633,6 +639,16 @@ In duplicate HEADS, :cmd-name is modified to whatever they 
duplicate."
 lst
   (append lst (make-list (- n len) nil)
 
+(defmacro hydra-multipop (lst n)
+  "Return LST's first N elements while removing them."
+  `(if (<= (length ,lst) ,n)
+   (prog1 ,lst
+ (setq ,lst nil))
+ (prog1 ,lst
+   (setcdr
+(nthcdr (1- ,n) (prog1 ,lst (setq ,lst (nthcdr ,n ,lst
+nil
+
 (defun hydra--matrix (lst rows cols)
   "Create a matrix from elements of LST.
 The matrix size is ROWS times COLS."
@@ -709,12 +725,6 @@ NAMES should be defined by `defhydradio' or similar."
   (dolist (n names)
 (set n (aref (get n 'range) 0
 
-(defvar hydra-timeout-timer (timer-create)
-  "Timer for `hydra-timeout'.")
-
-(defvar hydra-message-timer (timer-create)
-  "Timer for the hint.")
-
 (defun hydra-idle-message (secs hint)
   "In SECS seconds display HINT."
   (cancel-timer hydra-message-timer)
@@ -969,16 +979,6 @@ DOC defaults to TOGGLE-NAME split and capitalized."
',(mapcar (lambda (h) (intern (format "%S/%S" name (car h
  heads
 
-(defmacro hydra-multipop (lst n)
-  "Return LST's first N elements while removing them."
-  `(if (<= (length ,lst) ,n)
-   (prog1 ,lst
- (setq ,lst nil))
- (prog1 ,lst
-   (setcdr
-(nthcdr (1- ,n) (prog1 ,lst (setq ,lst (nthcdr ,n ,lst
-nil
-
 (defun hydra--radio (parent head)
   "Generate a hydradio with PARENT from HEAD."
   (let* ((name (car head))



[elpa] master f972634 45/45: Merge commit '742d66a63e86ac740e610faa5abba97e7f8ad5c2' from hydra

2015-04-16 Thread Oleh Krehel
branch: master
commit f9726342d0783bb3442acb69eb850650fc186bfb
Merge: 22139ae 742d66a
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit '742d66a63e86ac740e610faa5abba97e7f8ad5c2' from hydra

Conflicts:
packages/hydra/hydra-test.el
packages/hydra/hydra.el
---
 packages/hydra/.travis.yml   |6 +-
 packages/hydra/Makefile  |1 +
 packages/hydra/README.md |   68 +-
 packages/hydra/hydra-test.el | 1518 ++
 packages/hydra/hydra.el  |  783 +++
 5 files changed, 1202 insertions(+), 1174 deletions(-)

diff --git a/packages/hydra/.travis.yml b/packages/hydra/.travis.yml
index 1f5dbc7..e97acdb 100644
--- a/packages/hydra/.travis.yml
+++ b/packages/hydra/.travis.yml
@@ -1,12 +1,14 @@
 language: emacs-lisp
 env:
   matrix:
-- EMACS=emacs24
+- emacs=emacs24
+- emacs=emacs-snapshot
 
 before_install:
   - sudo add-apt-repository -y ppa:cassou/emacs
+  - sudo add-apt-repository -y ppa:ubuntu-elisp
   - sudo apt-get update -qq
-  - sudo apt-get install -qq $EMACS
+  - sudo apt-get install -qq $emacs
 
 script:
   - make test
diff --git a/packages/hydra/Makefile b/packages/hydra/Makefile
index 35709e1..43bcb5a 100644
--- a/packages/hydra/Makefile
+++ b/packages/hydra/Makefile
@@ -8,6 +8,7 @@ LOAD = -l lv.el -l hydra.el -l hydra-test.el
 all: test
 
 test:
+   @echo "Using $(shell which $(emacs))..."
$(emacs) -batch $(LOAD) -f ert-run-tests-batch-and-exit
 
 compile:
diff --git a/packages/hydra/README.md b/packages/hydra/README.md
index 172524e..d2237d8 100644
--- a/packages/hydra/README.md
+++ b/packages/hydra/README.md
@@ -5,6 +5,8 @@ bindings with a common prefix - a Hydra.
 
 ![hydra](http://oremacs.com/download/Hydra.jpg)
 
+## Description for Poets
+
 Once you summon the Hydra through the prefixed binding (the body + any one 
head), all heads can be
 called in succession with only a short extension.
 
@@ -13,6 +15,22 @@ Hercules, besides vanquishing the Hydra, will still serve 
his original purpose,
 command.  This makes the Hydra very seamless, it's like a minor mode that 
disables itself
 auto-magically.
 
+## Description for Pragmatics
+
+Imagine that you have bound C-c j and C-c k in your
+config.  You want to call C-c j and C-c k in some
+(arbitrary) sequence. Hydra allows you to:
+
+- Bind your functions in a way that pressing C-c jjkk3j5k is
+equivalent to pressing C-c j C-c j C-c k C-c k M-3 C-c j M-5 C-c
+k. Any key other than j or k exits this state.
+
+- Assign a custom hint to this group of functions, so that you know immediately
+after pressing C-c that you can follow up with j or
+k.
+
+If you want to quickly understand the concept, see [the video 
demo](https://www.youtube.com/watch?v=_qZliI1BKzI).
+
 
 **Table of Contents**
 
@@ -158,41 +176,21 @@ Here's what `hydra-zoom/body` looks like, if you're 
interested:
 
 The body can be accessed via `hydra-zoom/body'."
   (interactive)
-  (hydra-disable)
-  (catch (quote hydra-disable)
-(when hydra-is-helpful (hydra-zoom/hint))
-(setq hydra-last
-  (hydra-set-transient-map
-   (setq hydra-curr-map
- (quote
-  (keymap (7 . hydra-keyboard-quit)
-  (108 . hydra-zoom/text-scale-decrease)
-  (103 . hydra-zoom/text-scale-increase)
-  (kp-subtract . hydra--negative-argument)
-  (kp-9 . hydra--digit-argument)
-  (kp-8 . hydra--digit-argument)
-  (kp-7 . hydra--digit-argument)
-  (kp-6 . hydra--digit-argument)
-  (kp-5 . hydra--digit-argument)
-  (kp-4 . hydra--digit-argument)
-  (kp-3 . hydra--digit-argument)
-  (kp-2 . hydra--digit-argument)
-  (kp-1 . hydra--digit-argument)
-  (kp-0 . hydra--digit-argument)
-  (57 . hydra--digit-argument)
-  (56 . hydra--digit-argument)
-  (55 . hydra--digit-argument)
-  (54 . hydra--digit-argument)
-  (53 . hydra--digit-argument)
-  (52 . hydra--digit-argument)
-  (51 . hydra--digit-argument)
-  (50 . hydra--digit-argument)
-  (49 . hydra--digit-argument)
-  (48 . hydra--digit-argument)
-  (45 . hydra--negative-argument)
-  (21 . hydra--universal-argument
-   t (lambda nil (hydra-cleanup
-(setq prefix-arg current-prefix-arg)))
+  (hydra-default-pre)
+  (when hydra-is-helpful
+(if hydra-lv
+(lv-message
+ (eval hydra-zoom/hint))
+  (message
+   (eval hydra-zoom/hint
+  (hydra-set-transient-map
+   hydra-zo

[elpa] master 51e7753 19/45: Alias :post to :before-exit, and add :after-exit

2015-04-16 Thread Oleh Krehel
branch: master
commit 51e7753aea5aded93ec6a8010935ff5bfcf27b31
Author: Oleh Krehel 
Commit: Oleh Krehel 

Alias :post to :before-exit, and add :after-exit

* hydra.el (hydra--make-defun): Update.
(hydra--make-funcall): Update doc.
(defhydra): Update.

Re #90
---
 hydra.el |   38 +++---
 1 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/hydra.el b/hydra.el
index c9ef2da..fcfe367 100644
--- a/hydra.el
+++ b/hydra.el
@@ -551,13 +551,15 @@ HEADS is a list of heads."
(format "The body can be accessed via `%S'." body-name)))
 
 (defun hydra--make-defun (name body doc head
-  keymap body-pre body-post &optional other-post)
+  keymap body-pre body-before-exit
+  &optional body-after-exit)
   "Make a defun wrapper, using NAME, BODY, DOC, HEAD, and KEYMAP.
 NAME and BODY are the arguments to `defhydra'.
 DOC was generated with `hydra--doc'.
 HEAD is one of the HEADS passed to `defhydra'.
-BODY-PRE and BODY-POST are pre-processed in `defhydra'.
-OTHER-POST is an optional extension to the :post key of BODY."
+BODY-PRE is added to the start of the wrapper.
+BODY-BEFORE-EXIT will be called before the hydra quits.
+BODY-AFTER-EXIT is added to the end of the wrapper."
   (let ((name (hydra--head-name head name body))
 (cmd (when (car head)
(hydra--make-callable
@@ -577,7 +579,8 @@ OTHER-POST is an optional extension to the :post key of 
BODY."
,@(when body-pre (list body-pre))
,@(if (memq color '(blue teal))
  `((hydra-keyboard-quit)
-   ,(when cmd `(call-interactively #',cmd)))
+   ,(when cmd `(call-interactively #',cmd))
+   ,@(when body-after-exit (list body-after-exit)))
  (delq
   nil
   `(,(when cmd
@@ -591,7 +594,7 @@ OTHER-POST is an optional extension to the :post key of 
BODY."
(,hint))
  (hydra-set-transient-map
   ,keymap
-  (lambda () (hydra-keyboard-quit) ,body-post)
+  (lambda () (hydra-keyboard-quit) ,body-before-exit)
   ,(cond
 ((memq body-color '(amaranth teal))
  ''warn)
@@ -599,12 +602,12 @@ OTHER-POST is an optional extension to the :post key of 
BODY."
  ''run)
 (t
  nil)))
- ,(or other-post
-  (when body-timeout
-`(hydra-timeout ,body-timeout)
+ ,body-after-exit
+ ,(when body-timeout
+`(hydra-timeout ,body-timeout
 
 (defmacro hydra--make-funcall (sym)
-  "Transform SYM into a `funcall' that calls it."
+  "Transform SYM into a `funcall' to call it."
   `(when (and ,sym (symbolp ,sym))
  (setq ,sym `(funcall #',,sym
 
@@ -762,7 +765,7 @@ BODY-MAP is a keymap; `global-map' is used quite often.  
Each
 function generated from HEADS will be bound in BODY-MAP to
 BODY-KEY + KEY (both are strings passed to `kbd'), and will set
 the transient map so that all following heads can be called
-though KEY only. BODY-KEY can be an empty string.
+though KEY only.  BODY-KEY can be an empty string.
 
 CMD is a callable expression: either an interactive function
 name, or an interactive lambda, or a single sexp (it will be
@@ -807,9 +810,12 @@ result of `defhydra'."
(plist-get body-plist :bind)))
  (body-pre (plist-get body-plist :pre))
  (body-body-pre (plist-get body-plist :body-pre))
- (body-post (plist-get body-plist :post))
+ (body-before-exit (or (plist-get body-plist :post)
+   (plist-get body-plist :before-exit)))
+ (body-after-exit (plist-get body-plist :after-exit))
  (body-color (hydra--body-color body)))
-(hydra--make-funcall body-post)
+(hydra--make-funcall body-before-exit)
+(hydra--make-funcall body-after-exit)
 (dolist (h heads)
   (let ((len (length h)))
 (cond ((< len 2)
@@ -862,7 +868,9 @@ result of `defhydra'."
  ,@(mapcar
 (lambda (head)
   (hydra--make-defun name body doc head keymap-name
- body-pre body-post))
+ body-pre
+ body-before-exit
+ body-after-exit))
 heads-nodup)
  ;; free up keymap prefix
  ,@(unless (or (null body-key)
@@ -891,14 +899,14 @@ result of `defhydra'."
 t))
  `(define-key ,bind ,final-key (function 
,name)))
 (t
- (error "Invalid :bind property `%S' for head 
%S" bind  head)))
+ (error "In

[elpa] master 97c9b9b 32/45: Move `this-command' setter

2015-04-16 Thread Oleh Krehel
branch: master
commit 97c9b9b64c59e2b4314cef62549ebac3ad8c140e
Author: Oleh Krehel 
Commit: Oleh Krehel 

Move `this-command' setter

* hydra.el (hydra--call-interactively): New defun.
(hydra--make-defun): Update.

Re #79
---
 hydra-test.el |   90 ++--
 hydra.el  |   29 --
 2 files changed, 67 insertions(+), 52 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 28b4519..267ccad 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -105,8 +105,11 @@ Call the head: `first-error'."
 (interactive)
 (hydra-default-pre)
 (condition-case err
-(call-interactively
- (function first-error))
+(progn
+  (setq this-command
+(quote first-error))
+  (call-interactively
+   (function first-error)))
   ((quit error)
(message "%S" err)
(unless hydra-lv (sit-for 0.8
@@ -121,9 +124,7 @@ Call the head: `first-error'."
  (lambda nil
(hydra-keyboard-quit)
nil)
- nil)
-(setq this-command
-  (quote first-error)))
+ nil))
   (defun hydra-error/next-error nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -138,8 +139,11 @@ Call the head: `next-error'."
 (interactive)
 (hydra-default-pre)
 (condition-case err
-(call-interactively
- (function next-error))
+(progn
+  (setq this-command
+(quote next-error))
+  (call-interactively
+   (function next-error)))
   ((quit error)
(message "%S" err)
(unless hydra-lv (sit-for 0.8
@@ -154,9 +158,7 @@ Call the head: `next-error'."
  (lambda nil
(hydra-keyboard-quit)
nil)
- nil)
-(setq this-command
-  (quote next-error)))
+ nil))
   (defun hydra-error/previous-error nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -171,8 +173,11 @@ Call the head: `previous-error'."
 (interactive)
 (hydra-default-pre)
 (condition-case err
-(call-interactively
- (function previous-error))
+(progn
+  (setq this-command
+(quote previous-error))
+  (call-interactively
+   (function previous-error)))
   ((quit error)
(message "%S" err)
(unless hydra-lv (sit-for 0.8
@@ -187,9 +192,7 @@ Call the head: `previous-error'."
  (lambda nil
(hydra-keyboard-quit)
nil)
- nil)
-(setq this-command
-  (quote previous-error)))
+ nil))
   (unless (keymapp
(lookup-key
 global-map
@@ -315,11 +318,12 @@ Call the head: `toggle-truncate-lines'."
 (interactive)
 (hydra-default-pre)
 (hydra-keyboard-quit)
-(call-interactively
- (function
-  toggle-truncate-lines))
-(setq this-command
-  (quote toggle-truncate-lines)))
+(progn
+  (setq this-command
+(quote toggle-truncate-lines))
+  (call-interactively
+   (function
+toggle-truncate-lines
   (defun hydra-toggle/auto-fill-mode-and-exit nil
 "Create a hydra with no body and the heads:
 
@@ -334,10 +338,11 @@ Call the head: `auto-fill-mode'."
 (interactive)
 (hydra-default-pre)
 (hydra-keyboard-quit)
-(call-interactively
- (function auto-fill-mode))
-(setq this-command
-  (quote auto-fill-mode)))
+(progn
+  (setq this-command
+(quote auto-fill-mode))
+  (call-interactively
+   (function auto-fill-mode
   (defun hydra-toggle/abbrev-mode-and-exit nil
 "Create a hydra with no body and the heads:
 
@@ -352,10 +357,11 @@ Call the head: `abbrev-mode'."
 (interactive)
 (hydra-default-pre)
 (hydra-keyboard-quit)
-(call-interactively
- (function abbrev-mode))
-(setq this-command
-  (quote abbrev-mode)))
+(progn
+  (setq this-command
+(quote abbrev-mode))
+  (call-interactively
+   (function abbrev-mode
   (defun hydra-toggle/nil nil
 "Create a hydra with no body and the heads:
 
@@ -369,8 +375,7 @@ The body can be accessed via `hydra-toggle/body'.
 Call the head: `nil'."
 (interactive)
 (hydra-default-pre)
-(hydra-keyboard-quit)
-nil)
+(hydra-keyboard-quit))
   (set
(defvar hydra-toggle/hint nil
  "Dynamic hint for hydra-toggle.")
@@ -477,8 +482,11 @@ Call the head: `next-line'."
 (hydra-default-pre)
 (set-cursor-col

[elpa] master d71386b 29/45: hydra.el (hydra--head-color): Simplify

2015-04-16 Thread Oleh Krehel
branch: master
commit d71386b0f58929c7bc35374bc25b6b8e967acef9
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--head-color): Simplify

* hydra.el (hydra-face-red):
(hydra-face-blue):
(hydra-face-amaranth):
(hydra-face-pink):
(hydra-face-teal): Improve docstrings.
(hydra--head-color): Simplify.
(defhydra): Use copy-sequence on inherited heads. Move :cmd-name setting
to the very end, when :exit is already set.

* hydra-test.el: Update tests.
---
 hydra-test.el |   22 +
 hydra.el  |   93 +---
 2 files changed, 37 insertions(+), 78 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 23616ee..635a53f 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -450,7 +450,7 @@ The body can be accessed via `hydra-toggle/body'."
   previous-line
   ""
   :exit nil)
- ("q" nil "quit" :exit nil
+ ("q" nil "quit" :exit t
   (defun hydra-vi/next-line nil
 "Create a hydra with no body and the heads:
 
@@ -534,7 +534,7 @@ Call the head: `nil'."
  #("vi: j, k, [q]: quit."
4 5 (face hydra-face-amaranth)
7 8 (face hydra-face-amaranth)
-   11 12 (face hydra-face-blue)
+   11 12 (face hydra-face-teal)
   (defun hydra-vi/body nil
 "Create a hydra with no body and the heads:
 
@@ -963,7 +963,7 @@ _f_ auto-fill-mode:%`auto-fill-function
'(concat (format "%s abbrev-mode:   %S
 %s debug-on-error:%S
 %s auto-fill-mode:%S
-" "{a}" abbrev-mode "{d}" debug-on-error "{f}" auto-fill-function) "[[q]]: 
quit"
+" "{a}" abbrev-mode "{d}" debug-on-error "{f}" auto-fill-function) "[{q}]: 
quit"
 
 (ert-deftest hydra-format-2 ()
   (should (equal
@@ -973,8 +973,8 @@ _f_ auto-fill-mode:%`auto-fill-function
   'bar
   nil
   "\n  bar %s`foo\n"
-  '(("a" (quote t) "" :cmd-name bar/lambda-a)
-("q" nil "" :cmd-name bar/nil
+  '(("a" (quote t) "" :cmd-name bar/lambda-a :exit nil)
+("q" nil "" :cmd-name bar/nil :exit t
'(concat (format "  bar %s\n" foo) "{a}, [q]"
 
 (ert-deftest hydra-format-3 ()
@@ -1006,7 +1006,7 @@ _f_ auto-fill-mode:%`auto-fill-function
  (hydra--format
   'hydra-toggle nil
   "\n_n_ narrow-or-widen-dwim %(progn (message 
\"checking\")(buffer-narrowed-p))asdf\n"
-  '(("n" narrow-to-region nil) ("q" nil "cancel"
+  '(("n" narrow-to-region nil) ("q" nil "cancel" :exit t
'(concat (format "%s narrow-or-widen-dwim %Sasdf\n"
  "{n}"
  (progn
@@ -1021,7 +1021,7 @@ _f_ auto-fill-mode:%`auto-fill-function
  (hydra--format
   'hydra-toggle nil
   "\n_n_ narrow-or-widen-dwim %s(progn (message 
\"checking\")(buffer-narrowed-p))asdf\n"
-  '(("n" narrow-to-region nil) ("q" nil "cancel"
+  '(("n" narrow-to-region nil) ("q" nil "cancel" :exit t
'(concat (format "%s narrow-or-widen-dwim %sasdf\n"
  "{n}"
  (progn
@@ -1031,7 +1031,7 @@ _f_ auto-fill-mode:%`auto-fill-function
 
 (ert-deftest hydra-compat-colors-1 ()
   (should (equal (hydra--head-color
-  '("e" (message "Exiting now") "blue")
+  '("e" (message "Exiting now") "blue" :exit t)
   '(nil nil :color blue))
  'blue))
   (should (equal (hydra--head-color
@@ -1039,10 +1039,6 @@ _f_ auto-fill-mode:%`auto-fill-function
   '(nil nil :color blue))
  'red))
   (should (equal (hydra--head-color
-  '("e" (message "Exiting now") "blue")
-  '(nil nil :exit t))
- 'blue))
-  (should (equal (hydra--head-color
   '("j" next-line "" :exit t)
   '(nil nil))
  'blue))
@@ -1051,7 +1047,7 @@ _f_ auto-fill-mode:%`auto-fill-function
   '(nil nil :exit t))
  'red))
   (equal (hydra--head-color
-  '("a" abbrev-mode nil)
+  '("a" abbrev-mode nil :exit t)
   '(nil nil :color teal))
  'teal)
   (equal (hydra--head-color
diff --git a/hydra.el b/hydra.el
index 15ef310..61d4d4a 100644
--- a/hydra.el
+++ b/hydra.el
@@ -178,27 +178,29 @@ When nil, you can specify your own at each location like 
this: _ 5a_.")
 
 (defface hydra-face-red
 '((t (:foreground "#FF" :bold t)))
-  "Red Hydra heads will persist indefinitely."
+  "Red Hydra heads don't exit the Hydra.
+Every other command exits the Hydra."
   :group 'hydra)
 
 (defface hydra-face-blue
 '((t (:foreground "#FF" :bold t)))
-  "Blue Hydra heads will vanquish the Hydra.")
+  "Blue Hydra heads exit the Hydra.
+Every other command exits as w

[elpa] master f01c87e 38/45: Fix red heads not exiting temporarily

2015-04-16 Thread Oleh Krehel
branch: master
commit f01c87e37c9646a3b32fbe1c390c6f94b8c153a8
Author: Oleh Krehel 
Commit: Oleh Krehel 

Fix red heads not exiting temporarily

* hydra.el (hydra--ignore): New defvar.
(hydra-disable): Don't call :post unless `hydra--ignore' is nil.
(hydra--make-defun): Temporarily disable transient map before calling
the command.

Fixes #109
---
 hydra-test.el |   24 
 hydra.el  |   40 +++-
 2 files changed, 47 insertions(+), 17 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 267ccad..7d361e6 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -104,6 +104,8 @@ The body can be accessed via `hydra-error/body'.
 Call the head: `first-error'."
 (interactive)
 (hydra-default-pre)
+(let ((hydra--ignore t))
+  (hydra-keyboard-quit))
 (condition-case err
 (progn
   (setq this-command
@@ -138,6 +140,8 @@ The body can be accessed via `hydra-error/body'.
 Call the head: `next-error'."
 (interactive)
 (hydra-default-pre)
+(let ((hydra--ignore t))
+  (hydra-keyboard-quit))
 (condition-case err
 (progn
   (setq this-command
@@ -172,6 +176,8 @@ The body can be accessed via `hydra-error/body'.
 Call the head: `previous-error'."
 (interactive)
 (hydra-default-pre)
+(let ((hydra--ignore t))
+  (hydra-keyboard-quit))
 (condition-case err
 (progn
   (setq this-command
@@ -229,6 +235,8 @@ Call the head: `previous-error'."
 The body can be accessed via `hydra-error/body'."
 (interactive)
 (hydra-default-pre)
+(let ((hydra--ignore nil))
+  (hydra-keyboard-quit))
 (when hydra-is-helpful
   (if hydra-lv
   (lv-message
@@ -397,6 +405,8 @@ Call the head: `nil'."
 The body can be accessed via `hydra-toggle/body'."
 (interactive)
 (hydra-default-pre)
+(let ((hydra--ignore nil))
+  (hydra-keyboard-quit))
 (when hydra-is-helpful
   (if hydra-lv
   (lv-message
@@ -481,6 +491,8 @@ Call the head: `next-line'."
 (interactive)
 (hydra-default-pre)
 (set-cursor-color "#e52b50")
+(let ((hydra--ignore t))
+  (hydra-keyboard-quit))
 (condition-case err
 (progn
   (setq this-command
@@ -514,6 +526,8 @@ Call the head: `previous-line'."
 (interactive)
 (hydra-default-pre)
 (set-cursor-color "#e52b50")
+(let ((hydra--ignore t))
+  (hydra-keyboard-quit))
 (condition-case err
 (progn
   (setq this-command
@@ -568,6 +582,8 @@ The body can be accessed via `hydra-vi/body'."
 (interactive)
 (hydra-default-pre)
 (set-cursor-color "#e52b50")
+(let ((hydra--ignore nil))
+  (hydra-keyboard-quit))
 (when hydra-is-helpful
   (if hydra-lv
   (lv-message
@@ -651,6 +667,8 @@ The body can be accessed via `hydra-zoom/body'.
 Call the head: `(text-scale-set 0)'."
 (interactive)
 (hydra-default-pre)
+(let ((hydra--ignore t))
+  (hydra-keyboard-quit))
 (condition-case err
 (call-interactively
  (function
@@ -708,6 +726,8 @@ Call the head: `(text-scale-set 0)'."
 The body can be accessed via `hydra-zoom/body'."
 (interactive)
 (hydra-default-pre)
+(let ((hydra--ignore nil))
+  (hydra-keyboard-quit))
 (when hydra-is-helpful
   (if hydra-lv
   (lv-message
@@ -792,6 +812,8 @@ The body can be accessed via `hydra-zoom/body'.
 Call the head: `(text-scale-set 0)'."
 (interactive)
 (hydra-default-pre)
+(let ((hydra--ignore t))
+  (hydra-keyboard-quit))
 (condition-case err
 (call-interactively
  (function
@@ -849,6 +871,8 @@ Call the head: `(text-scale-set 0)'."
 The body can be accessed via `hydra-zoom/body'."
 (interactive)
 (hydra-default-pre)
+(let ((hydra--ignore nil))
+  (hydra-keyboard-quit))
 (when hydra-is-helpful
   (if hydra-lv
   (lv-message
diff --git a/hydra.el b/hydra.el
index 970716f..e370dbc 100644
--- a/hydra.el
+++ b/hydra.el
@@ -120,6 +120,9 @@ warn: keep KEYMAP and issue a warning instead of running 
the command."
 (t nil)
 (hydra-disable)))
 
+(defvar hydra--ignore nil
+  "When non-nil, don't call `hydra-curr-on-exit'")
+
 (defun hydra-disable ()
   "Disable the current Hydra."
   (remove-hook 'pre-command-hook 'hydra--clearfun)
@@ -127,10 +130,11 @@ warn: keep KEYMAP and issue a warning instead of running 
the command."
 (with-selected-frame frame
   (when overriding-terminal-local-map
 (internal-pop-keymap hydra-curr-map 'overriding-terminal-loca

[elpa] master 00aef59 40/45: hydra.el (hydra--format): Fix "s-t" issue

2015-04-16 Thread Oleh Krehel
branch: master
commit 00aef5927c3a8ec07c70fe535a5414bf8a879b6f
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--format): Fix "s-t" issue

* hydra.el (hydra--format): Update.

Fixes #107.
---
 hydra.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hydra.el b/hydra.el
index e370dbc..0ce5e44 100644
--- a/hydra.el
+++ b/hydra.el
@@ -460,7 +460,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))



[elpa] master 2f07e50 26/45: Account for digit argument

2015-04-16 Thread Oleh Krehel
branch: master
commit 2f07e509399ade82366b31a688595a12f326b469
Author: Oleh Krehel 
Commit: Oleh Krehel 

Account for digit argument

* hydra.el (hydra--clearfun): Update. digit-argument will modify
  this-command-keys-vector, but not this-single-command-keys.

Fixes #104
---
 hydra.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hydra.el b/hydra.el
index 1397035..0d219e3 100644
--- a/hydra.el
+++ b/hydra.el
@@ -111,7 +111,7 @@ warn: keep KEYMAP and issue a warning instead of running 
the command."
keyboard-quit))
   (hydra-disable)
 (unless (eq this-command
-(lookup-key hydra-curr-map (this-command-keys-vector)))
+(lookup-key hydra-curr-map (this-single-command-keys)))
   (unless (cl-case hydra-curr-foreign-keys
 (warn
  (setq this-command 'hydra-amaranth-warn))



[elpa] master b2c9ea6 36/45: README.md: Update intro

2015-04-16 Thread Oleh Krehel
branch: master
commit b2c9ea6f9969f09b4d686e350a232f566710b3b2
Author: Oleh Krehel 
Commit: Oleh Krehel 

README.md: Update intro
---
 README.md |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md
index 7e7cf3f..babcf9b 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,8 @@ bindings with a common prefix - a Hydra.
 
 ![hydra](http://oremacs.com/download/Hydra.jpg)
 
+## Description for Poets
+
 Once you summon the Hydra through the prefixed binding (the body + any one 
head), all heads can be
 called in succession with only a short extension.
 
@@ -13,6 +15,20 @@ Hercules, besides vanquishing the Hydra, will still serve 
his original purpose,
 command.  This makes the Hydra very seamless, it's like a minor mode that 
disables itself
 auto-magically.
 
+## Description for Pragmatics
+
+Imagine that you have bound C-c j and C-c k in your
+config.  You want to call C-c j and C-c k in some
+(arbitrary) sequence. Hydra allows you to:
+
+- Bind your functions in a way that pressing C-c jjkk3j5k is
+equivalent to pressing C-c j C-c j C-c k C-c k M-3 C-c j M-5 C-c
+k. Any key other than j or k exits this state.
+
+- Assign a custom hint to this group of functions, so that you know immediately
+after pressing C-c that you can follow up with j or
+k.
+
 If you want to quickly understand the concept, see [the video 
demo](https://www.youtube.com/watch?v=_qZliI1BKzI).
 
 



[elpa] master cb630df 16/45: Update the tests for the new `hydra-set-transient-map'

2015-04-16 Thread Oleh Krehel
branch: master
commit cb630dfacc7632a79e406344c61ede43aafad660
Author: Oleh Krehel 
Commit: Oleh Krehel 

Update the tests for the new `hydra-set-transient-map'

* hydra-test.el (hydra-red-error): Update.
(hydra-blue-toggle): Update.
(hydra-amaranth-vi): Update.
(hydra-zoom-duplicate-1): Update.
(hydra-zoom-duplicate-2): Update.

Re #90
---
 hydra-test.el |  855 +
 1 files changed, 489 insertions(+), 366 deletions(-)

diff --git a/hydra-test.el b/hydra-test.el
index 2dd5883..d079451 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -38,13 +38,14 @@
("k" previous-error "prev")
("SPC" hydra-repeat "rep" :bind nil)))
 '(progn
-  (set (defvar hydra-error/keymap nil "Keymap for hydra-error.")
-   (quote (keymap (7 . hydra-keyboard-quit)
-  (32 . hydra-repeat)
+  (set
+   (defvar hydra-error/keymap nil
+ "Keymap for hydra-error.")
+   (quote (keymap (32 . hydra-repeat)
   (107 . hydra-error/previous-error)
   (106 . hydra-error/next-error)
   (104 . hydra-error/first-error)
-  (switch-frame . hydra--handle-switch-frame)
+  (7 . hydra-keyboard-quit)
   (kp-subtract . hydra--negative-argument)
   (kp-9 . hydra--digit-argument)
   (kp-8 . hydra--digit-argument)
@@ -68,7 +69,8 @@
   (48 . hydra--digit-argument)
   (45 . hydra--negative-argument)
   (21 . hydra--universal-argument
-  (defun hydra-error/first-error nil "Create a hydra with a \"M-g\" body 
and the heads:
+  (defun hydra-error/first-error nil
+"Create a hydra with a \"M-g\" body and the heads:
 
 \"h\":`first-error',
 \"j\":`next-error',
@@ -78,18 +80,24 @@
 The body can be accessed via `hydra-error/body'.
 
 Call the head: `first-error'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
-   (condition-case err (call-interactively (function first-error))
- ((quit error)
-  (message "%S" err)
-  (unless hydra-lv (sit-for 0.8
-   (when hydra-is-helpful (hydra-error/hint))
-   (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map 
hydra-error/keymap)
- t (lambda nil 
(hydra-keyboard-quit))
-  (defun hydra-error/next-error nil "Create a hydra with a \"M-g\" body 
and the heads:
+(interactive)
+(hydra-default-pre)
+(condition-case err
+(call-interactively
+ (function first-error))
+  ((quit error)
+   (message "%S" err)
+   (unless hydra-lv (sit-for 0.8
+(when hydra-is-helpful
+  (hydra-error/hint))
+(hydra-set-transient-map
+ hydra-error/keymap
+ (lambda nil
+   (hydra-keyboard-quit)
+   nil)
+ nil))
+  (defun hydra-error/next-error nil
+"Create a hydra with a \"M-g\" body and the heads:
 
 \"h\":`first-error',
 \"j\":`next-error',
@@ -99,18 +107,24 @@ Call the head: `first-error'."
 The body can be accessed via `hydra-error/body'.
 
 Call the head: `next-error'."
- (interactive)
- (hydra-default-pre)
- (hydra-disable)
- (catch (quote hydra-disable)
-   (condition-case err (call-interactively (function next-error))
- ((quit error)
-  (message "%S" err)
-  (unless hydra-lv (sit-for 0.8
-   (when hydra-is-helpful (hydra-error/hint))
-   (setq hydra-last (hydra-set-transient-map (setq hydra-curr-map 
hydra-error/keymap)
- t (lambda nil 
(hydra-keyboard-quit))
-  (defun hydra-error/previous-error nil "Create a hydra with a \"M-g\" 
body and the heads:
+(interactive)
+(hydra-default-pre)
+(condition-case err
+(call-interactively
+ (function next-error))
+  ((quit error)
+   (message "%S" err)
+   (unless hydra-lv (sit-for 0.8
+(when hydra-is-helpful
+  (hydra-error/hint))
+(hydra-set-transient-map
+ hydra-error/keymap
+ (lambda nil
+   (hydra-keyboard-quit)
+   nil)
+ nil))
+  (defun hydra-error/previous-error nil
+"Create a hydra with a \"M-g\" body and the heads:
 
 \"h\":`first-error',
 \"j\":`next-error',
@@ -120,36 +134,55 @@ Call the head: `next-error'."
 The body can be accessed via `hydra-error/body'.
 
 Call the head: `previous-error'."
- (interactive)
- (hydra-default-pre)
-  

[elpa] master 3d7d8c7 20/45: Add basic error handling

2015-04-16 Thread Oleh Krehel
branch: master
commit 3d7d8c764f99879987e11a3ead5c81ed70ddb04e
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add basic error handling

* hydra.el (defhydra): When the macro fails, message an error and
  continue as if the defhydra call wasn't there.
---
 hydra.el |  218 +++--
 1 files changed, 111 insertions(+), 107 deletions(-)

diff --git a/hydra.el b/hydra.el
index fcfe367..bfb003b 100644
--- a/hydra.el
+++ b/hydra.el
@@ -801,113 +801,117 @@ result of `defhydra'."
  (setq docstring "hydra")))
   (when (keywordp (car body))
 (setq body (cons nil (cons nil body
-  (let* ((keymap (copy-keymap hydra-base-map))
- (keymap-name (intern (format "%S/keymap" name)))
- (body-name (intern (format "%S/body" name)))
- (body-key (cadr body))
- (body-plist (cddr body))
- (body-map (or (car body)
-   (plist-get body-plist :bind)))
- (body-pre (plist-get body-plist :pre))
- (body-body-pre (plist-get body-plist :body-pre))
- (body-before-exit (or (plist-get body-plist :post)
-   (plist-get body-plist :before-exit)))
- (body-after-exit (plist-get body-plist :after-exit))
- (body-color (hydra--body-color body)))
-(hydra--make-funcall body-before-exit)
-(hydra--make-funcall body-after-exit)
-(dolist (h heads)
-  (let ((len (length h)))
-(cond ((< len 2)
-   (error "Each head should have at least two items: %S" h))
-  ((= len 2)
-   (setcdr (cdr h)
-   (list
-(hydra-plist-get-default body-plist :hint "")))
-   (setcdr (nthcdr 2 h)
-   (list :cmd-name (hydra--head-name h name body
-  (t
-   (let ((hint (cl-caddr h)))
- (unless (or (null hint)
- (stringp hint))
-   (setcdr (cdr h) (cons
-(hydra-plist-get-default body-plist :hint 
"")
-(cddr h
- (let ((hint-and-plist (cddr h)))
-   (if (null (cdr hint-and-plist))
-   (setcdr hint-and-plist
-   (list :cmd-name
- (hydra--head-name h name body)))
- (plist-put (cdr hint-and-plist)
-:cmd-name
-(hydra--head-name h name body)
-(let ((doc (hydra--doc body-key body-name heads))
-  (heads-nodup (hydra--delete-duplicates heads)))
-  (mapc
-   (lambda (x)
- (define-key keymap (kbd (car x))
-   (plist-get (cl-cdddr x) :cmd-name)))
-   heads)
-  (hydra--make-funcall body-pre)
-  (hydra--make-funcall body-body-pre)
-  (when (memq body-color '(amaranth pink))
-(unless (cl-some
- (lambda (h)
-   (memq (hydra--head-color h body) '(blue teal)))
- heads)
-  (error
-   "An %S Hydra must have at least one blue head in order to exit"
-   body-color)))
-  `(progn
- ;; create keymap
- (set (defvar ,keymap-name
-nil
-,(format "Keymap for %S." name))
-  ',keymap)
- ;; create defuns
- ,@(mapcar
-(lambda (head)
-  (hydra--make-defun name body doc head keymap-name
- body-pre
- body-before-exit
- body-after-exit))
-heads-nodup)
- ;; free up keymap prefix
- ,@(unless (or (null body-key)
-   (null body-map)
-   (hydra--callablep body-map))
-   `((unless (keymapp (lookup-key ,body-map (kbd ,body-key)))
-   (define-key ,body-map (kbd ,body-key) nil
- ;; bind keys
- ,@(delq nil
- (mapcar
-  (lambda (head)
-(let ((name (hydra--head-property head :cmd-name)))
-  (when (and (cadr head)
- (or body-key body-map))
-(let ((bind (hydra--head-property head :bind body-map))
-  (final-key
-   (if body-key
-   (vconcat (kbd body-key) (kbd (car head)))
- (kbd (car head)
-  (cond ((null bind) nil)
-((hydra--callablep bind)
- `(funcall ,bind ,final-key (function ,name)))
-((and (symbolp bind)
-  (if (boundp bind)
-  (keymapp (symbol-va

[elpa] master b351b7c 24/45: hydra.el (hydra--body-color): Remove

2015-04-16 Thread Oleh Krehel
branch: master
commit b351b7cfb2284c0d6a11e1bf4f10d7c8ef0debb2
Author: Oleh Krehel 
Commit: Oleh Krehel 

hydra.el (hydra--body-color): Remove

* hydra.el (hydra--head-color): Update.
(hydra--make-defun): Update.
(defhydra): Update.
---
 hydra.el |   72 +++--
 1 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/hydra.el b/hydra.el
index e5152c0..599ad47 100644
--- a/hydra.el
+++ b/hydra.el
@@ -319,37 +319,45 @@ Return DEFAULT if PROP is not in H."
 
 (defun hydra--head-color (h body)
   "Return the color of a Hydra head H with BODY."
-  (let* ((exit (hydra--head-property h :exit 'default))
- (color (hydra--head-property h :color))
+  (let* ((head-exit (hydra--head-property h :exit 'default))
  (foreign-keys (hydra--body-foreign-keys body))
+ (head-color (hydra--head-property h :color))
  (head-color
-  (cond ((eq exit 'default)
- (cl-case color
+  (cond ((eq head-exit 'default)
+ (cl-case head-color
(blue 'blue)
(red 'red)
(t
-(unless (null color)
+(unless (null head-color)
   (error "Use only :blue or :red for heads: %S" h)
-((null exit)
- (if color
+((null head-exit)
+ (if head-color
  (error "Don't mix :color and :exit - they are aliases: 
%S" h)
(cl-case foreign-keys
  (run 'pink)
  (warn 'amaranth)
  (t 'red
-((eq exit t)
- (if color
+((eq head-exit t)
+ (if head-color
  (error "Don't mix :color and :exit - they are aliases: 
%S" h)
'blue))
 (t
- (error "Unknown :exit %S" exit)
+ (error "Unknown :exit %S" head-exit)
 (cond ((null (cadr h))
(when head-color
  (hydra--complain
   "Doubly specified blue head - nil cmd is already blue: %S" h))
'blue)
   ((null head-color)
-   (hydra--body-color body))
+   (let ((color (plist-get (cddr body) :color))
+ (exit (plist-get (cddr body) :exit))
+ (foreign-keys (plist-get (cddr body) :foreign-keys)))
+ (cond ((eq foreign-keys 'warn)
+(if exit 'teal 'amaranth))
+   ((eq foreign-keys 'run) 'pink)
+   (exit 'blue)
+   (color color)
+   (t 'red
   ((null foreign-keys)
head-color)
   ((eq foreign-keys 'run)
@@ -372,19 +380,6 @@ Return DEFAULT if PROP is not in H."
((amaranth teal) 'warn)
(pink 'run)
 
-(defun hydra--body-color (body)
-  "Return the color of BODY.
-BODY is the second argument to `defhydra'"
-  (let ((color (plist-get (cddr body) :color))
-(exit (plist-get (cddr body) :exit))
-(foreign-keys (plist-get (cddr body) :foreign-keys)))
-(cond ((eq foreign-keys 'warn)
-   (if exit 'teal 'amaranth))
-  ((eq foreign-keys 'run) 'pink)
-  (exit 'blue)
-  (color color)
-  (t 'red
-
 (defvar hydra--input-method-function nil
   "Store overridden `input-method-function' here.")
 
@@ -558,7 +553,7 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
  (format "%s\n\nCall the head: `%S'." doc (cadr head))
doc))
 (hint (intern (format "%S/hint" name)))
-(body-color (hydra--body-color body))
+(body-foreign-keys (hydra--body-foreign-keys body))
 (body-timeout (plist-get body :timeout)))
 `(defun ,name ()
,doc
@@ -588,13 +583,8 @@ BODY-AFTER-EXIT is added to the end of the wrapper."
  (hydra-set-transient-map
   ,keymap
   (lambda () (hydra-keyboard-quit) ,body-before-exit)
-  ,(cond
-((memq body-color '(amaranth teal))
- ''warn)
-((eq body-color 'pink)
- ''run)
-(t
- nil)))
+  ,(when body-foreign-keys
+ (list 'quote body-foreign-keys)))
  ,body-after-exit
  ,(when body-timeout
 `(hydra-timeout ,body-timeout
@@ -807,9 +797,12 @@ result of `defhydra'."
  (body-before-exit (or (plist-get body-plist :post)
(plist-get body-plist :before-exit)))
  (body-after-exit (plist-get body-plist :after-exit))
- (body-color (hydra--body-color body)))
+ (body-inherit (plist-get body-plist :inherit))
+ (body-foreig

[elpa] master cab5a73 37/45: README.md: Update `hydra-zoom/body'

2015-04-16 Thread Oleh Krehel
branch: master
commit cab5a7325d03cd94fbab428b92f4507c46cc6fac
Author: Oleh Krehel 
Commit: Oleh Krehel 

README.md: Update `hydra-zoom/body'
---
 README.md |   50 +++---
 1 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/README.md b/README.md
index babcf9b..d2237d8 100644
--- a/README.md
+++ b/README.md
@@ -176,41 +176,21 @@ Here's what `hydra-zoom/body` looks like, if you're 
interested:
 
 The body can be accessed via `hydra-zoom/body'."
   (interactive)
-  (hydra-disable)
-  (catch (quote hydra-disable)
-(when hydra-is-helpful (hydra-zoom/hint))
-(setq hydra-last
-  (hydra-set-transient-map
-   (setq hydra-curr-map
- (quote
-  (keymap (7 . hydra-keyboard-quit)
-  (108 . hydra-zoom/text-scale-decrease)
-  (103 . hydra-zoom/text-scale-increase)
-  (kp-subtract . hydra--negative-argument)
-  (kp-9 . hydra--digit-argument)
-  (kp-8 . hydra--digit-argument)
-  (kp-7 . hydra--digit-argument)
-  (kp-6 . hydra--digit-argument)
-  (kp-5 . hydra--digit-argument)
-  (kp-4 . hydra--digit-argument)
-  (kp-3 . hydra--digit-argument)
-  (kp-2 . hydra--digit-argument)
-  (kp-1 . hydra--digit-argument)
-  (kp-0 . hydra--digit-argument)
-  (57 . hydra--digit-argument)
-  (56 . hydra--digit-argument)
-  (55 . hydra--digit-argument)
-  (54 . hydra--digit-argument)
-  (53 . hydra--digit-argument)
-  (52 . hydra--digit-argument)
-  (51 . hydra--digit-argument)
-  (50 . hydra--digit-argument)
-  (49 . hydra--digit-argument)
-  (48 . hydra--digit-argument)
-  (45 . hydra--negative-argument)
-  (21 . hydra--universal-argument
-   t (lambda nil (hydra-cleanup
-(setq prefix-arg current-prefix-arg)))
+  (hydra-default-pre)
+  (when hydra-is-helpful
+(if hydra-lv
+(lv-message
+ (eval hydra-zoom/hint))
+  (message
+   (eval hydra-zoom/hint
+  (hydra-set-transient-map
+   hydra-zoom/keymap
+   (lambda nil
+ (hydra-keyboard-quit)
+ nil)
+   nil)
+  (setq prefix-arg
+current-prefix-arg))
 ```
 
 ## `awesome-map` and `awesome-binding`



[elpa] master fb86435 1/2: Declare the hint early to avoid compile warnings

2015-04-16 Thread Oleh Krehel
branch: master
commit fb864353cd8dc91591942f398ef971ba7714b50f
Author: Oleh Krehel 
Commit: Oleh Krehel 

Declare the hint early to avoid compile warnings

* hydra.el (hydra-fontify-head-greyscale): Update unused arg.
(hydra--make-defun): Update.
(hydra--head-name): Take one less arg.
(defhydra): Update hint position.

* hydra-init.el: Byte compile more stuff.

* hydra-test.el: Update tests.

* Makefile: Rename compile target to "run", update "compile".
---
 Makefile  |5 ++-
 hydra-init.el |4 +--
 hydra-test.el |   90 
 hydra.el  |   20 ++--
 4 files changed, 60 insertions(+), 59 deletions(-)

diff --git a/Makefile b/Makefile
index 43bcb5a..dd3a762 100644
--- a/Makefile
+++ b/Makefile
@@ -11,9 +11,12 @@ test:
@echo "Using $(shell which $(emacs))..."
$(emacs) -batch $(LOAD) -f ert-run-tests-batch-and-exit
 
-compile:
+run:
$(emacs) -q $(LOAD) -l hydra-init.el
make clean
 
+compile:
+   $(emacs) -batch $(LOAD) -l hydra-init.el
+
 clean:
rm -f *.elc
diff --git a/hydra-init.el b/hydra-init.el
index 80b4159..881ceb6 100644
--- a/hydra-init.el
+++ b/hydra-init.el
@@ -24,6 +24,4 @@
 (setq hydra-examples-verbatim t)
 (require 'hydra-examples)
 (require 'hydra-test)
-(mapc #'byte-compile-file '("hydra.el"))
-(switch-to-buffer "*Compile-Log*")
-(ert t)
+(mapc #'byte-compile-file '("hydra.el" "hydra-examples.el" "hydra-ox.el" 
"hydra-test.el" "lv.el"))
diff --git a/hydra-test.el b/hydra-test.el
index d9adba6..ea416af 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -91,6 +91,16 @@
   "rep"
   :bind nil
   :exit nil
+  (set
+   (defvar hydra-error/hint nil
+ "Dynamic hint for hydra-error.")
+   (quote
+(format
+ #("error: [h]: first, [j]: next, [k]: prev, [SPC]: rep."
+   8 9 (face hydra-face-red)
+   20 21 (face hydra-face-red)
+   31 32 (face hydra-face-red)
+   42 45 (face hydra-face-red)
   (defun hydra-error/first-error nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -214,16 +224,6 @@ Call the head: `previous-error'."
   (define-key global-map [134217831 107]
(function
 hydra-error/previous-error))
-  (set
-   (defvar hydra-error/hint nil
- "Dynamic hint for hydra-error.")
-   (quote
-(format
- #("error: [h]: first, [j]: next, [k]: prev, [SPC]: rep."
-   8 9 (face hydra-face-red)
-   20 21 (face hydra-face-red)
-   31 32 (face hydra-face-red)
-   42 45 (face hydra-face-red)
   (defun hydra-error/body nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -312,6 +312,16 @@ The body can be accessed via `hydra-error/body'."
   "abbrev"
   :exit t)
  ("q" nil "cancel" :exit t
+  (set
+   (defvar hydra-toggle/hint nil
+ "Dynamic hint for hydra-toggle.")
+   (quote
+(format
+ #("toggle: [t]: truncate, [f]: fill, [a]: abbrev, [q]: cancel."
+   9 10 (face hydra-face-blue)
+   24 25 (face hydra-face-blue)
+   35 36 (face hydra-face-blue)
+   48 49 (face hydra-face-blue)
   (defun hydra-toggle/toggle-truncate-lines-and-exit nil
 "Create a hydra with no body and the heads:
 
@@ -384,16 +394,6 @@ Call the head: `nil'."
 (interactive)
 (hydra-default-pre)
 (hydra-keyboard-quit))
-  (set
-   (defvar hydra-toggle/hint nil
- "Dynamic hint for hydra-toggle.")
-   (quote
-(format
- #("toggle: [t]: truncate, [f]: fill, [a]: abbrev, [q]: cancel."
-   9 10 (face hydra-face-blue)
-   24 25 (face hydra-face-blue)
-   35 36 (face hydra-face-blue)
-   48 49 (face hydra-face-blue)
   (defun hydra-toggle/body nil
 "Create a hydra with no body and the heads:
 
@@ -478,6 +478,15 @@ The body can be accessed via `hydra-toggle/body'."
   ""
   :exit nil)
  ("q" nil "quit" :exit t
+  (set
+   (defvar hydra-vi/hint nil
+ "Dynamic hint for hydra-vi.")
+   (quote
+(format
+ #("vi: j, k, [q]: quit."
+   4 5 (face hydra-face-amaranth)
+   7 8 (face hydra-face-amaranth)
+   11 12 (face hydra-face-teal)
   (defun hydra-vi/next-line nil
 "Create a hydra with no body and the heads:
 
@@ -562,15 +571,6 @@ Call the head: `nil'."
 (hydra-default-pre)
 (set-cursor-color "#e52b50")
 (hydra-keyboard-quit))
-  (set
-   (defvar hydra-vi/hint nil
- "Dynamic hint for hydra-vi.")
-   (quote
-(format
- #("vi: j, k, [q]: quit."
-   4 5 (face hydra-face-amaranth)
-   7 8 (face hydra-face-amaranth)
-   11 12 (face hydra-face-teal)
   (defun hydra-vi/body nil
  

[elpa] master 74573cb 2/2: Merge commit 'fb864353cd8dc91591942f398ef971ba7714b50f' from hydra

2015-04-16 Thread Oleh Krehel
branch: master
commit 74573cb0ee5802bad3aef630979d1b1f7a88b9c6
Merge: f972634 fb86435
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit 'fb864353cd8dc91591942f398ef971ba7714b50f' from hydra
---
 packages/hydra/Makefile  |5 ++-
 packages/hydra/hydra-init.el |4 +-
 packages/hydra/hydra-test.el |   90 +-
 packages/hydra/hydra.el  |   20 +-
 4 files changed, 60 insertions(+), 59 deletions(-)

diff --git a/packages/hydra/Makefile b/packages/hydra/Makefile
index 43bcb5a..dd3a762 100644
--- a/packages/hydra/Makefile
+++ b/packages/hydra/Makefile
@@ -11,9 +11,12 @@ test:
@echo "Using $(shell which $(emacs))..."
$(emacs) -batch $(LOAD) -f ert-run-tests-batch-and-exit
 
-compile:
+run:
$(emacs) -q $(LOAD) -l hydra-init.el
make clean
 
+compile:
+   $(emacs) -batch $(LOAD) -l hydra-init.el
+
 clean:
rm -f *.elc
diff --git a/packages/hydra/hydra-init.el b/packages/hydra/hydra-init.el
index 80b4159..881ceb6 100644
--- a/packages/hydra/hydra-init.el
+++ b/packages/hydra/hydra-init.el
@@ -24,6 +24,4 @@
 (setq hydra-examples-verbatim t)
 (require 'hydra-examples)
 (require 'hydra-test)
-(mapc #'byte-compile-file '("hydra.el"))
-(switch-to-buffer "*Compile-Log*")
-(ert t)
+(mapc #'byte-compile-file '("hydra.el" "hydra-examples.el" "hydra-ox.el" 
"hydra-test.el" "lv.el"))
diff --git a/packages/hydra/hydra-test.el b/packages/hydra/hydra-test.el
index 15eabcf..9385ee6 100644
--- a/packages/hydra/hydra-test.el
+++ b/packages/hydra/hydra-test.el
@@ -92,6 +92,16 @@
   "rep"
   :bind nil
   :exit nil
+  (set
+   (defvar hydra-error/hint nil
+ "Dynamic hint for hydra-error.")
+   (quote
+(format
+ #("error: [h]: first, [j]: next, [k]: prev, [SPC]: rep."
+   8 9 (face hydra-face-red)
+   20 21 (face hydra-face-red)
+   31 32 (face hydra-face-red)
+   42 45 (face hydra-face-red)
   (defun hydra-error/first-error nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -215,16 +225,6 @@ Call the head: `previous-error'."
   (define-key global-map [134217831 107]
(function
 hydra-error/previous-error))
-  (set
-   (defvar hydra-error/hint nil
- "Dynamic hint for hydra-error.")
-   (quote
-(format
- #("error: [h]: first, [j]: next, [k]: prev, [SPC]: rep."
-   8 9 (face hydra-face-red)
-   20 21 (face hydra-face-red)
-   31 32 (face hydra-face-red)
-   42 45 (face hydra-face-red)
   (defun hydra-error/body nil
 "Create a hydra with a \"M-g\" body and the heads:
 
@@ -313,6 +313,16 @@ The body can be accessed via `hydra-error/body'."
   "abbrev"
   :exit t)
  ("q" nil "cancel" :exit t
+  (set
+   (defvar hydra-toggle/hint nil
+ "Dynamic hint for hydra-toggle.")
+   (quote
+(format
+ #("toggle: [t]: truncate, [f]: fill, [a]: abbrev, [q]: cancel."
+   9 10 (face hydra-face-blue)
+   24 25 (face hydra-face-blue)
+   35 36 (face hydra-face-blue)
+   48 49 (face hydra-face-blue)
   (defun hydra-toggle/toggle-truncate-lines-and-exit nil
 "Create a hydra with no body and the heads:
 
@@ -385,16 +395,6 @@ Call the head: `nil'."
 (interactive)
 (hydra-default-pre)
 (hydra-keyboard-quit))
-  (set
-   (defvar hydra-toggle/hint nil
- "Dynamic hint for hydra-toggle.")
-   (quote
-(format
- #("toggle: [t]: truncate, [f]: fill, [a]: abbrev, [q]: cancel."
-   9 10 (face hydra-face-blue)
-   24 25 (face hydra-face-blue)
-   35 36 (face hydra-face-blue)
-   48 49 (face hydra-face-blue)
   (defun hydra-toggle/body nil
 "Create a hydra with no body and the heads:
 
@@ -479,6 +479,15 @@ The body can be accessed via `hydra-toggle/body'."
   ""
   :exit nil)
  ("q" nil "quit" :exit t
+  (set
+   (defvar hydra-vi/hint nil
+ "Dynamic hint for hydra-vi.")
+   (quote
+(format
+ #("vi: j, k, [q]: quit."
+   4 5 (face hydra-face-amaranth)
+   7 8 (face hydra-face-amaranth)
+   11 12 (face hydra-face-teal)
   (defun hydra-vi/next-line nil
 "Create a hydra with no body and the heads:
 
@@ -563,15 +572,6 @@ Call the head: `nil'."
 (hydra-default-pre)
 (set-cursor-color "#e52b50")
 (hydra-keyboard-quit))
-  (set
-   (defvar hydra-vi/hint nil
- "Dynamic hint for hydra-vi.")
-   (quote
-(format
- #("vi: j, k, [q]: quit."
-   4 5 (face hydra-face-amaranth)
-   7 8 (face hydra-face-amaranth)
-   11 12 (face hydra-face-teal)
   (defun hydra-vi/body nil
 "Create a hydra with no body and the heads:
 
@@ -656,6 +656,14 @@ The body 

[elpa] master 21a1fff 4/4: Merge commit '2fd99e13ca15b6356c149deb74d6a2e78d0b264a' from swiper

2015-04-16 Thread Oleh Krehel
branch: master
commit 21a1fff7fce5ff3ba5b6739e475c6189627453b6
Merge: 74573cb 2fd99e1
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit '2fd99e13ca15b6356c149deb74d6a2e78d0b264a' from swiper
---
 packages/swiper/ivy.el|   14 ++
 packages/swiper/swiper.el |9 -
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/packages/swiper/ivy.el b/packages/swiper/ivy.el
index 38a8ff4..f4e368e 100644
--- a/packages/swiper/ivy.el
+++ b/packages/swiper/ivy.el
@@ -4,7 +4,7 @@
 
 ;; Author: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.2.1
+;; Version: 0.2.2
 ;; Package-Requires: ((emacs "24.1"))
 ;; Keywords: matching
 
@@ -233,7 +233,7 @@ UPDATE-FN is called each time the current candidate(s) is 
changed."
 
 (defun ivy-completing-read (prompt collection
 &optional predicate _require-match initial-input
-&rest _ignore)
+  _history def _inherit-input-method)
   "Read a string in the minibuffer, with completion.
 
 This is an interface that conforms to `completing-read', so that
@@ -245,17 +245,23 @@ PREDICATE limits completion to a subset of COLLECTION.
 
 _REQUIRE-MATCH is ignored for now.
 INITIAL-INPUT is a string that can be inserted into the minibuffer initially.
+_HISTORY is ignored for now.
+DEF is the default value.
+_INHERIT-INPUT-METHOD is ignored for now.
 
 The history, defaults and input-method arguments are ignored for now."
   (cond ((functionp collection)
- (error "Function as a collection unsupported"))
+ (setq collection (all-completions "" collection))
+ (setq initial-input nil))
 ((hash-table-p collection)
  (error "Hash table as a collection unsupported"))
 ((listp (car collection))
  (setq collection (mapcar #'car collection
   (when predicate
 (setq collection (cl-remove-if-not predicate collection)))
-  (ivy-read prompt collection initial-input))
+  (when (listp def)
+(setq def (car def)))
+  (ivy-read prompt collection initial-input nil def))
 
 ;;;###autoload
 (define-minor-mode ivy-mode
diff --git a/packages/swiper/swiper.el b/packages/swiper/swiper.el
index a3143f7..8f0a083 100644
--- a/packages/swiper/swiper.el
+++ b/packages/swiper/swiper.el
@@ -113,9 +113,10 @@
  gnus-group-mode
  emms-playlist-mode erc-mode
  org-agenda-mode)))
-(if (fboundp 'font-lock-ensure)
-(font-lock-ensure)
-  (font-lock-fontify-buffer
+(unless (> (buffer-size) 10)
+  (if (fboundp 'font-lock-ensure)
+  (font-lock-ensure)
+(font-lock-fontify-buffer)
 
 (defvar swiper--format-spec ""
   "Store the current candidates format spec.")
@@ -163,7 +164,6 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
   "`isearch' with an overview using `ivy'.
 When non-nil, INITIAL-INPUT is the initial search pattern."
   (interactive)
-  (ido-mode -1)
   (swiper--init)
   (let ((candidates (swiper--candidates))
 (preselect (format
@@ -183,7 +183,6 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
 swiper-map
 preselect
 #'swiper--update-input-ivy))
-  (ido-mode 1)
   (swiper--cleanup)
   (if (null ivy-exit)
   (goto-char swiper--opoint)



[elpa] master 2fd99e1 3/4: Add function as collection support for ivy-mode

2015-04-16 Thread Oleh Krehel
branch: master
commit 2fd99e13ca15b6356c149deb74d6a2e78d0b264a
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add function as collection support for ivy-mode

* ivy.el (ivy-completing-read): Update.
Ignore initial input for function collection type.
---
 ivy.el |   14 ++
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index 38a8ff4..f4e368e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -4,7 +4,7 @@
 
 ;; Author: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.2.1
+;; Version: 0.2.2
 ;; Package-Requires: ((emacs "24.1"))
 ;; Keywords: matching
 
@@ -233,7 +233,7 @@ UPDATE-FN is called each time the current candidate(s) is 
changed."
 
 (defun ivy-completing-read (prompt collection
 &optional predicate _require-match initial-input
-&rest _ignore)
+  _history def _inherit-input-method)
   "Read a string in the minibuffer, with completion.
 
 This is an interface that conforms to `completing-read', so that
@@ -245,17 +245,23 @@ PREDICATE limits completion to a subset of COLLECTION.
 
 _REQUIRE-MATCH is ignored for now.
 INITIAL-INPUT is a string that can be inserted into the minibuffer initially.
+_HISTORY is ignored for now.
+DEF is the default value.
+_INHERIT-INPUT-METHOD is ignored for now.
 
 The history, defaults and input-method arguments are ignored for now."
   (cond ((functionp collection)
- (error "Function as a collection unsupported"))
+ (setq collection (all-completions "" collection))
+ (setq initial-input nil))
 ((hash-table-p collection)
  (error "Hash table as a collection unsupported"))
 ((listp (car collection))
  (setq collection (mapcar #'car collection
   (when predicate
 (setq collection (cl-remove-if-not predicate collection)))
-  (ivy-read prompt collection initial-input))
+  (when (listp def)
+(setq def (car def)))
+  (ivy-read prompt collection initial-input nil def))
 
 ;;;###autoload
 (define-minor-mode ivy-mode



[elpa] master 481908c 2/4: Don't try to fontify huge buffers

2015-04-16 Thread Oleh Krehel
branch: master
commit 481908c47b56b4b2785664be9cbc9a63dd339261
Author: Oleh Krehel 
Commit: Oleh Krehel 

Don't try to fontify huge buffers

* swiper.el (swiper-font-lock-ensure): Update.
---
 swiper.el |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/swiper.el b/swiper.el
index 1a50895..8f0a083 100644
--- a/swiper.el
+++ b/swiper.el
@@ -113,9 +113,10 @@
  gnus-group-mode
  emms-playlist-mode erc-mode
  org-agenda-mode)))
-(if (fboundp 'font-lock-ensure)
-(font-lock-ensure)
-  (font-lock-fontify-buffer
+(unless (> (buffer-size) 10)
+  (if (fboundp 'font-lock-ensure)
+  (font-lock-ensure)
+(font-lock-fontify-buffer)
 
 (defvar swiper--format-spec ""
   "Store the current candidates format spec.")



[elpa] master 93275af 1/4: Remove ido-mode shenanigans

2015-04-16 Thread Oleh Krehel
branch: master
commit 93275afccfeb1fe9594ae2ccdb3fdc512fabb6d6
Author: Oleh Krehel 
Commit: Oleh Krehel 

Remove ido-mode shenanigans

Combining `ido-mode' and `ivy-read' seemed to cause a problem at some
stage. Can't reproduce now, so I'll just remove this for a while.
---
 swiper.el |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/swiper.el b/swiper.el
index a3143f7..1a50895 100644
--- a/swiper.el
+++ b/swiper.el
@@ -163,7 +163,6 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
   "`isearch' with an overview using `ivy'.
 When non-nil, INITIAL-INPUT is the initial search pattern."
   (interactive)
-  (ido-mode -1)
   (swiper--init)
   (let ((candidates (swiper--candidates))
 (preselect (format
@@ -183,7 +182,6 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
 swiper-map
 preselect
 #'swiper--update-input-ivy))
-  (ido-mode 1)
   (swiper--cleanup)
   (if (null ivy-exit)
   (goto-char swiper--opoint)



[elpa] master updated (74573cb -> 21a1fff)

2015-04-16 Thread Oleh Krehel
abo_abo pushed a change to branch master.

  from  74573cb   Merge commit 'fb864353cd8dc91591942f398ef971ba7714b50f' 
from hydra
   new  93275af   Remove ido-mode shenanigans
   new  481908c   Don't try to fontify huge buffers
   new  2fd99e1   Add function as collection support for ivy-mode
   new  21a1fff   Merge commit '2fd99e13ca15b6356c149deb74d6a2e78d0b264a' 
from swiper


Summary of changes:
 packages/swiper/ivy.el|   14 ++
 packages/swiper/swiper.el |9 -
 2 files changed, 14 insertions(+), 9 deletions(-)



[elpa] master 0cffcac 1/2: Add require-match functionality

2015-04-16 Thread Oleh Krehel
branch: master
commit 0cffcacdb0e0a035aa75f5276ca0c4cba688fc6f
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add require-match functionality

* ivy.el (ivy-require-match): New defvar.
(ivy-done): When nothing matches, and `ivy-require-match' isn't t, use
the current text anyway.
(ivy-completing-read): Update.
---
 ivy.el |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index f4e368e..bb0306a 100644
--- a/ivy.el
+++ b/ivy.el
@@ -90,12 +90,18 @@ This is usually meant as a quick exit out of the 
minibuffer."
 Maximum length of the history list is determined by the value
 of `history-length', which see.")
 
+(defvar ivy-require-match t
+  "Store require-match. See `completing-read'.")
+
 ;;** Commands
 (defun ivy-done ()
   "Exit the minibuffer with the selected candidate."
   (interactive)
   (delete-minibuffer-contents)
-  (unless (zerop ivy--length)
+  (if (zerop ivy--length)
+  (when (memq ivy-require-match '(nil confirm confirm-after-completion))
+(insert ivy-text)
+(setq ivy-exit 'done))
 (insert ivy--current)
 (setq ivy-exit 'done))
   (exit-minibuffer))
@@ -232,7 +238,7 @@ UPDATE-FN is called each time the current candidate(s) is 
changed."
  (funcall ivy--action))
 
 (defun ivy-completing-read (prompt collection
-&optional predicate _require-match initial-input
+&optional predicate require-match initial-input
   _history def _inherit-input-method)
   "Read a string in the minibuffer, with completion.
 
@@ -243,7 +249,7 @@ PROMPT is a string to prompt with; normally it ends in a 
colon and a space.
 COLLECTION can be a list of strings, an alist, an obarray or a hash table.
 PREDICATE limits completion to a subset of COLLECTION.
 
-_REQUIRE-MATCH is ignored for now.
+REQUIRE-MATCH is stored into `ivy-require-match'. See `completing-read'.
 INITIAL-INPUT is a string that can be inserted into the minibuffer initially.
 _HISTORY is ignored for now.
 DEF is the default value.
@@ -261,6 +267,7 @@ The history, defaults and input-method arguments are 
ignored for now."
 (setq collection (cl-remove-if-not predicate collection)))
   (when (listp def)
 (setq def (car def)))
+  (setq ivy-require-match require-match)
   (ivy-read prompt collection initial-input nil def))
 
 ;;;###autoload



[elpa] master ef24701 2/2: Merge commit '0cffcacdb0e0a035aa75f5276ca0c4cba688fc6f' from swiper

2015-04-16 Thread Oleh Krehel
branch: master
commit ef2470117d8fccea2f5200bff27d6d1a04b855b7
Merge: 21a1fff 0cffcac
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit '0cffcacdb0e0a035aa75f5276ca0c4cba688fc6f' from swiper
---
 packages/swiper/ivy.el |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/packages/swiper/ivy.el b/packages/swiper/ivy.el
index f4e368e..bb0306a 100644
--- a/packages/swiper/ivy.el
+++ b/packages/swiper/ivy.el
@@ -90,12 +90,18 @@ This is usually meant as a quick exit out of the 
minibuffer."
 Maximum length of the history list is determined by the value
 of `history-length', which see.")
 
+(defvar ivy-require-match t
+  "Store require-match. See `completing-read'.")
+
 ;;** Commands
 (defun ivy-done ()
   "Exit the minibuffer with the selected candidate."
   (interactive)
   (delete-minibuffer-contents)
-  (unless (zerop ivy--length)
+  (if (zerop ivy--length)
+  (when (memq ivy-require-match '(nil confirm confirm-after-completion))
+(insert ivy-text)
+(setq ivy-exit 'done))
 (insert ivy--current)
 (setq ivy-exit 'done))
   (exit-minibuffer))
@@ -232,7 +238,7 @@ UPDATE-FN is called each time the current candidate(s) is 
changed."
  (funcall ivy--action))
 
 (defun ivy-completing-read (prompt collection
-&optional predicate _require-match initial-input
+&optional predicate require-match initial-input
   _history def _inherit-input-method)
   "Read a string in the minibuffer, with completion.
 
@@ -243,7 +249,7 @@ PROMPT is a string to prompt with; normally it ends in a 
colon and a space.
 COLLECTION can be a list of strings, an alist, an obarray or a hash table.
 PREDICATE limits completion to a subset of COLLECTION.
 
-_REQUIRE-MATCH is ignored for now.
+REQUIRE-MATCH is stored into `ivy-require-match'. See `completing-read'.
 INITIAL-INPUT is a string that can be inserted into the minibuffer initially.
 _HISTORY is ignored for now.
 DEF is the default value.
@@ -261,6 +267,7 @@ The history, defaults and input-method arguments are 
ignored for now."
 (setq collection (cl-remove-if-not predicate collection)))
   (when (listp def)
 (setq def (car def)))
+  (setq ivy-require-match require-match)
   (ivy-read prompt collection initial-input nil def))
 
 ;;;###autoload



[elpa] master 485abbb 2/2: Merge commit 'cb5ae17997a9ec239cf9d486feceb80acb433754' from swiper

2015-04-16 Thread Oleh Krehel
branch: master
commit 485abbbdf8c2ae2a053512b259a59a5c0714fb6d
Merge: ef24701 cb5ae17
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit 'cb5ae17997a9ec239cf9d486feceb80acb433754' from swiper
---
 packages/swiper/ivy.el |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/packages/swiper/ivy.el b/packages/swiper/ivy.el
index bb0306a..d374dea 100644
--- a/packages/swiper/ivy.el
+++ b/packages/swiper/ivy.el
@@ -4,7 +4,7 @@
 
 ;; Author: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.2.2
+;; Version: 0.2.3
 ;; Package-Requires: ((emacs "24.1"))
 ;; Keywords: matching
 
@@ -256,15 +256,15 @@ DEF is the default value.
 _INHERIT-INPUT-METHOD is ignored for now.
 
 The history, defaults and input-method arguments are ignored for now."
-  (cond ((functionp collection)
- (setq collection (all-completions "" collection))
+  (cond ((or (functionp collection)
+ (vectorp collection))
+ (setq collection (all-completions "" collection predicate))
+ ;; find-file is problematic
  (setq initial-input nil))
 ((hash-table-p collection)
  (error "Hash table as a collection unsupported"))
 ((listp (car collection))
- (setq collection (mapcar #'car collection
-  (when predicate
-(setq collection (cl-remove-if-not predicate collection)))
+ (setq collection (all-completions "" collection predicate
   (when (listp def)
 (setq def (car def)))
   (setq ivy-require-match require-match)



[elpa] master cb5ae17 1/2: ivy.el (ivy-completing-read): Rely more on `all-completions'

2015-04-16 Thread Oleh Krehel
branch: master
commit cb5ae17997a9ec239cf9d486feceb80acb433754
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-completing-read): Rely more on `all-completions'
---
 ivy.el |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ivy.el b/ivy.el
index bb0306a..d374dea 100644
--- a/ivy.el
+++ b/ivy.el
@@ -4,7 +4,7 @@
 
 ;; Author: Oleh Krehel 
 ;; URL: https://github.com/abo-abo/swiper
-;; Version: 0.2.2
+;; Version: 0.2.3
 ;; Package-Requires: ((emacs "24.1"))
 ;; Keywords: matching
 
@@ -256,15 +256,15 @@ DEF is the default value.
 _INHERIT-INPUT-METHOD is ignored for now.
 
 The history, defaults and input-method arguments are ignored for now."
-  (cond ((functionp collection)
- (setq collection (all-completions "" collection))
+  (cond ((or (functionp collection)
+ (vectorp collection))
+ (setq collection (all-completions "" collection predicate))
+ ;; find-file is problematic
  (setq initial-input nil))
 ((hash-table-p collection)
  (error "Hash table as a collection unsupported"))
 ((listp (car collection))
- (setq collection (mapcar #'car collection
-  (when predicate
-(setq collection (cl-remove-if-not predicate collection)))
+ (setq collection (all-completions "" collection predicate
   (when (listp def)
 (setq def (car def)))
   (setq ivy-require-match require-match)



[elpa] master f0f7a84 1/2: Use `condition-case-unless-debug'

2015-04-16 Thread Oleh Krehel
branch: master
commit f0f7a844b0c423365020113c022110d899e8c1eb
Author: Oleh Krehel 
Commit: Oleh Krehel 

Use `condition-case-unless-debug'
---
 hydra.el |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/hydra.el b/hydra.el
index 86f4883..7fc9d7e 100644
--- a/hydra.el
+++ b/hydra.el
@@ -817,7 +817,7 @@ result of `defhydra'."
  (setq docstring "hydra")))
   (when (keywordp (car body))
 (setq body (cons nil (cons nil body
-  (condition-case err
+  (condition-case-unless-debug err
   (let* ((keymap (copy-keymap hydra-base-map))
  (keymap-name (intern (format "%S/keymap" name)))
  (body-name (intern (format "%S/body" name)))
@@ -951,9 +951,7 @@ result of `defhydra'."
(or body-body-pre body-pre) body-before-exit
'(setq prefix-arg current-prefix-arg)
 (error
- (if debug-on-error
- (signal (car err) (cdr err))
-   (message "Error in defhydra %S: %s" name (cdr err)))
+ (message "Error in defhydra %S: %s" name (cdr err))
  nil)))
 
 (defmacro defhydradio (name _body &rest heads)



[elpa] master 751af65 2/2: Merge commit 'f0f7a844b0c423365020113c022110d899e8c1eb' from hydra

2015-04-16 Thread Oleh Krehel
branch: master
commit 751af658547130dbe56d65fa92168a1029559185
Merge: 485abbb f0f7a84
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit 'f0f7a844b0c423365020113c022110d899e8c1eb' from hydra
---
 packages/hydra/hydra.el |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/packages/hydra/hydra.el b/packages/hydra/hydra.el
index 86f4883..7fc9d7e 100644
--- a/packages/hydra/hydra.el
+++ b/packages/hydra/hydra.el
@@ -817,7 +817,7 @@ result of `defhydra'."
  (setq docstring "hydra")))
   (when (keywordp (car body))
 (setq body (cons nil (cons nil body
-  (condition-case err
+  (condition-case-unless-debug err
   (let* ((keymap (copy-keymap hydra-base-map))
  (keymap-name (intern (format "%S/keymap" name)))
  (body-name (intern (format "%S/body" name)))
@@ -951,9 +951,7 @@ result of `defhydra'."
(or body-body-pre body-pre) body-before-exit
'(setq prefix-arg current-prefix-arg)
 (error
- (if debug-on-error
- (signal (car err) (cdr err))
-   (message "Error in defhydra %S: %s" name (cdr err)))
+ (message "Error in defhydra %S: %s" name (cdr err))
  nil)))
 
 (defmacro defhydradio (name _body &rest heads)



[elpa] master aebefa2: * swiper/ivy.el: Make sure cl-position-if exists at run-time.

2015-04-16 Thread Stefan Monnier
branch: master
commit aebefa21e23bdac72367500f51c15e83b2d1ccdc
Author: Stefan Monnier 
Commit: Stefan Monnier 

* swiper/ivy.el: Make sure cl-position-if exists at run-time.
---
 packages/swiper/ivy.el |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/packages/swiper/ivy.el b/packages/swiper/ivy.el
index d374dea..8c676e5 100644
--- a/packages/swiper/ivy.el
+++ b/packages/swiper/ivy.el
@@ -36,6 +36,8 @@
 ;; re-building it into a regex.
 ;; So "for example" is transformed into "\\(for\\).*\\(example\\)".
 
+(require 'cl-lib)
+
 ;;; Code:
 ;;* Customization
 (defgroup ivy nil