[elpa] master d1f88fa 10/63: ivy.el (ivy-read): Don't put empty string on history

2015-08-21 Thread Oleh Krehel
branch: master
commit d1f88fa55b8c01781cc75358407e7aa21cfba307
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-read): Don't put empty string on history
---
 ivy.el |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index fc11c3d..4aff281 100644
--- a/ivy.el
+++ b/ivy.el
@@ -819,9 +819,10 @@ candidates with each input."
  (let ((item (if ivy--directory
  ivy--current
ivy-text)))
-   (set hist (cons (propertize item 'ivy-index ivy--index)
-   (delete item
-   (cdr (symbol-value hist))
+   (unless (equal item "")
+ (set hist (cons (propertize item 'ivy-index ivy--index)
+ (delete item
+ (cdr (symbol-value hist)))
  res)))
 (remove-hook 'post-command-hook #'ivy--exhibit)
 (when (setq unwind (ivy-state-unwind ivy-last))



[elpa] master 21007c2 17/63: Add counsel-rhythmbox

2015-08-21 Thread Oleh Krehel
branch: master
commit 21007c2395105a14301c2f999549b533e2137e22
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add counsel-rhythmbox

* counsel.el (counsel-completion-beg):
(counsel-completion-end): Move declarations before first use.
(dired-jump): Declare.
(counsel-rhythmbox-enqueue-song): New defun.
(counsel-rhythmbox): New command. Requires `helm-rhythmbox' package, and
Rhythmbox, obviously.

* ivy.el (ivy-call): Make interactive. Add special handling for the case
  when the collection is an alist. In that case, call the action not
  with the collection item, but with the cdr of said item. A bit weird,
  but that's the way Helm does it, and doing it in the same way means
  the action functions are cross-compatible.

* ivy-hydra.el (hydra-ivy): Bind "g" to call the current action on
  current candidate without exiting.

Now it's possible to make a query to Rhythmbox, "C-o" and navigate to a
song with "j" and "k". Try the song with "g".  Or use "s" once and then
enqueue different songs with e.g. "jjgjjjgjgkkg".
---
 counsel.el   |   43 +--
 ivy-hydra.el |3 ++-
 ivy.el   |   13 +
 3 files changed, 48 insertions(+), 11 deletions(-)

diff --git a/counsel.el b/counsel.el
index 5f48f30..0c589e1 100644
--- a/counsel.el
+++ b/counsel.el
@@ -34,6 +34,12 @@
 
 (require 'swiper)
 
+(defvar counsel-completion-beg nil
+  "Completion bounds start.")
+
+(defvar counsel-completion-end nil
+  "Completion bounds end.")
+
 ;;;###autoload
 (defun counsel-el ()
   "Elisp completion at point."
@@ -75,12 +81,6 @@
   :initial-input str
   :action #'counsel--el-action)))
 
-(defvar counsel-completion-beg nil
-  "Completion bounds start.")
-
-(defvar counsel-completion-end nil
-  "Completion bounds end.")
-
 (defun counsel--el-action (symbol)
   "Insert SYMBOL, erasing the previous one."
   (when (stringp symbol)
@@ -439,6 +439,7 @@ Skip some dotfiles unless `ivy-text' requires them."
 shell-command-switch
 (format "xdg-open %s" (shell-quote-argument x
 
+(declare-function dired-jump "dired-x")
 (defun counsel-locate-action-dired (x)
   "Use `dired-jump' on X."
   (dired-jump nil x))
@@ -684,6 +685,36 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 (custom-available-themes))
 :action #'counsel--load-theme-action))
 
+(defvar rhythmbox-library)
+(declare-function rhythmbox-load-library "ext:helm-rhythmbox")
+(declare-function dbus-call-method "dbus")
+(declare-function rhythmbox-song-uri "ext:helm-rhythmbox")
+(declare-function helm-rhythmbox-candidates "ext:helm-rhythmbox")
+
+(defun counsel-rhythmbox-enqueue-song (song)
+  "Let Rhythmbox enqueue SONG."
+  (let ((service "org.gnome.Rhythmbox3")
+(path "/org/gnome/Rhythmbox3/PlayQueue")
+(interface "org.gnome.Rhythmbox3.PlayQueue"))
+(dbus-call-method :session service path interface
+  "AddToQueue" (rhythmbox-song-uri song
+
+;;;###autoload
+(defun counsel-rhythmbox ()
+  "Choose a song from the Rhythmbox library to play or enqueue."
+  (interactive)
+  (unless (require 'helm-rhythmbox nil t)
+(error "Please install `helm-rhythmbox'"))
+  (unless rhythmbox-library
+(rhythmbox-load-library)
+(while (null rhythmbox-library)
+  (sit-for 0.1)))
+  (ivy-read "Rhythmbox: "
+(helm-rhythmbox-candidates)
+:action
+'(1
+  ("Play song" helm-rhythmbox-play-song)
+  ("Enqueue song" counsel-rhythmbox-enqueue-song
 
 (provide 'counsel)
 
diff --git a/ivy-hydra.el b/ivy-hydra.el
index 030978f..cdaff1f 100644
--- a/ivy-hydra.el
+++ b/ivy-hydra.el
@@ -51,7 +51,7 @@
 ^^---
 ^ ^ _k_ ^ ^ _f_ollow  _i_nsert _c_: calling %s(if ivy-calling \"on\" 
\"off\")  _w_/_s_: %s(ivy-action-name)
 _h_ ^+^ _l_ _d_one_o_ops   _m_: matcher %s(if (eq ivy--regex-function 
'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")
-^ ^ _j_ ^ ^ ^ ^   ^ ^  _<_/_>_: shrink/grow window
+^ ^ _j_ ^ ^ _g_o  ^ ^  _<_/_>_: shrink/grow window
 "
   ;; arrows
   ("h" ivy-beginning-of-buffer)
@@ -66,6 +66,7 @@ _h_ ^+^ _l_ _d_one_o_ops   _m_: matcher %s(if (eq 
ivy--regex-function 'i
   ("f" ivy-alt-done :exit nil)
   ("C-j" ivy-alt-done :exit nil)
   ("d" ivy-done :exit t)
+  ("g" ivy-call)
   ("C-m" ivy-done :exit t)
   ("c" ivy-toggle-calling)
   ("m" ivy-toggle-fuzzy)
diff --git a/ivy.el b/ivy.el
index a768c18..876204f 100644
--- a/ivy.el
+++ b/ivy.el
@@ -539,10 +539,16 @@ If the input is empty, select the previous history 
element instead."
 
 (defun ivy-call ()
   "Call the current action without exiting completion."
+  (interactive)
   (let ((action (ivy--get-action ivy-last)))
 (when action
-  (with-selected-window (ivy-state-window ivy-last)
-(funcall action ivy--curre

[elpa] master 6062903 21/63: ivy.el (ivy-count-format): Improve docstring

2015-08-21 Thread Oleh Krehel
branch: master
commit 60629039aa567d02b7cb18537767f536d5bdc29f
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-count-format): Improve docstring

* ivy.el (ivy-minibuffer-grow):
(ivy-toggle-calling):
(ivy-sort-functions-alist): Checkdoc.
---
 ivy.el |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index e79bb9a..b2d4680 100644
--- a/ivy.el
+++ b/ivy.el
@@ -69,7 +69,9 @@
 
 (defcustom ivy-count-format "%-4d "
   "The style of showing the current candidate count for `ivy-read'.
-Set this to nil if you don't want the count."
+Set this to nil if you don't want the count.  You can also set it
+to e.g. \"(%d/%d) \" if you want to see both the candidate index
+and the candidate count."
   :type 'string)
 
 (defcustom ivy-wrap nil
@@ -442,7 +444,7 @@ If the text hasn't changed as a result, forward to 
`ivy-alt-done'."
   (ivy-set-index (max (- ivy--index ivy-height)
   0)))
 (defun ivy-minibuffer-grow ()
-  "Grow the minibuffer window by 1 line"
+  "Grow the minibuffer window by 1 line."
   (interactive)
   (setq-local max-mini-window-height
   (cl-incf ivy-height)))
@@ -494,7 +496,7 @@ If the input is empty, select the previous history element 
instead."
   (ivy-previous-line arg))
 
 (defun ivy-toggle-calling ()
-  "Flip `ivy-calling'"
+  "Flip `ivy-calling'."
   (interactive)
   (when (setq ivy-calling (not ivy-calling))
 (ivy-call)))
@@ -703,7 +705,7 @@ Prioritize directories."
   "An alist of sorting functions for each collection function.
 Interactive functions that call completion fit in here as well.
 
-For each entry, nil means no sorting. It's very useful to turn
+For each entry, nil means no sorting.  It's very useful to turn
 off the sorting for functions that have candidates in the natural
 buffer order, like `org-refile' or `Man-goto-section'.
 



[elpa] master 3164753 14/63: counsel.el (counsel-locate-history): Add

2015-08-21 Thread Oleh Krehel
branch: master
commit 3164753620c939cd25e67661e17397b46d2ae8db
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-locate-history): Add
---
 counsel.el |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index 0e9375d..cf33413 100644
--- a/counsel.el
+++ b/counsel.el
@@ -443,12 +443,16 @@ Skip some dotfiles unless `ivy-text' requires them."
   "Use `dired-jump' on X."
   (dired-jump nil x))
 
+(defvar counsel-locate-history nil
+  "History for `counsel-locate'.")
+
 ;;;###autoload
 (defun counsel-locate ()
   "Call locate shell command."
   (interactive)
   (ivy-read "Locate: " nil
 :dynamic-collection #'counsel-locate-function
+:history 'counsel-locate-history
 :action
 (cons
  1



[elpa] master f6f3963 09/63: Bind case-fold-search to t when the input is all lower-case

2015-08-21 Thread Oleh Krehel
branch: master
commit f6f3963f52ac94f6388deb57fef6659612b6deba
Author: Oleh Krehel 
Commit: Oleh Krehel 

Bind case-fold-search to t when the input is all lower-case

* ivy.el (ivy--filter): Update.

* ivy-test.el (ivy--filter): Add test.

- input "the" matches both "the" and "The".
- input "The" matches only "The".

Fixes #166
---
 ivy-test.el |8 
 ivy.el  |1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/ivy-test.el b/ivy-test.el
index af0fc60..10dd8f9 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -114,3 +114,11 @@
#("\nDESCRIPTION\nFUNCTION 
LETTERS\nSWITCHES\nDIAGNOSTICS\nEXAMPLE 1\nEXAMPLE 2\nEXAMPLE 3\nSEE 
ALSO\nAUTHOR"
  0 90 (read-only nil)
  90 96 (face ivy-current-match read-only nil)
+
+(ert-deftest ivy--filter ()
+  (setq ivy-last (make-ivy-state))
+  (should (equal (ivy--filter "the" '("foo" "the" "The"))
+ '("the" "The")))
+  (should (equal (ivy--filter "The" '("foo" "the" "The"))
+ '("The"
+
diff --git a/ivy.el b/ivy.el
index 45ed244..fc11c3d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1279,6 +1279,7 @@ Should be run via minibuffer `post-command-hook'."
 CANDIDATES are assumed to be static."
   (let* ((re (funcall ivy--regex-function name))
  (matcher (ivy-state-matcher ivy-last))
+ (case-fold-search (string= name (downcase name)))
  (cands (cond
   (matcher
(funcall matcher re candidates))



[elpa] master adad288 27/63: ivy.el (ivy-call): Add selected-window work-around for M-x

2015-08-21 Thread Oleh Krehel
branch: master
commit adad288b69785a02e7207bfc00390f6ddb0429a8
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-call): Add selected-window work-around for M-x

* ivy.el (ivy-call): For some commands that depend on the buffer, like
`counsel-git-grep' the action needs to be performed in
`ivy-state-window'. However, this results in wrong window for M-x calc.
Add a workaround until I figure out why this happens.

Fixes #176
---
 ivy.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 59221e2..8237704 100644
--- a/ivy.el
+++ b/ivy.el
@@ -550,8 +550,10 @@ If the input is empty, select the previous history element 
instead."
  (consp (car collection)))
 (cdr (assoc ivy--current collection))
   ivy--current)))
-(with-selected-window (ivy-state-window ivy-last)
-  (funcall action x))
+(if (eq (ivy-state-history ivy-last) 'extended-command-history)
+(funcall action x)
+  (with-selected-window (ivy-state-window ivy-last)
+(funcall action x)))
 
 (defun ivy-next-line-and-call (&optional arg)
   "Move cursor vertically down ARG candidates.



[elpa] master 8c91662 22/63: ivy.el (ivy-call): Bind to "C-M-m" or "M-RET"

2015-08-21 Thread Oleh Krehel
branch: master
commit 8c91662adcd29c93e3bb3ae7faf3ffe385080436
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-call): Bind to "C-M-m" or "M-RET"

"C-M-m" is close to "C-M-n" and "C-M-p", just as "M-RET" is close to
"RET". Previously, the only binding was "C-o g".
---
 ivy.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ivy.el b/ivy.el
index b2d4680..59221e2 100644
--- a/ivy.el
+++ b/ivy.el
@@ -130,6 +130,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse 
order."
 (define-key map (kbd "M-v") 'ivy-scroll-down-command)
 (define-key map (kbd "C-M-n") 'ivy-next-line-and-call)
 (define-key map (kbd "C-M-p") 'ivy-previous-line-and-call)
+(define-key map (kbd "C-M-m") 'ivy-call)
 (define-key map (kbd "M-q") 'ivy-toggle-regexp-quote)
 (define-key map (kbd "M-j") 'ivy-yank-word)
 (define-key map (kbd "M-i") 'ivy-insert-current)



[elpa] master 9ca6f48 30/63: Allow "C-g" to interrupt ivy-dispatching-done

2015-08-21 Thread Oleh Krehel
branch: master
commit 9ca6f48c7957fe7e9e0d7b83f81a15a961c35249
Author: Oleh Krehel 
Commit: Oleh Krehel 

Allow "C-g" to interrupt ivy-dispatching-done

* ivy.el (ivy-dispatching-done): Update.
---
 ivy.el |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/ivy.el b/ivy.el
index 8e24f1f..5f8e5de 100644
--- a/ivy.el
+++ b/ivy.el
@@ -286,11 +286,13 @@ When non-nil, it should contain one %d.")
 "\n"))
  (key (string (read-key hint)))
  (action (assoc key (cdr actions
-(if (null action)
-(error "%s is not bound" key)
-  (message "")
-  (ivy-set-action (nth 1 action))
-  (ivy-done))
+(cond ((string= key ""))
+  ((null action)
+   (error "%s is not bound" key))
+  (t
+   (message "")
+   (ivy-set-action (nth 1 action))
+   (ivy-done)))
 
 (defun ivy-build-tramp-name (x)
   "Reconstruct X into a path.



[elpa] master 2fbcfb9 29/63: ivy.el (ivy--preselect-index): Add matcher to arglist

2015-08-21 Thread Oleh Krehel
branch: master
commit 2fbcfb970d060a895d8b5818e750a1143d0e24db
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy--preselect-index): Add matcher to arglist

* ivy.el (ivy--reset-state): Call `ivy--preselect-index' with matcher.
(ivy--preselect-index): In case there's a special matcher set, it
affects the candidate list, therefore it affects the preselect index.

Fixes #165
---
 ivy.el |   29 ++---
 1 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/ivy.el b/ivy.el
index bc26b6f..8e24f1f 100644
--- a/ivy.el
+++ b/ivy.el
@@ -893,7 +893,8 @@ This is useful for recursive `ivy-read'."
 (re-builder (ivy-state-re-builder state))
 (dynamic-collection (ivy-state-dynamic-collection state))
 (initial-input (ivy-state-initial-input state))
-(require-match (ivy-state-require-match state)))
+(require-match (ivy-state-require-match state))
+(matcher (ivy-state-matcher state)))
 (unless initial-input
   (setq initial-input (cdr (assoc this-command
   ivy-initial-inputs-alist
@@ -968,7 +969,7 @@ This is useful for recursive `ivy-read'."
  ivy--index)
 (and preselect
  (ivy--preselect-index
-  coll initial-input preselect))
+  coll initial-input preselect matcher))
 0))
   (setq ivy--old-re nil)
   (setq ivy--old-cands nil)
@@ -1051,15 +1052,21 @@ Minibuffer bindings:
   (setq completing-read-function 'ivy-completing-read)
 (setq completing-read-function 'completing-read-default)))
 
-(defun ivy--preselect-index (candidates initial-input preselect)
-  "Return the index in CANDIDATES filtered by INITIAL-INPUT for PRESELECT."
-  (when initial-input
-(setq initial-input (ivy--regex-plus initial-input))
-(setq candidates
-  (cl-remove-if-not
-   (lambda (x)
- (string-match initial-input x))
-   candidates)))
+(defun ivy--preselect-index (candidates initial-input preselect matcher)
+  "Return the index in CANDIDATES filtered by INITIAL-INPUT for PRESELECT.
+When MATCHER is non-nil it's used instead of `cl-remove-if-not'."
+  (if initial-input
+  (progn
+(setq initial-input (ivy--regex-plus initial-input))
+(setq candidates
+  (if matcher
+  (funcall matcher initial-input candidates)
+(cl-remove-if-not
+ (lambda (x)
+   (string-match initial-input x))
+ candidates
+(when matcher
+  (setq candidates (funcall matcher "" candidates
   (or (cl-position preselect candidates :test #'equal)
   (cl-position-if
(lambda (x)



[elpa] master ea6525e 18/63: ivy.el (ivy-read): Improve ivy-set-actions interaction

2015-08-21 Thread Oleh Krehel
branch: master
commit ea6525e6bdddb6c4c7d175613aa1d6536afd0a1b
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-read): Improve ivy-set-actions interaction

* ivy.el (ivy-read): When the base action is already a list, merge it
  with the one obtained from `ivy-set-actions'.
---
 ivy.el |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index 876204f..58b2529 100644
--- a/ivy.el
+++ b/ivy.el
@@ -800,9 +800,11 @@ candidates with each input."
   (let ((extra-actions (plist-get ivy--actions-list this-command)))
 (when extra-actions
   (setq action
-`(1
-  ("default" ,action)
-  ,@extra-actions
+(if (functionp action)
+`(1
+  ("default" ,action)
+  ,@extra-actions)
+  (delete-dups (append action extra-actions))
   (setq ivy-last
 (make-ivy-state
  :prompt prompt



[elpa] master 548a766 08/63: ivy.el (ivy--reset-state): Fixup

2015-08-21 Thread Oleh Krehel
branch: master
commit 548a766ddf93abaaecbb855572d115ebb03d27d3
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy--reset-state): Fixup
---
 ivy.el |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index dfed9f4..45ed244 100644
--- a/ivy.el
+++ b/ivy.el
@@ -872,8 +872,9 @@ This is useful for recursive `ivy-read'."
  (require 'dired)
  (when preselect
(let ((preselect-directory (file-name-directory preselect)))
- (unless (string= preselect-directory
-  default-directory)
+ (unless (or (null preselect-directory)
+ (string= preselect-directory
+  default-directory))
(setq coll (ivy--sorted-files
(setq ivy--directory preselect-directory)))
(setq preselect (file-name-nondirectory preselect)



[elpa] master 082fbbc 05/63: Add a multi-action interface for counsel-locate

2015-08-21 Thread Oleh Krehel
branch: master
commit 082fbbc71f8bd82e02163550d3b7efa261929169
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add a multi-action interface for counsel-locate

* ivy-hydra.el (hydra-ivy): Display the current action and allow to
  scroll the action list with "w" and "s".

* ivy.el (ivy--get-action): New defun, a getter for the action function,
  since it can also be a list now.
(ivy--actionp): New defun, checks for the action list.
(ivy-next-action): New command, scrolls to the next action in the list.
(ivy-prev-action): New command, scrolls to the previous action in the
list.
(ivy-action-name): New defun.
(ivy-call): Use `ivy--get-action'.
(ivy-read): Use `ivy--get-action'.
---
 counsel.el   |   26 +-
 ivy-hydra.el |   10 ++
 ivy.el   |   47 +++
 3 files changed, 70 insertions(+), 13 deletions(-)

diff --git a/counsel.el b/counsel.el
index 1652b20..0e9375d 100644
--- a/counsel.el
+++ b/counsel.el
@@ -432,15 +432,31 @@ Skip some dotfiles unless `ivy-text' requires them."
 (if (string= event "exited abnormally with code 1\n")
 (message "Error"
 
+(defun counsel-locate-action-extern (x)
+  "Use xdg-open shell command on X."
+  (call-process shell-file-name nil
+nil nil
+shell-command-switch
+(format "xdg-open %s" (shell-quote-argument x
+
+(defun counsel-locate-action-dired (x)
+  "Use `dired-jump' on X."
+  (dired-jump nil x))
+
 ;;;###autoload
 (defun counsel-locate ()
-  "Call locate."
+  "Call locate shell command."
   (interactive)
-  (ivy-read "pattern: " nil
+  (ivy-read "Locate: " nil
 :dynamic-collection #'counsel-locate-function
-:action (lambda (val)
-  (when val
-(find-file val)
+:action
+(cons
+ 1
+ '(("default" (lambda (val)
+(when val
+  (find-file val
+   ("xdg-open" counsel-locate-action-extern)
+   ("dired" counsel-locate-action-dired)
 
 (defun counsel--generic (completion-fn)
   "Complete thing at point with COMPLETION-FN."
diff --git a/ivy-hydra.el b/ivy-hydra.el
index 03e4d20..030978f 100644
--- a/ivy-hydra.el
+++ b/ivy-hydra.el
@@ -47,9 +47,9 @@
 (defhydra hydra-ivy (:hint nil
  :color pink)
   "
-^^  ^Yes^ ^No^ ^Maybe^
-^^---
-^ ^ _k_ ^ ^ _f_ollow  _i_nsert _c_: calling %s(if ivy-calling \"on\" 
\"off\")
+^^  ^Yes^ ^No^ ^Maybe^   ^Action^ 
+^^---
+^ ^ _k_ ^ ^ _f_ollow  _i_nsert _c_: calling %s(if ivy-calling \"on\" 
\"off\")  _w_/_s_: %s(ivy-action-name)
 _h_ ^+^ _l_ _d_one_o_ops   _m_: matcher %s(if (eq ivy--regex-function 
'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")
 ^ ^ _j_ ^ ^ ^ ^   ^ ^  _<_/_>_: shrink/grow window
 "
@@ -70,7 +70,9 @@ _h_ ^+^ _l_ _d_one_o_ops   _m_: matcher %s(if (eq 
ivy--regex-function 'i
   ("c" ivy-toggle-calling)
   ("m" ivy-toggle-fuzzy)
   (">" ivy-minibuffer-grow)
-  ("<" ivy-minibuffer-shrink))
+  ("<" ivy-minibuffer-shrink)
+  ("w" ivy-prev-action)
+  ("s" ivy-next-action))
 
 (provide 'ivy-hydra)
 
diff --git a/ivy.el b/ivy.el
index 6ecfb4b..1c5f5b9 100644
--- a/ivy.el
+++ b/ivy.el
@@ -491,11 +491,50 @@ If the input is empty, select the previous history 
element instead."
   (when (setq ivy-calling (not ivy-calling))
 (ivy-call)))
 
+(defun ivy--get-action (state)
+  "Get the action function from STATE."
+  (let ((action (ivy-state-action state)))
+(when action
+  (if (functionp action)
+  action
+(cadr (nth (car action) action))
+
+(defun ivy--actionp (x)
+  "Return non-nil when X is a list of actions."
+  (and x (listp x) (not (eq (car x) 'closure
+
+(defun ivy-next-action ()
+  "When the current action is a list, scroll it forwards."
+  (interactive)
+  (let ((action (ivy-state-action ivy-last)))
+(when (ivy--actionp action)
+  (unless (>= (car action) (1- (length action)))
+(cl-incf (car action))
+
+(defun ivy-prev-action ()
+  "When the current action is a list, scroll it backwards."
+  (interactive)
+  (let ((action (ivy-state-action ivy-last)))
+(when (ivy--actionp action)
+  (unless (<= (car action) 1)
+(cl-decf (car action))
+
+(defun ivy-action-name ()
+  "Return the name associated with the current action."
+  (let ((action (ivy-state-action ivy-last)))
+(if (ivy--actionp action)
+(format "[%d/%d] %s"
+(car action)
+(1- (length action))
+(car (nth (car action) action)))
+  "[1/1] default")))
+
 (defun ivy-call ()
   "Call the current action without exiting completion."
-  (when (ivy-state-action ivy-last

[elpa] master 36e8fe3 46/63: counsel.el (counsel-org-tag): No need to be at heading

2015-08-21 Thread Oleh Krehel
branch: master
commit 36e8fe31f700ecdfb7580f5149ab6000d5bf1aac
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-org-tag): No need to be at heading

* counsel.el (counsel-org-tag): When not at heading, move there.
Save excursion.
---
 counsel.el |   29 -
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/counsel.el b/counsel.el
index 756b0a8..04be3db 100644
--- a/counsel.el
+++ b/counsel.el
@@ -812,19 +812,22 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 (defun counsel-org-tag ()
   "Add or remove tags in org-mode."
   (interactive)
-  (setq counsel-org-tags (split-string (org-get-tags-string) ":" t))
-  (let ((org-setting-tags t)
-(org-last-tags-completion-table
- (append org-tag-persistent-alist
- (or org-tag-alist (org-get-buffer-tags))
- (and
-  org-complete-tags-always-offer-all-agenda-tags
-  (org-global-tags-completion-table
-   (org-agenda-files))
-(ivy-read (counsel-org-tag-prompt)
-  'org-tags-completion-function
-  :history 'org-tags-history
-  :action 'counsel-org-tag-action)))
+  (save-excursion
+(unless (org-at-heading-p)
+  (org-back-to-heading t))
+(setq counsel-org-tags (split-string (org-get-tags-string) ":" t))
+(let ((org-setting-tags t)
+  (org-last-tags-completion-table
+   (append org-tag-persistent-alist
+   (or org-tag-alist (org-get-buffer-tags))
+   (and
+org-complete-tags-always-offer-all-agenda-tags
+(org-global-tags-completion-table
+ (org-agenda-files))
+  (ivy-read (counsel-org-tag-prompt)
+'org-tags-completion-function
+:history 'org-tags-history
+:action 'counsel-org-tag-action
 
 (defun counsel-ag-function (string &optional _pred &rest _unused)
   "Grep in the current directory for STRING."



[elpa] master 5480079 28/63: ivy.el (ivy-dispatching-done): New command on "M-o"

2015-08-21 Thread Oleh Krehel
branch: master
commit 5480079653d6c7ec59af5e7d79b2eda5bfe1c190
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-dispatching-done): New command on "M-o"

* ivy.el (ivy-minibuffer-map): Bind "M-o" to `ivy-dispatching-done'.
(ivy-action-name): Update, all actions are now in hydra's format - key
binding, command, hint.
(ivy-read): The default action is bound to "o" in the dispatch.
(ivy-switch-buffer): Update to new action format.

* counsel.el (counsel-locate):
(counsel-rhythmbox): Update to new action format.

The new interface allows to do whatever you want with the selected
candidate with a very short key binding.

The old interface with "C-o w/s" still works, but:

- it gives a lot more info than necessary for only selecting action
- doesn't scale well with the number of actions: for 10 actions you
  would cycle "w/s" a lot.

Example with `ivy-switch-buffer':

- switch to selected buffer: "C-m"
- kill selected buffer: "M-o k"; you get a hint right after "M-o".

When there is only one action, "M-o" will forward to "C-m".
---
 counsel.el |8 
 ivy.el |   33 +
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/counsel.el b/counsel.el
index bbb8230..7d39f9a 100644
--- a/counsel.el
+++ b/counsel.el
@@ -453,8 +453,8 @@ Skip some dotfiles unless `ivy-text' requires them."
 
 (ivy-set-actions
  'counsel-locate
- '(("xdg-open" counsel-locate-action-extern)
-   ("dired" counsel-locate-action-dired)))
+ '(("x" counsel-locate-action-extern "xdg-open")
+   ("d" counsel-locate-action-dired "dired")))
 
 ;;;###autoload
 (defun counsel-locate ()
@@ -721,8 +721,8 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 :history 'counsel-rhythmbox-history
 :action
 '(1
-  ("Play song" helm-rhythmbox-play-song)
-  ("Enqueue song" counsel-rhythmbox-enqueue-song
+  ("p" helm-rhythmbox-play-song "Play song")
+  ("e" counsel-rhythmbox-enqueue-song "Enqueue song"
 
 (provide 'counsel)
 
diff --git a/ivy.el b/ivy.el
index 8237704..bc26b6f 100644
--- a/ivy.el
+++ b/ivy.el
@@ -135,6 +135,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse 
order."
 (define-key map (kbd "M-j") 'ivy-yank-word)
 (define-key map (kbd "M-i") 'ivy-insert-current)
 (define-key map (kbd "C-o") 'hydra-ivy/body)
+(define-key map (kbd "M-o") 'ivy-dispatching-done)
 (define-key map (kbd "C-k") 'ivy-kill-line)
 (define-key map (kbd "S-SPC") 'ivy-restrict-to-matches)
 map)
@@ -268,6 +269,29 @@ When non-nil, it should contain one %d.")
  (insert ivy-text)
  (ivy--exhibit
 
+(defun ivy-dispatching-done ()
+  "Select one of the available actions and call `ivy-done'."
+  (interactive)
+  (let ((actions (ivy-state-action ivy-last)))
+(if (null (ivy--actionp actions))
+(ivy-done)
+  (let* ((hint (mapconcat
+(lambda (x)
+  (format "%s: %s"
+  (propertize
+   (car x)
+   'face 'font-lock-builtin-face)
+  (nth 2 x)))
+(cdr actions)
+"\n"))
+ (key (string (read-key hint)))
+ (action (assoc key (cdr actions
+(if (null action)
+(error "%s is not bound" key)
+  (message "")
+  (ivy-set-action (nth 1 action))
+  (ivy-done))
+
 (defun ivy-build-tramp-name (x)
   "Reconstruct X into a path.
 Is is a cons cell, related to `tramp-get-completion-function'."
@@ -537,7 +561,7 @@ If the input is empty, select the previous history element 
instead."
 (format "[%d/%d] %s"
 (car action)
 (1- (length action))
-(car (nth (car action) action)))
+(nth 2 (nth (car action) action)))
   "[1/1] default")))
 
 (defun ivy-call ()
@@ -808,7 +832,7 @@ candidates with each input."
   (setq action
 (if (functionp action)
 `(1
-  ("default" ,action)
+  ("o" ,action "default")
   ,@extra-actions)
   (delete-dups (append action extra-actions))
   (setq ivy-last
@@ -1519,10 +1543,11 @@ BUFFER may be a string or nil."
 
 (ivy-set-actions
  'ivy-switch-buffer
- '(("kill"
+ '(("k"
 (lambda (x)
   (kill-buffer x)
-  (ivy--reset-state ivy-last)
+  (ivy--reset-state ivy-last))
+"kill")))
 
 (defun ivy-switch-buffer ()
   "Switch to another buffer."



[elpa] master d5af987 11/63: ivy.el (ivy--reset-state): Fixup

2015-08-21 Thread Oleh Krehel
branch: master
commit d5af9871cd7e5d8f414feb0ae42a8c5353726c6b
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy--reset-state): Fixup

Re #165
---
 ivy.el |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/ivy.el b/ivy.el
index 4aff281..9a27ebd 100644
--- a/ivy.el
+++ b/ivy.el
@@ -876,11 +876,9 @@ This is useful for recursive `ivy-read'."
  (unless (or (null preselect-directory)
  (string= preselect-directory
   default-directory))
-   (setq coll (ivy--sorted-files
-   (setq ivy--directory preselect-directory)))
-   (setq preselect (file-name-nondirectory preselect)
- (setq coll
-   (ivy--sorted-files default-directory))
+   (setq ivy--directory preselect-directory))
+ (setq preselect (file-name-nondirectory preselect
+ (setq coll (ivy--sorted-files ivy--directory))
  (when initial-input
(unless (or require-match
(equal initial-input default-directory)



[elpa] master e91a4eb 31/63: ivy.el (ivy-dispatching-done): Display the candidate

2015-08-21 Thread Oleh Krehel
branch: master
commit e91a4ebc6b2d353e8e046501c39f7ee836aa89de
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-dispatching-done): Display the candidate
---
 ivy.el |   20 +++-
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/ivy.el b/ivy.el
index 5f8e5de..bd11501 100644
--- a/ivy.el
+++ b/ivy.el
@@ -275,15 +275,17 @@ When non-nil, it should contain one %d.")
   (let ((actions (ivy-state-action ivy-last)))
 (if (null (ivy--actionp actions))
 (ivy-done)
-  (let* ((hint (mapconcat
-(lambda (x)
-  (format "%s: %s"
-  (propertize
-   (car x)
-   'face 'font-lock-builtin-face)
-  (nth 2 x)))
-(cdr actions)
-"\n"))
+  (let* ((hint (concat ivy--current
+   "\n"
+   (mapconcat
+(lambda (x)
+  (format "%s: %s"
+  (propertize
+   (car x)
+   'face 'font-lock-builtin-face)
+  (nth 2 x)))
+(cdr actions)
+"\n")))
  (key (string (read-key hint)))
  (action (assoc key (cdr actions
 (cond ((string= key ""))



[elpa] master 19dcc0f 16/63: ivy.el (ivy--regex): Improve for trailing backslash

2015-08-21 Thread Oleh Krehel
branch: master
commit 19dcc0ff119f5fc099829979ed36043b1b42eefc
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy--regex): Improve for trailing backslash

When there's a single trailing backslash, which would result in a bad
regex, ignore it.
---
 ivy.el |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ivy.el b/ivy.el
index dc6c412..a768c18 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1073,6 +1073,8 @@ When GREEDY is non-nil, join words in a greedy way."
 (if hashed
 (prog1 (cdr hashed)
   (setq ivy--subexps (car hashed)))
+  (when (string-match "\\([^\\]\\|^\\)$" str)
+(setq str (substring str 0 -1)))
   (cdr (puthash str
 (let ((subs (ivy--split str)))
   (if (= (length subs) 1)



[elpa] master fe6d2b1 07/63: Make ffap work again

2015-08-21 Thread Oleh Krehel
branch: master
commit fe6d2b17326625160a89d71ec6b2244270b66baa
Author: Oleh Krehel 
Commit: Oleh Krehel 

Make ffap work again

* ivy.el (ivy--reset-state): When completing files, consider the case
  when the directory of PRESELECT isn't `default-directory'.

Fixes #165
---
 ivy.el |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/ivy.el b/ivy.el
index 4bb6278..dfed9f4 100644
--- a/ivy.el
+++ b/ivy.el
@@ -870,6 +870,13 @@ This is useful for recursive `ivy-read'."
 ((eq collection 'read-file-name-internal)
  (setq ivy--directory default-directory)
  (require 'dired)
+ (when preselect
+   (let ((preselect-directory (file-name-directory preselect)))
+ (unless (string= preselect-directory
+  default-directory)
+   (setq coll (ivy--sorted-files
+   (setq ivy--directory preselect-directory)))
+   (setq preselect (file-name-nondirectory preselect)
  (setq coll
(ivy--sorted-files default-directory))
  (when initial-input



[elpa] master acf4485 42/63: ivy.el (ivy--exhibit): Check if in post-command-hook

2015-08-21 Thread Oleh Krehel
branch: master
commit acf4485e7904205e02f8644c292691bac988d760
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy--exhibit): Check if in post-command-hook

* ivy.el (ivy--exhibit): A situation can occur when an async command
  calls `ivy--exhibit' in the sentinel. It causes problems when the
  minibuffer has already exited with "C-g".
---
 ivy.el |   87 ---
 1 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/ivy.el b/ivy.el
index e42504e..78547ce 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1282,49 +1282,50 @@ Insert .* between each char."
 (defun ivy--exhibit ()
   "Insert Ivy completions display.
 Should be run via minibuffer `post-command-hook'."
-  (setq ivy-text (ivy--input))
-  (if (ivy-state-dynamic-collection ivy-last)
-  ;; while-no-input would cause annoying
-  ;; "Waiting for process to die...done" message interruptions
-  (let ((inhibit-message t))
-(unless (equal ivy--old-text ivy-text)
-  (while-no-input
-;; dynamic collection should take care of everything
-(funcall (ivy-state-dynamic-collection ivy-last) ivy-text)
-(setq ivy--old-text ivy-text)))
-(ivy--insert-minibuffer
- (ivy--format ivy--all-candidates)))
-(cond (ivy--directory
-   (if (string-match "/\\'" ivy-text)
-   (if (member ivy-text ivy--all-candidates)
-   (ivy--cd (expand-file-name ivy-text ivy--directory))
- (when (string-match "//\\'" ivy-text)
-   (if (and default-directory
-(string-match "\\`[[:alpha:]]:/" 
default-directory))
-   (ivy--cd (match-string 0 default-directory))
- (ivy--cd "/")))
- (when (string-match "[[:alpha:]]:/" ivy-text)
-   (let ((drive-root (match-string 0 ivy-text)))
- (when (file-exists-p drive-root)
-   (ivy--cd drive-root)
- (if (string-match "\\`~\\'" ivy-text)
- (ivy--cd (expand-file-name "~/")
-  ((eq (ivy-state-collection ivy-last) 'internal-complete-buffer)
-   (when (or (and (string-match "\\` " ivy-text)
-  (not (string-match "\\` " ivy--old-text)))
- (and (string-match "\\` " ivy--old-text)
-  (not (string-match "\\` " ivy-text
- (setq ivy--all-candidates
-   (if (and (> (length ivy-text) 0)
-(eq (aref ivy-text 0)
-?\ ))
-   (ivy--buffer-list " ")
- (ivy--buffer-list "" ivy-use-virtual-buffers)))
- (setq ivy--old-re nil
-(ivy--insert-minibuffer
- (ivy--format
-  (ivy--filter ivy-text ivy--all-candidates)))
-(setq ivy--old-text ivy-text)))
+  (when (memq 'ivy--exhibit post-command-hook)
+(setq ivy-text (ivy--input))
+(if (ivy-state-dynamic-collection ivy-last)
+;; while-no-input would cause annoying
+;; "Waiting for process to die...done" message interruptions
+(let ((inhibit-message t))
+  (unless (equal ivy--old-text ivy-text)
+(while-no-input
+  ;; dynamic collection should take care of everything
+  (funcall (ivy-state-dynamic-collection ivy-last) ivy-text)
+  (setq ivy--old-text ivy-text)))
+  (ivy--insert-minibuffer
+   (ivy--format ivy--all-candidates)))
+  (cond (ivy--directory
+ (if (string-match "/\\'" ivy-text)
+ (if (member ivy-text ivy--all-candidates)
+ (ivy--cd (expand-file-name ivy-text ivy--directory))
+   (when (string-match "//\\'" ivy-text)
+ (if (and default-directory
+  (string-match "\\`[[:alpha:]]:/" 
default-directory))
+ (ivy--cd (match-string 0 default-directory))
+   (ivy--cd "/")))
+   (when (string-match "[[:alpha:]]:/" ivy-text)
+ (let ((drive-root (match-string 0 ivy-text)))
+   (when (file-exists-p drive-root)
+ (ivy--cd drive-root)
+   (if (string-match "\\`~\\'" ivy-text)
+   (ivy--cd (expand-file-name "~/")
+((eq (ivy-state-collection ivy-last) 'internal-complete-buffer)
+ (when (or (and (string-match "\\` " ivy-text)
+(not (string-match "\\` " ivy--old-text)))
+   (and (string-match "\\` " ivy--old-text)
+(not (string-match "\\` " ivy-text
+   (setq ivy--all-candidates
+ (if (and (> (length ivy-text) 0)
+  (eq (aref ivy-text 0)
+  ?\ ))
+

[elpa] master 1aa7520 03/63: Add a custom keymap for counsel-find-file

2015-08-21 Thread Oleh Krehel
branch: master
commit 1aa75204906549af2f5aac10a83facf1f61fe1cc
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add a custom keymap for counsel-find-file

* counsel.el (counsel-find-file-map): New defvar.

Re #164
---
 counsel.el |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index 94c8608..8ba4457 100644
--- a/counsel.el
+++ b/counsel.el
@@ -336,6 +336,8 @@
 
 (declare-function ffap-guesser "ffap")
 
+(defvar counsel-find-file-map (make-sparse-keymap))
+
 ;;;###autoload
 (defun counsel-find-file ()
   "Forward to `find-file'."



[elpa] master 6ab519f 48/63: counsel.el (counsel-org-tag): Delete dups

2015-08-21 Thread Oleh Krehel
branch: master
commit 6ab519ff92143bfcee549471dbf5def3bdae3185
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-org-tag): Delete dups

The issue of duplicates arises from this setting (off by default):

(setq org-complete-tags-always-offer-all-agenda-tags t)

Re #177
---
 counsel.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/counsel.el b/counsel.el
index 1d85b0b..bf59f5b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -825,7 +825,9 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 (org-global-tags-completion-table
  (org-agenda-files))
   (ivy-read (counsel-org-tag-prompt)
-'org-tags-completion-function
+(lambda (str &rest _unused)
+  (delete-dups
+   (all-completions str 'org-tags-completion-function)))
 :history 'org-tags-history
 :action 'counsel-org-tag-action
 



[elpa] master 3464362 33/63: Add actions for counsel-describe-variable

2015-08-21 Thread Oleh Krehel
branch: master
commit 346436284b036452e585ca6e8a8834d0c77ae998
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add actions for counsel-describe-variable
---
 counsel.el |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index 7d39f9a..4c3c482 100644
--- a/counsel.el
+++ b/counsel.el
@@ -169,6 +169,11 @@
(describe-variable
 (intern x))
 
+(ivy-set-actions
+ 'counsel-describe-variable
+ '(("i" counsel-info-lookup-symbol "info")
+   ("d" counsel--find-symbol "definition")))
+
 ;;;###autoload
 (defun counsel-describe-function ()
   "Forward to `describe-function'."



[elpa] master a9ff1f1 38/63: counsel.el (counsel-org-change-tags): Improve removing tags

2015-08-21 Thread Oleh Krehel
branch: master
commit a9ff1f17646103bc825132d3b5ea682b35cd
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-org-change-tags): Improve removing tags
---
 counsel.el |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index 4a014f0..6004891 100644
--- a/counsel.el
+++ b/counsel.el
@@ -760,7 +760,10 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
   ((re-search-forward
 (concat "\\([ \t]*" (regexp-quote current) "\\)[ \t]*$")
 (point-at-eol) t)
-   (unless (equal tags "")
+   (if (equal tags "")
+   (delete-region
+(match-beginning 0)
+(match-end 0))
  (goto-char (match-beginning 0))
  (let* ((c0 (current-column))
 ;; compute offset for the case of org-indent-mode active
@@ -790,8 +793,10 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
   (cond ((memq this-command '(ivy-done ivy-alt-done))
  (with-selected-window (ivy-state-window ivy-last)
(counsel-org-change-tags
-(format ":%s:"
-(mapconcat #'identity counsel-org-tags ":")
+(if counsel-org-tags
+(format ":%s:"
+(mapconcat #'identity counsel-org-tags ":"))
+  ""
 ((eq this-command 'ivy-call)
  (delete-minibuffer-contents
 



[elpa] master dba4e47 50/63: counsel.el (org-bound-and-true-p): Update declare

2015-08-21 Thread Oleh Krehel
branch: master
commit dba4e47cb36dde92ec9b7e01f39d08b382dbb2ff
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (org-bound-and-true-p): Update declare
---
 counsel.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/counsel.el b/counsel.el
index 3b91d69..b5ad6a0 100644
--- a/counsel.el
+++ b/counsel.el
@@ -747,7 +747,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 (defvar org-indent-indentation-per-level)
 (defvar org-tags-column)
 (declare-function org-get-tags-string "org")
-(declare-function org-bound-and-true-p "org")
+(declare-function org-bound-and-true-p "org-macs")
 (declare-function org-move-to-column "org")
 
 (defun counsel-org-change-tags (tags)



[elpa] master bb953c6 01/63: ivy.el (ivy-restrict-to-matches): Add and bind to "S-SPC"

2015-08-21 Thread Oleh Krehel
branch: master
commit bb953c60d68952c6c345967d55eed94791cf46cd
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-restrict-to-matches): Add and bind to "S-SPC"
---
 ivy.el |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/ivy.el b/ivy.el
index f64782c..f322b64 100644
--- a/ivy.el
+++ b/ivy.el
@@ -125,6 +125,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse 
order."
 (define-key map (kbd "M-i") 'ivy-insert-current)
 (define-key map (kbd "C-o") 'hydra-ivy/body)
 (define-key map (kbd "C-k") 'ivy-kill-line)
+(define-key map (kbd "S-SPC") 'ivy-restrict-to-matches)
 map)
   "Keymap used in the minibuffer.")
 (autoload 'hydra-ivy/body "ivy-hydra" "" t)
@@ -1483,6 +1484,13 @@ The selected history element will be inserted into the 
minibufer."
 (insert (substring-no-properties x))
 (ivy--cd-maybe)
 
+(defun ivy-restrict-to-matches ()
+  "Restrict candidates to current matches and erase input."
+  (interactive)
+  (delete-minibuffer-contents)
+  (setq ivy--all-candidates
+(ivy--filter ivy-text ivy--all-candidates)))
+
 (provide 'ivy)
 
 ;;; ivy.el ends here



[elpa] master cb0cf02 35/63: ivy.el (ivy-call): Remove with-selected-window

2015-08-21 Thread Oleh Krehel
branch: master
commit cb0cf0258dd59bf1bc00eba6bd6c23e3cbaefb8b
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-call): Remove with-selected-window

* counsel.el (counsel-git-grep-action): Add with-selected-window.

* ivy.el (ivy-dispatching-done): Remove trailing ": ".
(ivy-switch-buffer): Add extra action "j" calls
`switch-to-buffer-other-window'. The change `ivy-dispatching-done' had
to be done because of this.
---
 counsel.el |   21 +++--
 ivy.el |   16 +---
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/counsel.el b/counsel.el
index 15a14db..e892c3e 100644
--- a/counsel.el
+++ b/counsel.el
@@ -310,16 +310,17 @@
 
 (defun counsel-git-grep-action (x)
   (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" x)
-(let ((file-name (match-string-no-properties 1 x))
-  (line-number (match-string-no-properties 2 x)))
-  (find-file (expand-file-name file-name counsel--git-grep-dir))
-  (goto-char (point-min))
-  (forward-line (1- (string-to-number line-number)))
-  (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
-  (unless (eq ivy-exit 'done)
-(setq swiper--window (selected-window))
-(swiper--cleanup)
-(swiper--add-overlays (ivy--regex ivy-text))
+(with-selected-window (ivy-state-window ivy-last)
+  (let ((file-name (match-string-no-properties 1 x))
+(line-number (match-string-no-properties 2 x)))
+(find-file (expand-file-name file-name counsel--git-grep-dir))
+(goto-char (point-min))
+(forward-line (1- (string-to-number line-number)))
+(re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
+(unless (eq ivy-exit 'done)
+  (setq swiper--window (selected-window))
+  (swiper--cleanup)
+  (swiper--add-overlays (ivy--regex ivy-text)))
 
 (defvar counsel-git-grep-history nil
   "History for `counsel-git-grep'.")
diff --git a/ivy.el b/ivy.el
index 989a34e..28463b7 100644
--- a/ivy.el
+++ b/ivy.el
@@ -286,7 +286,7 @@ When non-nil, it should contain one %d.")
   (nth 2 x)))
 (cdr actions)
 "\n")
-   "\n: "))
+   "\n"))
  (key (string (read-key hint)))
  (action (assoc key (cdr actions
 (cond ((string= key ""))
@@ -578,11 +578,10 @@ If the input is empty, select the previous history 
element instead."
  (x (if (and (consp collection)
  (consp (car collection)))
 (cdr (assoc ivy--current collection))
-  ivy--current)))
-(if (eq (ivy-state-history ivy-last) 'extended-command-history)
-(funcall action x)
-  (with-selected-window (ivy-state-window ivy-last)
-(funcall action x)))
+  (if (equal ivy--current "")
+  ivy-text
+ivy--current
+(funcall action x)
 
 (defun ivy-next-line-and-call (&optional arg)
   "Move cursor vertically down ARG candidates.
@@ -1559,7 +1558,10 @@ BUFFER may be a string or nil."
 (lambda (x)
   (kill-buffer x)
   (ivy--reset-state ivy-last))
-"kill")))
+"kill")
+   ("j"
+switch-to-buffer-other-window
+"other")))
 
 (defun ivy-switch-buffer ()
   "Switch to another buffer."



[elpa] master 3df2d8e 26/63: ivy-hydra.el: Add featurep for hydra

2015-08-21 Thread Oleh Krehel
branch: master
commit 3df2d8e7d0238357c62f60cb92a1e590e79e7c81
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy-hydra.el: Add featurep for hydra

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

diff --git a/ivy-hydra.el b/ivy-hydra.el
index cdaff1f..6ab1f9a 100644
--- a/ivy-hydra.el
+++ b/ivy-hydra.el
@@ -30,7 +30,7 @@
 (require 'ivy)
 
 (eval-when-compile
-  (unless (package-installed-p 'hydra)
+  (unless (or (featurep 'hydra) (package-installed-p 'hydra))
 (defmacro defhydra (name &rest _)
   "This is a stub for the uninstalled `hydra' package."
   `(defun ,(intern (format "%S/body" name)) ()
@@ -47,7 +47,7 @@
 (defhydra hydra-ivy (:hint nil
  :color pink)
   "
-^^  ^Yes^ ^No^ ^Maybe^   ^Action^ 
+^^  ^Yes^ ^No^ ^Maybe^   ^Action^
 ^^---
 ^ ^ _k_ ^ ^ _f_ollow  _i_nsert _c_: calling %s(if ivy-calling \"on\" 
\"off\")  _w_/_s_: %s(ivy-action-name)
 _h_ ^+^ _l_ _d_one_o_ops   _m_: matcher %s(if (eq ivy--regex-function 
'ivy--regex-fuzzy) \"fuzzy\" \"ivy\")



[elpa] master 5b61577 49/63: Use recoll -t instead of recollq

2015-08-21 Thread Oleh Krehel
branch: master
commit 5b615776bd5a03f98a05c42eac5e1603a19d4fcd
Author: Erik Hetzner 
Commit: Erik Hetzner 

Use recoll -t instead of recollq
---
 counsel.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/counsel.el b/counsel.el
index bf59f5b..3b91d69 100644
--- a/counsel.el
+++ b/counsel.el
@@ -861,7 +861,7 @@ INITIAL-INPUT can be given as the initial minibuffer input."
   (if (< (length string) 3)
   (counsel-more-chars 3)
 (counsel--async-command
- (format "recollq -b '%s'" string))
+ (format "recoll -t -b '%s'" string))
 nil))
 
 ;; This command uses the recollq command line tool that comes together



[elpa] master b465c09 06/63: ivy.el (ivy-switch-buffer): Add a multi-action interface

2015-08-21 Thread Oleh Krehel
branch: master
commit b465c09938f25c3614aa2702f6fecfa67f781c88
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-switch-buffer): Add a multi-action interface

While in "C-o":

- Use "s" to make "C-m", "C-j", "C-M-n" and "C-M-p" kill
- Use "w" to switch back to normal.

Re #164
---
 ivy.el |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index 1c5f5b9..4bb6278 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1469,7 +1469,13 @@ BUFFER may be a string or nil."
   (call-interactively 'switch-to-buffer)
 (ivy-read "Switch to buffer: " 'internal-complete-buffer
   :preselect (buffer-name (other-buffer (current-buffer)))
-  :action #'ivy--switch-buffer-action
+  :action (cons
+   1
+   '(("default" ivy--switch-buffer-action)
+ ("kill"
+  (lambda (x)
+(kill-buffer x)
+(ivy--reset-state ivy-last)
   :keymap ivy-switch-buffer-map)))
 
 (defun ivy-recentf ()



[elpa] master 8a06271 43/63: Update :dynamic-collection to be a boolean

2015-08-21 Thread Oleh Krehel
branch: master
commit 8a062714e434fc99329fbd19823314be61f5ec40
Author: Oleh Krehel 
Commit: Oleh Krehel 

Update :dynamic-collection to be a boolean

* ivy.el (ivy--exhibit): Always use `ivy-state-collection', instead of
  possibly `ivy-state-dynamic-collection'. The collection function may
  return nil if it's async and doesn't want to update the minibuffer on
  exit (to update it later in the sentinel).

* counsel.el (counsel-more-chars): New defun.
(counsel-git-grep-function): Use `counsel-more-chars'; in the async
case, return nil.
(counsel-git-grep): Update :dynamic-collection to a boolean.
(counsel--gg-sentinel):
(counsel--async-sentinel): Update to set the candidates to "Error"
instead of message "Error" - a lot less distracting this way.
(counsel-locate-function): Use `counsel-more-chars'; return "Working",
since it takes a few seconds to complete a single locate query.
(counsel-locate): Update.
---
 counsel.el |   55 ---
 ivy.el |9 +
 2 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/counsel.el b/counsel.el
index 91bb04b..161d789 100644
--- a/counsel.el
+++ b/counsel.el
@@ -276,18 +276,23 @@
 (defvar counsel--git-grep-count nil
   "Store the line count in current repository.")
 
+(defun counsel-more-chars (n)
+  "Return two fake candidates prompting for at least N input."
+  (list ""
+(format "%d chars more" (- n (length ivy-text)
+
 (defun counsel-git-grep-function (string &optional _pred &rest _unused)
   "Grep in the current git repository for STRING."
   (if (and (> counsel--git-grep-count 2)
(< (length string) 3))
-  (list ""
-(format "%d chars more" (- 3 (length ivy-text
+  (counsel-more-chars 3)
 (let* ((default-directory counsel--git-grep-dir)
(cmd (format "git --no-pager grep --full-name -n --no-color -i -e 
%S"
 (ivy--regex string t
   (if (<= counsel--git-grep-count 2)
   (split-string (shell-command-to-string cmd) "\n" t)
-(counsel--gg-candidates (ivy--regex string))
+(counsel--gg-candidates (ivy--regex string))
+nil
 
 (defvar counsel-git-grep-map
   (let ((map (make-sparse-keymap)))
@@ -319,7 +324,8 @@
 
 ;;;###autoload
 (defun counsel-git-grep (&optional initial-input)
-  "Grep for a string in the current git repository."
+  "Grep for a string in the current git repository.
+INITIAL-INPUT can be given as the initial minibuffer input."
   (interactive)
   (setq counsel--git-grep-dir
 (locate-dominating-file default-directory ".git"))
@@ -329,8 +335,7 @@
 (ivy-read "pattern: " 'counsel-git-grep-function
   :initial-input initial-input
   :matcher #'counsel-git-grep-matcher
-  :dynamic-collection (when (> counsel--git-grep-count 2)
-'counsel-git-grep-function)
+  :dynamic-collection (> counsel--git-grep-count 2)
   :keymap counsel-git-grep-map
   :action #'counsel-git-grep-action
   :unwind #'swiper--cleanup
@@ -407,13 +412,6 @@ Skip some dotfiles unless `ivy-text' requires them."
  candidates))
 (setq ivy--old-re regexp
 
-(defun counsel-locate-function (str &rest _u)
-  (if (< (length str) 3)
-  (list ""
-(format "%d chars more" (- 3 (length ivy-text
-(counsel--async-command
- (concat "locate -i --regex " (ivy--regex str)
-
 (defun counsel--async-command (cmd)
   (let* ((counsel--process " *counsel*")
  (proc (get-process counsel--process))
@@ -434,10 +432,12 @@ Skip some dotfiles unless `ivy-text' requires them."
 (with-current-buffer (process-buffer process)
   (setq ivy--all-candidates (split-string (buffer-string) "\n" t))
   (setq ivy--old-cands ivy--all-candidates))
-(ivy--insert-minibuffer
- (ivy--format ivy--all-candidates)))
+(ivy--exhibit))
 (if (string= event "exited abnormally with code 1\n")
-(message "Error"
+(progn
+  (setq ivy--all-candidates '("Error"))
+  (setq ivy--old-cands ivy--all-candidates)
+  (ivy--exhibit)
 
 (defun counsel-locate-action-extern (x)
   "Use xdg-open shell command on X."
@@ -459,17 +459,23 @@ Skip some dotfiles unless `ivy-text' requires them."
  '(("x" counsel-locate-action-extern "xdg-open")
("d" counsel-locate-action-dired "dired")))
 
+(defun counsel-locate-function (str &rest _u)
+  (if (< (length str) 3)
+  (counsel-more-chars 3)
+(counsel--async-command
+ (concat "locate -i --regex " (ivy--regex str)))
+'("" "working...")))
+
 ;;;###autoload
 (defun counsel-locate ()
   "Call locate shell command."
   (interactive)
-  (ivy-read "Locate: " nil
-:dynamic-collection #'counsel-locate-function
+  (ivy-read "Locate: " #

[elpa] master 8152577 45/63: counsel.el (counsel-recoll): New command

2015-08-21 Thread Oleh Krehel
branch: master
commit 815257759ca02b049d526519726477bbaba7a4ab
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-recoll): New command

* counsel.el (counsel-recoll-function): New function.
---
 counsel.el |   35 +++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index cb87e8a..756b0a8 100644
--- a/counsel.el
+++ b/counsel.el
@@ -851,6 +851,41 @@ INITIAL-INPUT can be given as the initial minibuffer 
input."
 :action #'counsel-git-grep-action
 :unwind #'swiper--cleanup))
 
+(defun counsel-recoll-function (string &optional _pred &rest _unused)
+  "Grep in the current directory for STRING."
+  (if (< (length string) 3)
+  (counsel-more-chars 3)
+(counsel--async-command
+ (format "recollq -b '%s'" string))
+nil))
+
+;; This command uses the recollq command line tool that comes together
+;; with the recoll (the document indexing database) source:
+;; http://www.lesbonscomptes.com/recoll/download.html
+;; You need to build it yourself (together with recoll):
+;; cd ./query && make && sudo cp recollq /usr/local/bin
+;; You can try the GUI version of recoll with:
+;; sudo apt-get install recoll
+;; Unfortunately, that does not install recollq.
+(defun counsel-recoll (&optional initial-input)
+  "Search for a string in the recoll database.
+You'll be given a list of files that match.
+Selecting a file will launch `swiper' for that file.
+INITIAL-INPUT can be given as the initial minibuffer input."
+  (interactive)
+  (setq counsel--git-grep-dir default-directory)
+  (ivy-read "recoll: " 'counsel-recoll-function
+:initial-input initial-input
+:dynamic-collection t
+:history 'counsel-git-grep-history
+:action (lambda (x)
+  (when (string-match "file://\\(.*\\)\\'" x)
+(let ((file-name (match-string 1 x)))
+  (find-file file-name)
+  (unless (string-match "pdf$" x)
+(swiper ivy-text)
+:unwind #'swiper--cleanup))
+
 (provide 'counsel)
 
 ;;; counsel.el ends here



[elpa] master 08bd5b4 25/63: counsel.el (counsel-variable-list): Add

2015-08-21 Thread Oleh Krehel
branch: master
commit 08bd5b45ee5d22b5f018b4319b97f8979f8c07f7
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-variable-list): Add

* counsel.el (counsel-describe-variable): Use `counsel-variable-list'.
---
 counsel.el |   18 +++---
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/counsel.el b/counsel.el
index 5d14416..bbb8230 100644
--- a/counsel.el
+++ b/counsel.el
@@ -142,6 +142,16 @@
  (match-string 1 s)
s
 
+(defun counsel-variable-list ()
+  "Return the list of all currently bound variables."
+  (let (cands)
+(mapatoms
+ (lambda (vv)
+   (when (or (get vv 'variable-documentation)
+ (and (boundp vv) (not (keywordp vv
+ (push (symbol-name vv) cands
+cands))
+
 ;;;###autoload
 (defun counsel-describe-variable ()
   "Forward to `describe-variable'."
@@ -149,13 +159,7 @@
   (let ((enable-recursive-minibuffers t))
 (ivy-read
  "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)
+ (counsel-variable-list)
  :keymap counsel-describe-map
  :preselect (counsel-symbol-at-point)
  :history 'counsel-describe-symbol-history



[elpa] master c1b9f5a 39/63: Allow "M-o j" to switch to virtual buffers in other window

2015-08-21 Thread Oleh Krehel
branch: master
commit c1b9f5a0f41c88d115d46f5dd3322a1586c2b51b
Author: Oleh Krehel 
Commit: Oleh Krehel 

Allow "M-o j" to switch to virtual buffers in other window

* ivy.el (ivy--switch-buffer-other-window-action): New defun.
(ivy-set-actions): Use `ivy--switch-buffer-other-window-action' instead
of `switch-to-buffer-other-window'.
---
 ivy.el |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index 28463b7..5535e1d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1550,6 +1550,17 @@ BUFFER may be a string or nil."
 (switch-to-buffer
  buffer nil 'force-same-window)
 
+(defun ivy--switch-buffer-other-window-action (buffer)
+  "Switch to BUFFER in other window.
+BUFFER may be a string or nil."
+  (if (zerop (length buffer))
+  (switch-to-buffer-other-window ivy-text)
+(let ((virtual (assoc buffer ivy--virtual-buffers)))
+  (if (and virtual
+   (not (get-buffer buffer)))
+  (find-file-other-window (cdr virtual))
+(switch-to-buffer-other-window buffer)
+
 (defvar ivy-switch-buffer-map (make-sparse-keymap))
 
 (ivy-set-actions
@@ -1560,7 +1571,7 @@ BUFFER may be a string or nil."
   (ivy--reset-state ivy-last))
 "kill")
("j"
-switch-to-buffer-other-window
+ivy--switch-buffer-other-window-action
 "other")))
 
 (defun ivy-switch-buffer ()



[elpa] master updated (b0039dd -> f5dac47)

2015-08-21 Thread Oleh Krehel
abo_abo pushed a change to branch master.

  from  b0039dd   Merge commit '6238e7402adabd0003f6ffcf5c57d9f18f1e7684'
   new  bb953c6   ivy.el (ivy-restrict-to-matches): Add and bind to "S-SPC"
   new  d6452fb   Add a custom keymap for ivy-switch-buffer
   new  1aa7520   Add a custom keymap for counsel-find-file
   new  9bbf9f9   Fixup the last two commits
   new  082fbbc   Add a multi-action interface for counsel-locate
   new  b465c09   ivy.el (ivy-switch-buffer): Add a multi-action interface
   new  fe6d2b1   Make ffap work again
   new  548a766   ivy.el (ivy--reset-state): Fixup
   new  f6f3963   Bind case-fold-search to t when the input is all 
lower-case
   new  d1f88fa   ivy.el (ivy-read): Don't put empty string on history
   new  d5af987   ivy.el (ivy--reset-state): Fixup
   new  f9974e8   Allow to see the candidate index via ivy-count-format
   new  783f7c5   Update index formatting logic
   new  3164753   counsel.el (counsel-locate-history): Add
   new  d289b78   Add a new interface to customize additional exit points
   new  19dcc0f   ivy.el (ivy--regex): Improve for trailing backslash
   new  21007c2   Add counsel-rhythmbox
   new  ea6525e   ivy.el (ivy-read): Improve ivy-set-actions interaction
   new  e9c2538   counsel.el (counsel-rhythmbox-history): Add
   new  de2e819   Allow % in prompt string
   new  6062903   ivy.el (ivy-count-format): Improve docstring
   new  8c91662   ivy.el (ivy-call): Bind to "C-M-m" or "M-RET"
   new  22ee8a6   swiper.el (swiper-font-lock-ensure): Ignore Man-mode
   new  1092e2d   swiper.el: Update avy--goto -> avy-action-goto
   new  08bd5b4   counsel.el (counsel-variable-list): Add
   new  3df2d8e   ivy-hydra.el: Add featurep for hydra
   new  adad288   ivy.el (ivy-call): Add selected-window work-around for M-x
   new  5480079   ivy.el (ivy-dispatching-done): New command on "M-o"
   new  2fbcfb9   ivy.el (ivy--preselect-index): Add matcher to arglist
   new  9ca6f48   Allow "C-g" to interrupt ivy-dispatching-done
   new  e91a4eb   ivy.el (ivy-dispatching-done): Display the candidate
   new  31d664a   ivy.el (ivy-dispatching-done): Add a trailing newline
   new  3464362   Add actions for counsel-describe-variable
   new  107ebff   Add actions for counsel-describe-function
   new  cb0cf02   ivy.el (ivy-call): Remove with-selected-window
   new  ae77d93   counsel.el (counsel-org-tag): Replace org-set-tags
   new  1e483c5   Fixup counsel-org-tag
   new  a9ff1f1   counsel.el (counsel-org-change-tags): Improve removing 
tags
   new  c1b9f5a   Allow "M-o j" to switch to virtual buffers in other window
   new  f71a562   Fix "DEL" generating a "Quit" sometimes for 
counsel-git-grep
   new  5ae677c   Simplify counsel-git-grep logic
   new  acf4485   ivy.el (ivy--exhibit): Check if in post-command-hook
   new  8a06271   Update :dynamic-collection to be a boolean
   new  2bd9118   counsel.el (counsel-ag): New command
   new  8152577   counsel.el (counsel-recoll): New command
   new  36e8fe3   counsel.el (counsel-org-tag): No need to be at heading
   new  e7d778b   counsel.el (counsel-recoll): Simplify
   new  6ab519f   counsel.el (counsel-org-tag): Delete dups
   new  5b61577   Use recoll -t instead of recollq
   new  dba4e47   counsel.el (org-bound-and-true-p): Update declare
   new  8d82b98   swiper.el (swiper-from-isearch): New command
   new  1f0c79b   counsel.el (org-setting-tags): Declare dynamic var
   new  4443a8b   counsel.el (org-last-tags-completion-table): Declare
   new  40c17b4   Add a few more Org declarations
   new  a33af29   counsel.el (org-bound-and-true-p): Use bound-and-true-p
   new  13d0c50   counsel.el (counsel-org-tag-agenda): New command
   new  6b57efe   Bind "C-M-j" to ivy-immediate-done
   new  476fc5d   Add with-ivy-window macro
   new  b8b951b   Allow ivy-count-format to be set as nil
   new  be989fe   Preselect perfect matches with a leading ^
   new  098bec0   counsel.el (counsel-find-file): Fix window focus issue
   new  09f86fc   doc/Changelog.org: Add
   new  f5dac47   Merge commit '09f86fca437f1b2e168093824e9d4ee0aea5130a' 
from swiper


Summary of changes:
 packages/swiper/counsel.el|  379 ++---
 packages/swiper/doc/Changelog.org |  296 +
 packages/swiper/ivy-hydra.el  |   15 +-
 packages/swiper/ivy-test.el   |8 +
 packages/swiper/ivy.el|  363 ++-
 packages/swiper/swiper.el |  117 ++--
 6 files changed, 961 insertions(+), 217 deletions(-)
 create mode 100644 packages/swiper/doc/Changelog.org



[elpa] master e9c2538 19/63: counsel.el (counsel-rhythmbox-history): Add

2015-08-21 Thread Oleh Krehel
branch: master
commit e9c2538d0b419c2b3e4210adab6a8fb1db5c7b85
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-rhythmbox-history): Add

* counsel.el (counsel-rhythmbox): Update.
---
 counsel.el |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index 0c589e1..5d14416 100644
--- a/counsel.el
+++ b/counsel.el
@@ -699,6 +699,9 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 (dbus-call-method :session service path interface
   "AddToQueue" (rhythmbox-song-uri song
 
+(defvar counsel-rhythmbox-history nil
+  "History for `counsel-rhythmbox'.")
+
 ;;;###autoload
 (defun counsel-rhythmbox ()
   "Choose a song from the Rhythmbox library to play or enqueue."
@@ -711,6 +714,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
   (sit-for 0.1)))
   (ivy-read "Rhythmbox: "
 (helm-rhythmbox-candidates)
+:history 'counsel-rhythmbox-history
 :action
 '(1
   ("Play song" helm-rhythmbox-play-song)



[elpa] master e7d778b 47/63: counsel.el (counsel-recoll): Simplify

2015-08-21 Thread Oleh Krehel
branch: master
commit e7d778b720ce20bee101d87f95708ac19ce61d82
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-recoll): Simplify
---
 counsel.el |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/counsel.el b/counsel.el
index 04be3db..1d85b0b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -876,7 +876,6 @@ You'll be given a list of files that match.
 Selecting a file will launch `swiper' for that file.
 INITIAL-INPUT can be given as the initial minibuffer input."
   (interactive)
-  (setq counsel--git-grep-dir default-directory)
   (ivy-read "recoll: " 'counsel-recoll-function
 :initial-input initial-input
 :dynamic-collection t
@@ -886,8 +885,7 @@ INITIAL-INPUT can be given as the initial minibuffer input."
 (let ((file-name (match-string 1 x)))
   (find-file file-name)
   (unless (string-match "pdf$" x)
-(swiper ivy-text)
-:unwind #'swiper--cleanup))
+(swiper ivy-text)))
 
 (provide 'counsel)
 



[elpa] master 31d664a 32/63: ivy.el (ivy-dispatching-done): Add a trailing newline

2015-08-21 Thread Oleh Krehel
branch: master
commit 31d664a0ea3155ed99810425527f351076dac378
Author: Oleh Krehel 
Commit: Oleh Krehel 

ivy.el (ivy-dispatching-done): Add a trailing newline
---
 ivy.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index bd11501..989a34e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -285,7 +285,8 @@ When non-nil, it should contain one %d.")
'face 'font-lock-builtin-face)
   (nth 2 x)))
 (cdr actions)
-"\n")))
+"\n")
+   "\n: "))
  (key (string (read-key hint)))
  (action (assoc key (cdr actions
 (cond ((string= key ""))



[elpa] master 9bbf9f9 04/63: Fixup the last two commits

2015-08-21 Thread Oleh Krehel
branch: master
commit 9bbf9f9b5b1fe3fe88f30a1fc57ef21e22bcc2d7
Author: Oleh Krehel 
Commit: Oleh Krehel 

Fixup the last two commits

* counsel.el (counsel-find-file): Update.

* ivy.el (ivy--buffer-list): Update.

Re #164
---
 counsel.el |3 ++-
 ivy.el |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/counsel.el b/counsel.el
index 8ba4457..1652b20 100644
--- a/counsel.el
+++ b/counsel.el
@@ -351,7 +351,8 @@
  (require 'ffap)
  (ffap-guesser))
 :require-match 'confirm-after-completion
-:history 'file-name-history))
+:history 'file-name-history
+:keymap counsel-find-file-map))
 
 (defcustom counsel-find-file-ignore-regexp nil
   "A regexp of files to ignore while in `counsel-find-file'.
diff --git a/ivy.el b/ivy.el
index 2087287..6ecfb4b 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1430,7 +1430,8 @@ BUFFER may be a string or nil."
   (call-interactively 'switch-to-buffer)
 (ivy-read "Switch to buffer: " 'internal-complete-buffer
   :preselect (buffer-name (other-buffer (current-buffer)))
-  :action #'ivy--switch-buffer-action)))
+  :action #'ivy--switch-buffer-action
+  :keymap ivy-switch-buffer-map)))
 
 (defun ivy-recentf ()
   "Find a file on `recentf-list'."



[elpa] master 1092e2d 24/63: swiper.el: Update avy--goto -> avy-action-goto

2015-08-21 Thread Oleh Krehel
branch: master
commit 1092e2d9ccd4e74a10eb3da6379f6a5042cbee96
Author: Oleh Krehel 
Commit: Oleh Krehel 

swiper.el: Update avy--goto -> avy-action-goto
---
 swiper.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/swiper.el b/swiper.el
index 816d1fe..5b22b78 100644
--- a/swiper.el
+++ b/swiper.el
@@ -108,7 +108,7 @@
 (declare-function avy--regex-candidates "ext:avy")
 (declare-function avy--process "ext:avy")
 (declare-function avy--overlay-post "ext:avy")
-(declare-function avy--goto "ext:avy")
+(declare-function avy-action-goto "ext:avy")
 
 ;;;###autoload
 (defun swiper-avy ()
@@ -124,7 +124,7 @@
  (candidate
   (avy--process candidates #'avy--overlay-post)))
 (ivy-quit-and-run
- (avy--goto candidate))
+ (avy-action-goto candidate))
 
 (defun swiper-recenter-top-bottom (&optional arg)
   "Call (`recenter-top-bottom' ARG) in `swiper--window'."



[elpa] master d6452fb 02/63: Add a custom keymap for ivy-switch-buffer

2015-08-21 Thread Oleh Krehel
branch: master
commit d6452fbc728f619b0285176508982672375cbc18
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add a custom keymap for ivy-switch-buffer

* ivy.el (ivy-switch-buffer-map): New defvar.

Re #164
---
 ivy.el |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ivy.el b/ivy.el
index f322b64..2087287 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1421,6 +1421,8 @@ BUFFER may be a string or nil."
 (switch-to-buffer
  buffer nil 'force-same-window)
 
+(defvar ivy-switch-buffer-map (make-sparse-keymap))
+
 (defun ivy-switch-buffer ()
   "Switch to another buffer."
   (interactive)



[elpa] master 107ebff 34/63: Add actions for counsel-describe-function

2015-08-21 Thread Oleh Krehel
branch: master
commit 107ebff0ee9f91c3c0a9b9a969923ef27c492713
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add actions for counsel-describe-function
---
 counsel.el |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index 4c3c482..15a14db 100644
--- a/counsel.el
+++ b/counsel.el
@@ -174,6 +174,11 @@
  '(("i" counsel-info-lookup-symbol "info")
("d" counsel--find-symbol "definition")))
 
+(ivy-set-actions
+ 'counsel-describe-function
+ '(("i" counsel-info-lookup-symbol "info")
+   ("d" counsel--find-symbol "definition")))
+
 ;;;###autoload
 (defun counsel-describe-function ()
   "Forward to `describe-function'."



[elpa] master 8d82b98 51/63: swiper.el (swiper-from-isearch): New command

2015-08-21 Thread Oleh Krehel
branch: master
commit 8d82b9892b76d8ff27cbf7e9a20a7c8037acf1a8
Author: Oleh Krehel 
Commit: Oleh Krehel 

swiper.el (swiper-from-isearch): New command

Fixes #180
---
 swiper.el |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/swiper.el b/swiper.el
index 5b22b78..e7bd574 100644
--- a/swiper.el
+++ b/swiper.el
@@ -360,6 +360,16 @@ BEG and END, when specified, are the point bounds."
 (push-mark swiper--opoint t)
 (message "Mark saved where search started")
 
+;; (define-key isearch-mode-map (kbd "C-o") 'swiper-from-isearch)
+(defun swiper-from-isearch ()
+  "Invoke `swiper' from isearch."
+  (interactive)
+  (let ((query (if isearch-regexp
+   isearch-string
+ (regexp-quote isearch-string
+(isearch-exit)
+(swiper query)))
+
 (provide 'swiper)
 
 ;;; swiper.el ends here



[elpa] master b8b951b 59/63: Allow ivy-count-format to be set as nil

2015-08-21 Thread Oleh Krehel
branch: master
commit b8b951b205cd7def439bc6a37bba6f3abf24291d
Author: Chunyang Xu 
Commit: Chunyang Xu 

Allow ivy-count-format to be set as nil
---
 ivy.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index 55005de..faa469b 100644
--- a/ivy.el
+++ b/ivy.el
@@ -72,7 +72,7 @@
 Set this to nil if you don't want the count.  You can also set it
 to e.g. \"(%d/%d) \" if you want to see both the candidate index
 and the candidate count."
-  :type 'string)
+  :type '(choice (const :tag "Count disabled" nil) string))
 
 (defcustom ivy-wrap nil
   "Whether to wrap around after the first and last candidate."
@@ -993,6 +993,8 @@ This is useful for recursive `ivy-read'."
 (setq ivy--prompt
   (cond ((string-match "%.*d" prompt)
  prompt)
+((null ivy-count-format)
+ nil)
 ((string-match "%d.*%d" ivy-count-format)
  (let ((w (length (number-to-string
(length ivy--all-candidates



[elpa] master 2bd9118 44/63: counsel.el (counsel-ag): New command

2015-08-21 Thread Oleh Krehel
branch: master
commit 2bd91185243b5aae569be655a17fa0ffadd2aaa1
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-ag): New command

* counsel.el (counsel-ag-function): New defun.
(counsel-git-grep): Update prompt.

Going from sync to async now is as simple as:

- add :dynamic-collection t
- replace `shell-command-to-string' with `counsel--async-command'
---
 counsel.el |   27 ++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/counsel.el b/counsel.el
index 161d789..cb87e8a 100644
--- a/counsel.el
+++ b/counsel.el
@@ -332,7 +332,7 @@ INITIAL-INPUT can be given as the initial minibuffer input."
   (if (null counsel--git-grep-dir)
   (error "Not in a git repository")
 (setq counsel--git-grep-count (counsel--gg-count "" t))
-(ivy-read "pattern: " 'counsel-git-grep-function
+(ivy-read "git grep: " 'counsel-git-grep-function
   :initial-input initial-input
   :matcher #'counsel-git-grep-matcher
   :dynamic-collection (> counsel--git-grep-count 2)
@@ -826,6 +826,31 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
   :history 'org-tags-history
   :action 'counsel-org-tag-action)))
 
+(defun counsel-ag-function (string &optional _pred &rest _unused)
+  "Grep in the current directory for STRING."
+  (if (< (length string) 3)
+  (counsel-more-chars 3)
+(let ((regex (replace-regexp-in-string
+  ")" ")"
+  (replace-regexp-in-string
+   "(" "("
+   (ivy--regex string)
+  (counsel--async-command
+   (format "ag --noheading --nocolor %S" regex))
+  nil)))
+
+(defun counsel-ag (&optional initial-input)
+  "Grep for a string in the current directory using ag.
+INITIAL-INPUT can be given as the initial minibuffer input."
+  (interactive)
+  (setq counsel--git-grep-dir default-directory)
+  (ivy-read "ag: " 'counsel-ag-function
+:initial-input initial-input
+:dynamic-collection t
+:history 'counsel-git-grep-history
+:action #'counsel-git-grep-action
+:unwind #'swiper--cleanup))
+
 (provide 'counsel)
 
 ;;; counsel.el ends here



[elpa] master 1e483c5 37/63: Fixup counsel-org-tag

2015-08-21 Thread Oleh Krehel
branch: master
commit 1e483c5d79253e7f56e91cb762d715f40519bef6
Author: Oleh Krehel 
Commit: Oleh Krehel 

Fixup counsel-org-tag

* counsel.el (counsel-org-tag-action): Add ::
(counsel-org-tag): Set `org-last-tags-completion-table', otherwise
`org-tags-completion-function' doesn't work.
---
 counsel.el |   19 ++-
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/counsel.el b/counsel.el
index 4940281..4a014f0 100644
--- a/counsel.el
+++ b/counsel.el
@@ -790,7 +790,8 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
   (cond ((memq this-command '(ivy-done ivy-alt-done))
  (with-selected-window (ivy-state-window ivy-last)
(counsel-org-change-tags
-(mapconcat #'identity counsel-org-tags ":"
+(format ":%s:"
+(mapconcat #'identity counsel-org-tags ":")
 ((eq this-command 'ivy-call)
  (delete-minibuffer-contents
 
@@ -803,10 +804,18 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
   "Add or remove tags in org-mode."
   (interactive)
   (setq counsel-org-tags (split-string (org-get-tags-string) ":" t))
-  (ivy-read (counsel-org-tag-prompt)
-'org-tags-completion-function
-:history 'org-tags-history
-:action 'counsel-org-tag-action))
+  (let ((org-setting-tags t)
+(org-last-tags-completion-table
+ (append org-tag-persistent-alist
+ (or org-tag-alist (org-get-buffer-tags))
+ (and
+  org-complete-tags-always-offer-all-agenda-tags
+  (org-global-tags-completion-table
+   (org-agenda-files))
+(ivy-read (counsel-org-tag-prompt)
+  'org-tags-completion-function
+  :history 'org-tags-history
+  :action 'counsel-org-tag-action)))
 
 (provide 'counsel)
 



[elpa] master f71a562 40/63: Fix "DEL" generating a "Quit" sometimes for counsel-git-grep

2015-08-21 Thread Oleh Krehel
branch: master
commit f71a56202bf98cdcf100db73110425ade0622d9b
Author: Oleh Krehel 
Commit: Oleh Krehel 

Fix "DEL" generating a "Quit" sometimes for counsel-git-grep

* ivy.el (ivy-backward-kill-word): It seems that `backward-kill-word' is
  too elaborate; falling back to something simpler fixed the problem.
---
 ivy.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/ivy.el b/ivy.el
index 5535e1d..97113c4 100644
--- a/ivy.el
+++ b/ivy.el
@@ -704,7 +704,9 @@ On error (read-only), call `ivy-on-del-error-function'."
 ivy--directory
 (ivy--exhibit))
 (ignore-errors
-  (backward-kill-word 1
+  (let ((pt (point)))
+(forward-word -1)
+(delete-region (point) pt)
 
 (defvar ivy--regexp-quote 'regexp-quote
   "Store the regexp quoting state.")



[elpa] master 5ae677c 41/63: Simplify counsel-git-grep logic

2015-08-21 Thread Oleh Krehel
branch: master
commit 5ae677c092d48caf10b6baa3a7ca32d3eea6b55f
Author: Oleh Krehel 
Commit: Oleh Krehel 

Simplify counsel-git-grep logic

* ivy.el (ivy--exhibit): Remove the condition on (eq ivy--full-length -1).

* counsel.el (counsel-git-grep-function): Simplify.
(counsel-gg-state): New defvar. Use this instead of
(setq ivy--full-length -1).
(counsel--gg-candidates): Set `counsel-gg-state' to -2. There are two
async processes to wait for until `ivy--exhibit' can be called:
- get the candidate count
- get the candidates
Each of the async processes will increase the number, and call
`ivy--exhibit' if the number reaches 0.
(counsel--gg-sentinel): Update.
(counsel--gg-count): Update.
---
 counsel.el |   31 +--
 ivy.el |   21 ++---
 2 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/counsel.el b/counsel.el
index 6004891..91bb04b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -280,22 +280,14 @@
   "Grep in the current git repository for STRING."
   (if (and (> counsel--git-grep-count 2)
(< (length string) 3))
-  (progn
-(setq ivy--full-length counsel--git-grep-count)
-(list ""
-  (format "%d chars more" (- 3 (length ivy-text)
+  (list ""
+(format "%d chars more" (- 3 (length ivy-text
 (let* ((default-directory counsel--git-grep-dir)
(cmd (format "git --no-pager grep --full-name -n --no-color -i -e 
%S"
-(ivy--regex string t)))
-   res)
+(ivy--regex string t
   (if (<= counsel--git-grep-count 2)
-  (progn
-(setq res (shell-command-to-string cmd))
-(setq ivy--full-length nil)
-(split-string res "\n" t))
-(setq ivy--full-length -1)
-(counsel--gg-candidates (ivy--regex string))
-nil
+  (split-string (shell-command-to-string cmd) "\n" t)
+(counsel--gg-candidates (ivy--regex string))
 
 (defvar counsel-git-grep-map
   (let ((map (make-sparse-keymap)))
@@ -557,8 +549,12 @@ The libraries are offered from `load-path'."
  (get-text-property 0 'full-name x)))
   :keymap counsel-describe-map)))
 
+(defvar counsel-gg-state nil
+  "The current state of candidates / count sync.")
+
 (defun counsel--gg-candidates (regex)
   "Return git grep candidates for REGEX."
+  (setq counsel-gg-state -2)
   (counsel--gg-count regex)
   (let* ((default-directory counsel--git-grep-dir)
  (counsel-gg-process " *counsel-gg*")
@@ -583,9 +579,8 @@ The libraries are offered from `load-path'."
 (with-current-buffer (process-buffer process)
   (setq ivy--all-candidates (split-string (buffer-string) "\n" t))
   (setq ivy--old-cands ivy--all-candidates))
-(unless (eq ivy--full-length -1)
-  (ivy--insert-minibuffer
-   (ivy--format ivy--all-candidates
+(when (= 0 (cl-incf counsel-gg-state))
+  (ivy--exhibit)))
 (if (string= event "exited abnormally with code 1\n")
 (message "Error"
 
@@ -614,8 +609,8 @@ When NO-ASYNC is non-nil, do it synchronously."
  (when (string= event "finished\n")
(with-current-buffer (process-buffer process)
  (setq ivy--full-length (string-to-number (buffer-string
-   (ivy--insert-minibuffer
-(ivy--format ivy--all-candidates)
+   (when (= 0 (cl-incf counsel-gg-state))
+ (ivy--exhibit)
 
 (defun counsel--M-x-transformer (cmd)
   "Add a binding to CMD if it's bound in the current window.
diff --git a/ivy.el b/ivy.el
index 97113c4..e42504e 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1292,22 +1292,21 @@ Should be run via minibuffer `post-command-hook'."
 ;; dynamic collection should take care of everything
 (funcall (ivy-state-dynamic-collection ivy-last) ivy-text)
 (setq ivy--old-text ivy-text)))
-(unless (eq ivy--full-length -1)
-  (ivy--insert-minibuffer
-   (ivy--format ivy--all-candidates
+(ivy--insert-minibuffer
+ (ivy--format ivy--all-candidates)))
 (cond (ivy--directory
(if (string-match "/\\'" ivy-text)
(if (member ivy-text ivy--all-candidates)
(ivy--cd (expand-file-name ivy-text ivy--directory))
  (when (string-match "//\\'" ivy-text)
-  (if (and default-directory
-   (string-match "\\`[[:alpha:]]:/" default-directory))
-  (ivy--cd (match-string 0 default-directory))
-(ivy--cd "/")))
-(when (string-match "[[:alpha:]]:/" ivy-text)
-  (let ((drive-root (match-string 0 ivy-text)))
-(when (file-exists-p drive-root)
-  (ivy--cd driv

[elpa] master de2e819 20/63: Allow % in prompt string

2015-08-21 Thread Oleh Krehel
branch: master
commit de2e81927b3362b346a6c7063a335448158776a1
Author: Erik Hetzner 
Commit: Erik Hetzner 

Allow % in prompt string

- quote % when passing prompt from ivy-completing-read to ivy-read
- add documentation in ivy-read that all % should be quoted
---
 ivy.el |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 58b2529..e79bb9a 100644
--- a/ivy.el
+++ b/ivy.el
@@ -770,7 +770,8 @@ Directories come first."
 
 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.
+the current number of matching candidates.  If % appears elsewhere
+in the PROMPT it should be quoted as %%.
 See also `ivy-count-format'.
 
 COLLECTION is a list of strings.
@@ -985,7 +986,8 @@ DEF is the default value.
 _INHERIT-INPUT-METHOD is ignored for now.
 
 The history, defaults and input-method arguments are ignored for now."
-  (ivy-read prompt collection
+  (ivy-read (replace-regexp-in-string "%" "%%" prompt)
+collection
 :predicate predicate
 :require-match require-match
 :initial-input (if (consp initial-input)



[elpa] master be989fe 60/63: Preselect perfect matches with a leading ^

2015-08-21 Thread Oleh Krehel
branch: master
commit be989fe5aa9db153931ec61f1ff2940650ec6563
Author: Oleh Krehel 
Commit: Oleh Krehel 

Preselect perfect matches with a leading ^

* ivy.el (ivy--filter): When e.g. "filter" is in the collection,
  "^filter" input should always select it, even if other candidates
  match.
---
 ivy.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index faa469b..21197c3 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1415,8 +1415,11 @@ CANDIDATES are assumed to be static."
   (unless (and (not (equal re ivy--old-re))
(or (setq ivy--index
  (or
-  (cl-position re cands
-   :test #'equal)
+  (cl-position (if (and (> (length re) 0)
+(eq ?^ (aref re 0)))
+   (substring re 1)
+ re) cands
+ :test #'equal)
   (and ivy--directory
(cl-position
 (concat re "/") cands



[elpa] master 098bec0 61/63: counsel.el (counsel-find-file): Fix window focus issue

2015-08-21 Thread Oleh Krehel
branch: master
commit 098bec051b48a2ec091860599a49939cc9885025
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-find-file): Fix window focus issue

"C-M-n" should work fine now.
---
 counsel.el |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/counsel.el b/counsel.el
index 6aefbb0..63c9552 100644
--- a/counsel.el
+++ b/counsel.el
@@ -357,7 +357,8 @@ INITIAL-INPUT can be given as the initial minibuffer input."
 :matcher #'counsel--find-file-matcher
 :action
 (lambda (x)
-  (find-file (expand-file-name x ivy--directory)))
+  (with-ivy-window
+(find-file (expand-file-name x ivy--directory
 :preselect (when counsel-find-file-at-point
  (require 'ffap)
  (ffap-guesser))



[elpa] master a33af29 55/63: counsel.el (org-bound-and-true-p): Use bound-and-true-p

2015-08-21 Thread Oleh Krehel
branch: master
commit a33af2997bf8de63ea3169b81325518765c15758
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (org-bound-and-true-p): Use bound-and-true-p
---
 counsel.el |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/counsel.el b/counsel.el
index 623365d..ce4087d 100644
--- a/counsel.el
+++ b/counsel.el
@@ -747,7 +747,6 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 (defvar org-indent-indentation-per-level)
 (defvar org-tags-column)
 (declare-function org-get-tags-string "org")
-(declare-function org-bound-and-true-p "org-macs")
 (declare-function org-move-to-column "org")
 
 (defun counsel-org-change-tags (tags)
@@ -771,7 +770,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
  (goto-char (match-beginning 0))
  (let* ((c0 (current-column))
 ;; compute offset for the case of org-indent-mode active
-(di (if (org-bound-and-true-p org-indent-mode)
+(di (if (bound-and-true-p org-indent-mode)
 (* (1- org-indent-indentation-per-level) (1- level))
   0))
 (p0 (if (equal (char-before) ?*) (1+ (point)) (point)))



[elpa] master 1f0c79b 52/63: counsel.el (org-setting-tags): Declare dynamic var

2015-08-21 Thread Oleh Krehel
branch: master
commit 1f0c79b1051cad0d45e8ebba7019045671dcc501
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (org-setting-tags): Declare dynamic var

Re #179
---
 counsel.el |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index b5ad6a0..e56d628 100644
--- a/counsel.el
+++ b/counsel.el
@@ -808,6 +808,8 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
   (format "Tags (%s): "
   (mapconcat #'identity counsel-org-tags ", ")))
 
+(defvar org-setting-tags)
+
 ;;;###autoload
 (defun counsel-org-tag ()
   "Add or remove tags in org-mode."



[elpa] master 09f86fc 62/63: doc/Changelog.org: Add

2015-08-21 Thread Oleh Krehel
branch: master
commit 09f86fca437f1b2e168093824e9d4ee0aea5130a
Author: Oleh Krehel 
Commit: Oleh Krehel 

doc/Changelog.org: Add
---
 doc/Changelog.org |  296 +
 1 files changed, 296 insertions(+), 0 deletions(-)

diff --git a/doc/Changelog.org b/doc/Changelog.org
new file mode 100644
index 000..0f5ac2c
--- /dev/null
+++ b/doc/Changelog.org
@@ -0,0 +1,296 @@
+#+OPTIONS: toc:nil
+* 0.6.0
+** Fixes
+*** =swiper-avy= should use only the current window
+Not all windows. See [[https://github.com/abo-abo/swiper/issues/117][#117]].
+*** fix wrap-around for =ivy-next-line=
+See [[https://github.com/abo-abo/swiper/issues/118][#118]].
+*** =swiper-avy= should do nothing for empty input
+See [[https://github.com/abo-abo/avy/issues/50][#50]].
+*** =ivy-alt-done= should require TRAMP if necessary
+See [[https://github.com/abo-abo/swiper/pull/145][#145]].
+*** =swiper-query-replace= shouldn't miss the first occurrence
+See [[https://github.com/abo-abo/swiper/pull/144][#144]].
+*** =swiper= should not deactivate mark
+*** =ivy-mode= should not switch to TRAMP for certain input
+See [[https://github.com/abo-abo/swiper/pull/145][#145]].
+*** =counsel-find-file= should work better with TRAMP
+"/ssh:foo" should not be cut off
+See [[https://github.com/abo-abo/swiper/pull/145][#145]].
+*** =counsel-find-file= supports Windows drive letters
+See [[https://github.com/abo-abo/swiper/pull/155][#155]].
+*** =counsel-file-file= should work better with files that contain "~"
+See [[https://github.com/abo-abo/swiper/pull/157][#157]].
+*** =counsel-M-x= should respect =ivy-format-function=
+See [[https://github.com/abo-abo/swiper/pull/150][#150]].
+*** =counsel-git-grep= should position better on exit
+See [[https://github.com/abo-abo/swiper/pull/153][#153]].
+*** =ivy-mode= should re-scale text to minibuffer height
+See [[https://github.com/abo-abo/swiper/pull/151][#151]].
+*** =counsel-unicode-char= should use action-style call
+See [[https://github.com/abo-abo/swiper/pull/160][#160]].
+*** =ivy-read= should allow % in prompt string
+See [[https://github.com/abo-abo/swiper/pull/171][#171]].
+*** =ivy-call= should execute in proper window
+See [[https://github.com/abo-abo/swiper/pull/176][#176]].
+** New Features
+*** =ivy-mode=
+ Open an Info file on the file system
+When in =Info-mode=, press ~g~ and select either "(./)" or "(../)" to
+switch to file name completion. That file will be opened with Info.
+ Account for =minibuffer-depth-indication-mode=
+If you have =minibuffer-depth-indication-mode= on, the minibuffer
+prompt will indicate the current depth.
+See [[https://github.com/abo-abo/swiper/pull/134][#134]].
+ Add fuzzy matching function
+To enable fuzzy matching, set your =ivy-re-builders-alist= accordingly:
+#+begin_src elisp
+(setq ivy-re-builders-alist
+  '((t . ivy--regex-fuzzy)))
+#+end_src
+See [[https://github.com/abo-abo/swiper/pull/136][#136]].
+
+See also [[https://github.com/abo-abo/swiper/pull/142][#142]] for toggling 
fuzzy matching with ~C-o m~.
+ =case-fold-search= optimization
+Bind case-fold-search to t when the input is all lower-case:
+
+- input "the" matches both "the" and "The".
+- input "The" matches only "The".
+
+See [[https://github.com/abo-abo/swiper/pull/166][#166]].
+ Allow to see the candidate index a la =anzu= via =ivy-count-format=
+To have this feature, use something like this:
+#+begin_src elisp
+(setq ivy-count-format "(%d/%d) ")
+#+end_src
+See [[https://github.com/abo-abo/swiper/pull/167][#167]].
+
+You can also set this to nil, if you don't want any count, see 
[[https://github.com/abo-abo/swiper/pull/188][#188]].
+ Allow to add additional exit points for any command
+Example for =ivy-switch-to-buffer=:
+#+begin_src elisp
+(ivy-set-actions
+ 'ivy-switch-buffer
+ '(("k"
+(lambda (x)
+  (kill-buffer x)
+  (ivy--reset-state ivy-last))
+"kill")
+   ("j"
+ivy--switch-buffer-other-window-action
+"other")))
+#+end_src
+
+After this:
+
+- use ~M-o k~ to kill a buffer
+- use ~M-o j~ to switch to a buffer in other window
+
+You can always use ~M-o o~ to access the default action. When there is
+only one action, ~M-o~ does the same as ~C-m~.
+
+See [[https://github.com/abo-abo/swiper/pull/164][#164]].
+
+
+
+
+
+
+
+
+*** =counsel-describe-function= and =counsel-decribe-variable=
+ Add a binding to look up the symbol in info
+Press ~C-,~ to look up the symbol in info, instead of the default
+describe action.
+See [[https://github.com/abo-abo/swiper/pull/121][#121]].
+ Handle symbol-at-point better in non-Elisp buffers
+See [[https://github.com/abo-abo/swiper/pull/126][#126]].
+*** =ivy-switch-buffer=
+ New face =ivy-virtual=
+See [[https://github.com/abo-abo/swiper/pull/129][#129]].
+ Deal better with invisible buffers
+See [[https://github.com/abo-abo/swiper/pull/135][#135]].
+ Add custom keymap
+You can customize =ivy-switch-buffer-map=.
+
+See [[https://github.com/ab

[elpa] master 6b57efe 57/63: Bind "C-M-j" to ivy-immediate-done

2015-08-21 Thread Oleh Krehel
branch: master
commit 6b57efeaf091856f291049dc415354dd65c10edd
Author: Oleh Krehel 
Commit: Oleh Krehel 

Bind "C-M-j" to ivy-immediate-done

* ivy.el (ivy-minibuffer-map): Update.

`ivy-immediate-done' will return with the current minibuffer input, even
if the input matches a candidate.

It was possible so far to call it with "C-u C-j".

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

diff --git a/ivy.el b/ivy.el
index 5e67800..10f1d6c 100644
--- a/ivy.el
+++ b/ivy.el
@@ -105,7 +105,9 @@ Only \"./\" and \"../\" apply here. They appear in reverse 
order."
 (defvar ivy-minibuffer-map
   (let ((map (make-sparse-keymap)))
 (define-key map (kbd "C-m") 'ivy-done)
+(define-key map (kbd "C-M-m") 'ivy-call)
 (define-key map (kbd "C-j") 'ivy-alt-done)
+(define-key map (kbd "C-M-j") 'ivy-immediate-done)
 (define-key map (kbd "TAB") 'ivy-partial-or-done)
 (define-key map (kbd "C-n") 'ivy-next-line)
 (define-key map (kbd "C-p") 'ivy-previous-line)
@@ -130,7 +132,6 @@ Only \"./\" and \"../\" apply here. They appear in reverse 
order."
 (define-key map (kbd "M-v") 'ivy-scroll-down-command)
 (define-key map (kbd "C-M-n") 'ivy-next-line-and-call)
 (define-key map (kbd "C-M-p") 'ivy-previous-line-and-call)
-(define-key map (kbd "C-M-m") 'ivy-call)
 (define-key map (kbd "M-q") 'ivy-toggle-regexp-quote)
 (define-key map (kbd "M-j") 'ivy-yank-word)
 (define-key map (kbd "M-i") 'ivy-insert-current)



[elpa] master f9974e8 12/63: Allow to see the candidate index via ivy-count-format

2015-08-21 Thread Oleh Krehel
branch: master
commit f9974e80f4440cb50e1a005efe9300f5d9476535
Author: Oleh Krehel 
Commit: Oleh Krehel 

Allow to see the candidate index via ivy-count-format

* ivy.el (ivy--insert-prompt): Update.

To use this feature, use something like this:

(setq ivy-count-format "(%d/%d)")

Basically two number specifiers instead of the usual one. The problem
with this approach is that the prompt length will change as you scroll
e.g. from 9 to 10, which is uncomfortable.

Fixes #167
---
 ivy.el |   24 
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/ivy.el b/ivy.el
index 9a27ebd..25720c9 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1155,21 +1155,29 @@ Insert .* between each char."
   (let ((inhibit-read-only t)
 (std-props '(front-sticky t rear-nonsticky t field t read-only t))
 (n-str
- (format
   (concat
(if (and (bound-and-true-p minibuffer-depth-indicate-mode)
 (> (minibuffer-depth) 1))
(format "[%d] " (minibuffer-depth))
  "")
-   head
-   ivy--prompt-extra
-   tail
+   (if (string-match "%[-0-9 ]*d.*%[-0-9 ]*d" ivy-count-format)
+   (concat (format ivy-count-format (1+ ivy--index) 
ivy--length)
+   " "
+   ;; work around swiper
+   (let ((pr (ivy-state-prompt ivy-last)))
+ (if (string-match "%[-0-9 ]*d" pr)
+ (substring pr (1+ (match-end 0)))
+   pr)))
+ (concat (format
+  head
+  (or (and (ivy-state-dynamic-collection ivy-last)
+   ivy--full-length)
+  ivy--length))
+ ivy--prompt-extra
+ tail))
(if ivy--directory
(abbreviate-file-name ivy--directory)
- ""))
-  (or (and (ivy-state-dynamic-collection ivy-last)
-   ivy--full-length)
-  ivy--length
+ ""
 (save-excursion
   (goto-char (point-min))
   (delete-region (point-min) (minibuffer-prompt-end))



[elpa] master d289b78 15/63: Add a new interface to customize additional exit points

2015-08-21 Thread Oleh Krehel
branch: master
commit d289b78a9301f24b12a803358cdc251375d142cc
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add a new interface to customize additional exit points

* ivy.el (ivy--actions-list): New defvar. Store the exit points per
  command.
(ivy-set-actions): New defun. Use this to set the extra exit points for
each command.
(ivy-read): Account for `ivy--actions-list'.
(ivy-switch-buffer): Set extra action to kill the buffer. Update the
call to `ivy-read'.

* counsel.el (counsel-locate): Use the single action in the function and
  customize the rest via `ivy-set-actions'.

Re #164
---
 counsel.el |   15 ---
 ivy.el |   36 ++--
 2 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/counsel.el b/counsel.el
index cf33413..5f48f30 100644
--- a/counsel.el
+++ b/counsel.el
@@ -446,6 +446,11 @@ Skip some dotfiles unless `ivy-text' requires them."
 (defvar counsel-locate-history nil
   "History for `counsel-locate'.")
 
+(ivy-set-actions
+ 'counsel-locate
+ '(("xdg-open" counsel-locate-action-extern)
+   ("dired" counsel-locate-action-dired)))
+
 ;;;###autoload
 (defun counsel-locate ()
   "Call locate shell command."
@@ -454,13 +459,9 @@ Skip some dotfiles unless `ivy-text' requires them."
 :dynamic-collection #'counsel-locate-function
 :history 'counsel-locate-history
 :action
-(cons
- 1
- '(("default" (lambda (val)
-(when val
-  (find-file val
-   ("xdg-open" counsel-locate-action-extern)
-   ("dired" counsel-locate-action-dired)
+(lambda (val)
+  (when val
+(find-file val)
 
 (defun counsel--generic (completion-fn)
   "Complete thing at point with COMPLETION-FN."
diff --git a/ivy.el b/ivy.el
index 27f76d1..dc6c412 100644
--- a/ivy.el
+++ b/ivy.el
@@ -90,6 +90,14 @@ Only \"./\" and \"../\" apply here. They appear in reverse 
order."
   "When non-nil, add `recentf-mode' and bookmarks to the list of buffers."
   :type 'boolean)
 
+(defvar ivy--actions-list nil
+  "A list of extra actions per command.")
+
+(defun ivy-set-actions (cmd actions)
+  "Set CMD extra exit points to ACTIONS."
+  (setq ivy--actions-list
+(plist-put ivy--actions-list cmd actions)))
+
 ;;* Keymap
 (require 'delsel)
 (defvar ivy-minibuffer-map
@@ -783,6 +791,12 @@ MATCHER can completely override matching.
 
 DYNAMIC-COLLECTION is a function to call to update the list of
 candidates with each input."
+  (let ((extra-actions (plist-get ivy--actions-list this-command)))
+(when extra-actions
+  (setq action
+`(1
+  ("default" ,action)
+  ,@extra-actions
   (setq ivy-last
 (make-ivy-state
  :prompt prompt
@@ -1487,21 +1501,23 @@ BUFFER may be a string or nil."
 
 (defvar ivy-switch-buffer-map (make-sparse-keymap))
 
+(ivy-set-actions
+ 'ivy-switch-buffer
+ '(("kill"
+(lambda (x)
+  (kill-buffer x)
+  (ivy--reset-state ivy-last)
+
 (defun ivy-switch-buffer ()
   "Switch to another buffer."
   (interactive)
   (if (not ivy-mode)
   (call-interactively 'switch-to-buffer)
-(ivy-read "Switch to buffer: " 'internal-complete-buffer
-  :preselect (buffer-name (other-buffer (current-buffer)))
-  :action (cons
-   1
-   '(("default" ivy--switch-buffer-action)
- ("kill"
-  (lambda (x)
-(kill-buffer x)
-(ivy--reset-state ivy-last)
-  :keymap ivy-switch-buffer-map)))
+(let ((this-command 'ivy-switch-buffer))
+  (ivy-read "Switch to buffer: " 'internal-complete-buffer
+:preselect (buffer-name (other-buffer (current-buffer)))
+:action #'ivy--switch-buffer-action
+:keymap ivy-switch-buffer-map
 
 (defun ivy-recentf ()
   "Find a file on `recentf-list'."



[elpa] master ae77d93 36/63: counsel.el (counsel-org-tag): Replace org-set-tags

2015-08-21 Thread Oleh Krehel
branch: master
commit ae77d935f3e27070f4fa0ae9c783515b68de0366
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-org-tag): Replace org-set-tags

* counsel.el (counsel-org-tags): New defvar.
(counsel-org-change-tags): New defun, adapted from part of
`org-set-tags'.
(counsel-org-tag-action): New defun.
(counsel-org-tag-prompt): New defun.
(counsel-org-tag): New command.

**Using counsel-org-tag**

- The prompt is auto-updated to the currently selected tags.
- Selecting one of the already selected tags removes it from selection.

The best shortcut for selecting/removing multiple tags is "C-M-m" (or
"g" when the "C-o" hydra is active).

Re #177
Re #91
---
 counsel.el |   73 
 1 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index e892c3e..4940281 100644
--- a/counsel.el
+++ b/counsel.el
@@ -735,6 +735,79 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
   ("p" helm-rhythmbox-play-song "Play song")
   ("e" counsel-rhythmbox-enqueue-song "Enqueue song"
 
+(defvar counsel-org-tags nil
+  "Store the current list of tags.")
+
+(defvar org-outline-regexp)
+(defvar org-indent-mode)
+(defvar org-indent-indentation-per-level)
+(defvar org-tags-column)
+(declare-function org-get-tags-string "org")
+(declare-function org-bound-and-true-p "org")
+(declare-function org-move-to-column "org")
+
+(defun counsel-org-change-tags (tags)
+  (let ((current (org-get-tags-string))
+(col (current-column))
+level)
+;; Insert new tags at the correct column
+(beginning-of-line 1)
+(setq level (or (and (looking-at org-outline-regexp)
+ (- (match-end 0) (point) 1))
+1))
+(cond
+  ((and (equal current "") (equal tags "")))
+  ((re-search-forward
+(concat "\\([ \t]*" (regexp-quote current) "\\)[ \t]*$")
+(point-at-eol) t)
+   (unless (equal tags "")
+ (goto-char (match-beginning 0))
+ (let* ((c0 (current-column))
+;; compute offset for the case of org-indent-mode active
+(di (if (org-bound-and-true-p org-indent-mode)
+(* (1- org-indent-indentation-per-level) (1- level))
+  0))
+(p0 (if (equal (char-before) ?*) (1+ (point)) (point)))
+(tc (+ org-tags-column (if (> org-tags-column 0) (- di) di)))
+(c1 (max (1+ c0) (if (> tc 0) tc (- (- tc) (string-width 
tags)
+(rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags)))
+   (replace-match rpl t t)
+   (and c0 indent-tabs-mode (tabify p0 (point)))
+   tags)))
+  (t (error "Tags alignment failed")))
+(org-move-to-column col)))
+
+(defun counsel-org-tag-action (x)
+  (if (member x counsel-org-tags)
+  (progn
+(setq counsel-org-tags (delete x counsel-org-tags)))
+(setq counsel-org-tags (append counsel-org-tags (list x)))
+(unless (member x ivy--all-candidates)
+  (setq ivy--all-candidates (append ivy--all-candidates (list x)
+  (let ((prompt (counsel-org-tag-prompt)))
+(setf (ivy-state-prompt ivy-last) prompt)
+(setq ivy--prompt (concat "%-4d " prompt)))
+  (cond ((memq this-command '(ivy-done ivy-alt-done))
+ (with-selected-window (ivy-state-window ivy-last)
+   (counsel-org-change-tags
+(mapconcat #'identity counsel-org-tags ":"
+((eq this-command 'ivy-call)
+ (delete-minibuffer-contents
+
+(defun counsel-org-tag-prompt ()
+  (format "Tags (%s): "
+  (mapconcat #'identity counsel-org-tags ", ")))
+
+;;;###autoload
+(defun counsel-org-tag ()
+  "Add or remove tags in org-mode."
+  (interactive)
+  (setq counsel-org-tags (split-string (org-get-tags-string) ":" t))
+  (ivy-read (counsel-org-tag-prompt)
+'org-tags-completion-function
+:history 'org-tags-history
+:action 'counsel-org-tag-action))
+
 (provide 'counsel)
 
 ;;; counsel.el ends here



[elpa] master 783f7c5 13/63: Update index formatting logic

2015-08-21 Thread Oleh Krehel
branch: master
commit 783f7c58776d1309c84586799f31e0fe6ec64482
Author: Oleh Krehel 
Commit: Oleh Krehel 

Update index formatting logic

* ivy.el (ivy--reset-state): Update.
(ivy--insert-prompt): Simplify.

If you want to see both the index and the length of the candidates,
instead of just the length, it can be done like this:

(setq ivy-count-format "%d/%d ")

Each "%d" is replaced appropriately due to the total length of the
candidates. For instance, this one can result in "%4d/%-4d M-x ".

Re #167
---
 ivy.el|   53 +++--
 swiper.el |3 +--
 2 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/ivy.el b/ivy.el
index 25720c9..27f76d1 100644
--- a/ivy.el
+++ b/ivy.el
@@ -927,6 +927,17 @@ This is useful for recursive `ivy-read'."
 (setq ivy--prompt
   (cond ((string-match "%.*d" prompt)
  prompt)
+((string-match "%d.*%d" ivy-count-format)
+ (let ((w (length (number-to-string
+   (length ivy--all-candidates
+   (s (copy-sequence ivy-count-format)))
+   (string-match "%d" s)
+   (match-end 0)
+   (string-match "%d" s (match-end 0))
+   (setq s (replace-match (format "%%-%dd" w) nil nil s))
+   (string-match "%d" s)
+   (concat (replace-match (format "%%%dd" w) nil nil s)
+   prompt)))
 ((string-match "%.*d" ivy-count-format)
  (concat ivy-count-format prompt))
 (ivy--directory
@@ -1155,29 +1166,27 @@ Insert .* between each char."
   (let ((inhibit-read-only t)
 (std-props '(front-sticky t rear-nonsticky t field t read-only t))
 (n-str
+ (concat
+  (if (and (bound-and-true-p minibuffer-depth-indicate-mode)
+   (> (minibuffer-depth) 1))
+  (format "[%d] " (minibuffer-depth))
+"")
   (concat
-   (if (and (bound-and-true-p minibuffer-depth-indicate-mode)
-(> (minibuffer-depth) 1))
-   (format "[%d] " (minibuffer-depth))
- "")
-   (if (string-match "%[-0-9 ]*d.*%[-0-9 ]*d" ivy-count-format)
-   (concat (format ivy-count-format (1+ ivy--index) 
ivy--length)
-   " "
-   ;; work around swiper
-   (let ((pr (ivy-state-prompt ivy-last)))
- (if (string-match "%[-0-9 ]*d" pr)
- (substring pr (1+ (match-end 0)))
-   pr)))
- (concat (format
-  head
-  (or (and (ivy-state-dynamic-collection ivy-last)
-   ivy--full-length)
-  ivy--length))
- ivy--prompt-extra
- tail))
-   (if ivy--directory
-   (abbreviate-file-name ivy--directory)
- ""
+   (if (string-match "%d.*%d" ivy-count-format)
+   (format head
+   (1+ ivy--index)
+   (or (and (ivy-state-dynamic-collection ivy-last)
+ivy--full-length)
+   ivy--length))
+ (format head
+ (or (and (ivy-state-dynamic-collection ivy-last)
+  ivy--full-length)
+ ivy--length)))
+   ivy--prompt-extra
+   tail)
+  (if ivy--directory
+  (abbreviate-file-name ivy--directory)
+""
 (save-excursion
   (goto-char (point-min))
   (delete-region (point-min) (minibuffer-prompt-end))
diff --git a/swiper.el b/swiper.el
index 1975ae2..24be153 100644
--- a/swiper.el
+++ b/swiper.el
@@ -244,8 +244,7 @@ Please remove it and update the \"swiper\" package."))
 res)
 (unwind-protect
  (setq res (ivy-read
-(replace-regexp-in-string
- "%s" "pattern: " swiper--format-spec)
+"Swiper: "
 candidates
 :initial-input initial-input
 :keymap swiper-map



[elpa] master 22ee8a6 23/63: swiper.el (swiper-font-lock-ensure): Ignore Man-mode

2015-08-21 Thread Oleh Krehel
branch: master
commit 22ee8a64b6d40b33c6e4889dbe3a46dbe6479fbb
Author: Oleh Krehel 
Commit: Oleh Krehel 

swiper.el (swiper-font-lock-ensure): Ignore Man-mode
---
 swiper.el |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/swiper.el b/swiper.el
index 24be153..816d1fe 100644
--- a/swiper.el
+++ b/swiper.el
@@ -145,7 +145,9 @@
  dired-mode
  jabber-chat-mode
  elfeed-search-mode
- fundamental-mode)))
+ fundamental-mode
+ Man-mode
+ woman-mode)))
 (unless (> (buffer-size) 10)
   (if (fboundp 'font-lock-ensure)
   (font-lock-ensure)



[elpa] master 40c17b4 54/63: Add a few more Org declarations

2015-08-21 Thread Oleh Krehel
branch: master
commit 40c17b4cc23451e6ac2cda90641dce6971aeca55
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add a few more Org declarations

Re #179
---
 counsel.el |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index 68b930f..623365d 100644
--- a/counsel.el
+++ b/counsel.el
@@ -810,6 +810,15 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 
 (defvar org-setting-tags)
 (defvar org-last-tags-completion-table)
+(defvar org-tag-persistent-alist)
+(defvar org-tag-alist)
+(defvar org-complete-tags-always-offer-all-agenda-tags)
+
+(declare-function org-at-heading-p "org")
+(declare-function org-back-to-heading "org")
+(declare-function org-get-buffer-tags "org")
+(declare-function org-global-tags-completion-table "org")
+(declare-function org-agenda-files "org")
 
 ;;;###autoload
 (defun counsel-org-tag ()



[elpa] master 4443a8b 53/63: counsel.el (org-last-tags-completion-table): Declare

2015-08-21 Thread Oleh Krehel
branch: master
commit 4443a8bef9791e3be1e301ce82d3478cc9f3ba90
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (org-last-tags-completion-table): Declare

Re #179
---
 counsel.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/counsel.el b/counsel.el
index e56d628..68b930f 100644
--- a/counsel.el
+++ b/counsel.el
@@ -809,6 +809,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
   (mapconcat #'identity counsel-org-tags ", ")))
 
 (defvar org-setting-tags)
+(defvar org-last-tags-completion-table)
 
 ;;;###autoload
 (defun counsel-org-tag ()



[elpa] master 476fc5d 58/63: Add with-ivy-window macro

2015-08-21 Thread Oleh Krehel
branch: master
commit 476fc5d647f392c82631b66538dbbf0fe9f2d939
Author: Oleh Krehel 
Commit: Oleh Krehel 

Add with-ivy-window macro

* ivy.el (with-ivy-window): New macro.
(ivy-yank-word): Update.

* swiper.el (swiper--window): Remove defvar.
(swiper-query-replace):
(swiper-avy):
(swiper-recenter-top-bottom):
(swiper--init):
(swiper--update-input-ivy):
(swiper--add-overlays): Update.

* counsel.el (counsel-git-grep-recenter):
(counsel-git-grep-action):
(counsel-M-x): Update.
(org-agenda-set-tags): Add a declare.
---
 counsel.el |8 ++--
 ivy.el |9 +-
 swiper.el  |   96 ---
 3 files changed, 58 insertions(+), 55 deletions(-)

diff --git a/counsel.el b/counsel.el
index f771ab7..6aefbb0 100644
--- a/counsel.el
+++ b/counsel.el
@@ -301,13 +301,13 @@
 
 (defun counsel-git-grep-recenter ()
   (interactive)
-  (with-selected-window (ivy-state-window ivy-last)
+  (with-ivy-window
 (counsel-git-grep-action ivy--current)
 (recenter-top-bottom)))
 
 (defun counsel-git-grep-action (x)
   (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" x)
-(with-selected-window (ivy-state-window ivy-last)
+(with-ivy-window
   (let ((file-name (match-string-no-properties 1 x))
 (line-number (match-string-no-properties 2 x)))
 (find-file (expand-file-name file-name counsel--git-grep-dir))
@@ -315,7 +315,6 @@
 (forward-line (1- (string-to-number line-number)))
 (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
 (unless (eq ivy-exit 'done)
-  (setq swiper--window (selected-window))
   (swiper--cleanup)
   (swiper--add-overlays (ivy--regex ivy-text)))
 
@@ -652,7 +651,7 @@ Optional INITIAL-INPUT is the initial input in the 
minibuffer."
   (lambda (cands)
 (funcall
  store
- (with-selected-window (ivy-state-window ivy-last)
+ (with-ivy-window
(mapcar #'counsel--M-x-transformer cands)
  (cands obarray)
  (pred 'commandp)
@@ -817,6 +816,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 (declare-function org-get-buffer-tags "org")
 (declare-function org-global-tags-completion-table "org")
 (declare-function org-agenda-files "org")
+(declare-function org-agenda-set-tags "org-agenda")
 
 ;;;###autoload
 (defun counsel-org-tag ()
diff --git a/ivy.el b/ivy.el
index 10f1d6c..55005de 100644
--- a/ivy.el
+++ b/ivy.el
@@ -237,6 +237,13 @@ When non-nil, it should contain one %d.")
 ,@body))
  (minibuffer-keyboard-quit)))
 
+(defmacro with-ivy-window (&rest body)
+  "Execute BODY in the window from which `ivy-read' was called."
+  (declare (indent 0)
+   (debug t))
+  `(with-selected-window (ivy-state-window ivy-last)
+ ,@body))
+
 (defun ivy--done (text)
   "Insert TEXT and exit minibuffer."
   (if (and ivy--directory
@@ -1599,7 +1606,7 @@ BUFFER may be a string or nil."
   "Pull next word from buffer into search string."
   (interactive)
   (let (amend)
-(with-selected-window (ivy-state-window ivy-last)
+(with-ivy-window
   (let ((pt (point))
 (le (line-end-position)))
 (forward-word 1)
diff --git a/swiper.el b/swiper.el
index e7bd574..1032f04 100644
--- a/swiper.el
+++ b/swiper.el
@@ -83,9 +83,6 @@
 map)
   "Keymap for swiper.")
 
-(defvar swiper--window nil
-  "Store the current window.")
-
 (defun swiper-query-replace ()
   "Start `query-replace' with string to replace from last search string."
   (interactive)
@@ -96,7 +93,7 @@
(to (query-replace-read-to from "Query replace" t)))
   (delete-minibuffer-contents)
   (ivy-set-action (lambda (_)
-(with-selected-window swiper--window
+(with-ivy-window
   (move-beginning-of-line 1)
   (perform-replace from to
t t nil
@@ -115,7 +112,7 @@
   "Jump to one of the current swiper candidates."
   (interactive)
   (unless (string= ivy-text "")
-(with-selected-window (ivy-state-window ivy-last)
+(with-ivy-window
   (let* ((avy-all-windows nil)
  (candidates
   (avy--regex-candidates
@@ -127,9 +124,9 @@
  (avy-action-goto candidate))
 
 (defun swiper-recenter-top-bottom (&optional arg)
-  "Call (`recenter-top-bottom' ARG) in `swiper--window'."
+  "Call (`recenter-top-bottom' ARG)."
   (interactive "P")
-  (with-selected-window swiper--window
+  (with-ivy-window
 (recenter-top-bottom arg)))
 
 (defun swiper-font-lock-ensure ()
@@ -201,8 +198,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
   "Perform initialization common to both completion methods."
   (setq swiper--opoint (point))
   (setq swiper--len 0)
-  (setq swiper--anchor (line-number-at-pos))
-  (setq

[elpa] master f5dac47 63/63: Merge commit '09f86fca437f1b2e168093824e9d4ee0aea5130a' from swiper

2015-08-21 Thread Oleh Krehel
branch: master
commit f5dac473c5461c4834431feac50ea18b6948d4df
Merge: b0039dd 09f86fc
Author: Oleh Krehel 
Commit: Oleh Krehel 

Merge commit '09f86fca437f1b2e168093824e9d4ee0aea5130a' from swiper
---
 packages/swiper/counsel.el|  379 ++---
 packages/swiper/doc/Changelog.org |  296 +
 packages/swiper/ivy-hydra.el  |   15 +-
 packages/swiper/ivy-test.el   |8 +
 packages/swiper/ivy.el|  363 ++-
 packages/swiper/swiper.el |  117 ++--
 6 files changed, 961 insertions(+), 217 deletions(-)

diff --git a/packages/swiper/counsel.el b/packages/swiper/counsel.el
index 94c8608..63c9552 100644
--- a/packages/swiper/counsel.el
+++ b/packages/swiper/counsel.el
@@ -34,6 +34,12 @@
 
 (require 'swiper)
 
+(defvar counsel-completion-beg nil
+  "Completion bounds start.")
+
+(defvar counsel-completion-end nil
+  "Completion bounds end.")
+
 ;;;###autoload
 (defun counsel-el ()
   "Elisp completion at point."
@@ -75,12 +81,6 @@
   :initial-input str
   :action #'counsel--el-action)))
 
-(defvar counsel-completion-beg nil
-  "Completion bounds start.")
-
-(defvar counsel-completion-end nil
-  "Completion bounds end.")
-
 (defun counsel--el-action (symbol)
   "Insert SYMBOL, erasing the previous one."
   (when (stringp symbol)
@@ -142,6 +142,16 @@
  (match-string 1 s)
s
 
+(defun counsel-variable-list ()
+  "Return the list of all currently bound variables."
+  (let (cands)
+(mapatoms
+ (lambda (vv)
+   (when (or (get vv 'variable-documentation)
+ (and (boundp vv) (not (keywordp vv
+ (push (symbol-name vv) cands
+cands))
+
 ;;;###autoload
 (defun counsel-describe-variable ()
   "Forward to `describe-variable'."
@@ -149,13 +159,7 @@
   (let ((enable-recursive-minibuffers t))
 (ivy-read
  "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)
+ (counsel-variable-list)
  :keymap counsel-describe-map
  :preselect (counsel-symbol-at-point)
  :history 'counsel-describe-symbol-history
@@ -165,6 +169,16 @@
(describe-variable
 (intern x))
 
+(ivy-set-actions
+ 'counsel-describe-variable
+ '(("i" counsel-info-lookup-symbol "info")
+   ("d" counsel--find-symbol "definition")))
+
+(ivy-set-actions
+ 'counsel-describe-function
+ '(("i" counsel-info-lookup-symbol "info")
+   ("d" counsel--find-symbol "definition")))
+
 ;;;###autoload
 (defun counsel-describe-function ()
   "Forward to `describe-function'."
@@ -262,24 +276,21 @@
 (defvar counsel--git-grep-count nil
   "Store the line count in current repository.")
 
+(defun counsel-more-chars (n)
+  "Return two fake candidates prompting for at least N input."
+  (list ""
+(format "%d chars more" (- n (length ivy-text)
+
 (defun counsel-git-grep-function (string &optional _pred &rest _unused)
   "Grep in the current git repository for STRING."
   (if (and (> counsel--git-grep-count 2)
(< (length string) 3))
-  (progn
-(setq ivy--full-length counsel--git-grep-count)
-(list ""
-  (format "%d chars more" (- 3 (length ivy-text)
+  (counsel-more-chars 3)
 (let* ((default-directory counsel--git-grep-dir)
(cmd (format "git --no-pager grep --full-name -n --no-color -i -e 
%S"
-(ivy--regex string t)))
-   res)
+(ivy--regex string t
   (if (<= counsel--git-grep-count 2)
-  (progn
-(setq res (shell-command-to-string cmd))
-(setq ivy--full-length nil)
-(split-string res "\n" t))
-(setq ivy--full-length -1)
+  (split-string (shell-command-to-string cmd) "\n" t)
 (counsel--gg-candidates (ivy--regex string))
 nil
 
@@ -290,40 +301,40 @@
 
 (defun counsel-git-grep-recenter ()
   (interactive)
-  (with-selected-window (ivy-state-window ivy-last)
+  (with-ivy-window
 (counsel-git-grep-action ivy--current)
 (recenter-top-bottom)))
 
 (defun counsel-git-grep-action (x)
   (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" x)
-(let ((file-name (match-string-no-properties 1 x))
-  (line-number (match-string-no-properties 2 x)))
-  (find-file (expand-file-name file-name counsel--git-grep-dir))
-  (goto-char (point-min))
-  (forward-line (1- (string-to-number line-number)))
-  (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
-  (unless (eq ivy-exit 'done)
-(setq swiper--window (selected-window))
-(swiper--cleanup)
-(swiper--add-overlays (ivy--regex ivy-text))
+(with-ivy-window
+  (let ((file-na

[elpa] master 13d0c50 56/63: counsel.el (counsel-org-tag-agenda): New command

2015-08-21 Thread Oleh Krehel
branch: master
commit 13d0c5096cd67d8398f145fbd30838858ce6f632
Author: Oleh Krehel 
Commit: Oleh Krehel 

counsel.el (counsel-org-tag-agenda): New command

* counsel.el (counsel-org-tag-agenda): It's just a flet wrapper around
  `org-agenda-set-tags', changing `org-set-tags' to `counsel-org-tag'.
(counsel-org-tag-action): Don't use `with-selected-window', since
`org-agenda-set-tags' will change the buffer for us.

Re #177
---
 counsel.el |   23 +--
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/counsel.el b/counsel.el
index ce4087d..f771ab7 100644
--- a/counsel.el
+++ b/counsel.el
@@ -794,12 +794,11 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 (setf (ivy-state-prompt ivy-last) prompt)
 (setq ivy--prompt (concat "%-4d " prompt)))
   (cond ((memq this-command '(ivy-done ivy-alt-done))
- (with-selected-window (ivy-state-window ivy-last)
-   (counsel-org-change-tags
-(if counsel-org-tags
-(format ":%s:"
-(mapconcat #'identity counsel-org-tags ":"))
-  ""
+ (counsel-org-change-tags
+  (if counsel-org-tags
+  (format ":%s:"
+  (mapconcat #'identity counsel-org-tags ":"))
+"")))
 ((eq this-command 'ivy-call)
  (delete-minibuffer-contents
 
@@ -842,6 +841,18 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
 :history 'org-tags-history
 :action 'counsel-org-tag-action
 
+;;;###autoload
+(defun counsel-org-tag-agenda ()
+  "Set tags for the current agenda item."
+  (interactive)
+  (let ((store (symbol-function 'org-set-tags)))
+(unwind-protect
+ (progn
+   (fset 'org-set-tags
+ (symbol-function 'counsel-org-tag))
+   (org-agenda-set-tags nil nil))
+  (fset 'org-set-tags store
+
 (defun counsel-ag-function (string &optional _pred &rest _unused)
   "Grep in the current directory for STRING."
   (if (< (length string) 3)



[elpa] master 8380161 2/3: Version bump

2015-08-21 Thread Artur Malabarba
branch: master
commit 8380161ecfa24a22ef95ce05b5567adc853efa01
Author: Artur Malabarba 
Commit: Artur Malabarba 

Version bump
---
 sotlisp.el |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sotlisp.el b/sotlisp.el
index ad5dc40..1d9030e 100644
--- a/sotlisp.el
+++ b/sotlisp.el
@@ -6,7 +6,7 @@
 ;; URL: https://github.com/Malabarba/speed-of-thought-lisp
 ;; Keywords: convenience, lisp
 ;; Package-Requires: ((emacs "24.1"))
-;; Version: 1.2
+;; Version: 1.3
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by



[elpa] master bfe3469 3/3: Merge commit '8380161ecfa24a22ef95ce05b5567adc853efa01'

2015-08-21 Thread Artur Malabarba
branch: master
commit bfe34692deb1daf8a593676e7b03e56217d362b4
Merge: f5dac47 8380161
Author: Artur Malabarba 
Commit: Artur Malabarba 

Merge commit '8380161ecfa24a22ef95ce05b5567adc853efa01'
---
 packages/sotlisp/sotlisp.el |   92 ++-
 1 files changed, 90 insertions(+), 2 deletions(-)

diff --git a/packages/sotlisp/sotlisp.el b/packages/sotlisp/sotlisp.el
index 6e4bb11..5e3dcb4 100644
--- a/packages/sotlisp/sotlisp.el
+++ b/packages/sotlisp/sotlisp.el
@@ -6,7 +6,7 @@
 ;; URL: https://github.com/Malabarba/speed-of-thought-lisp
 ;; Keywords: convenience, lisp
 ;; Package-Requires: ((emacs "24.1"))
-;; Version: 1.2
+;; Version: 1.3
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -443,8 +443,11 @@ If `speed-of-thought-mode' is already on, call ON."
 ;;; The local minor-mode
 (define-minor-mode sotlisp-mode
   nil nil " SoT"
-  '(([M-return] . sotlisp-newline-and-parentheses)
+  `(([M-return] . sotlisp-newline-and-parentheses)
 ([C-return] . sotlisp-downlist-newline-and-parentheses)
+(,(kbd "C-M-;") . ,(if (boundp 'comment-or-uncomment-sexp)
+   #'comment-or-uncomment-sexp
+ #'sotlisp-comment-or-uncomment-sexp))
 ("\C-cf". sotlisp-find-or-define-function)
 ("\C-cv". sotlisp-find-or-define-variable)))
 
@@ -587,5 +590,90 @@ With a prefix argument, defines a `defvar' instead of a 
`defcustom'."
 (if prefix "" "\n  :type 'boolean")
 ")\n\n")))
 
+
+;;; Comment sexp
+(defun sotlisp-uncomment-sexp (&optional n)
+  "Uncomment a sexp around point."
+  (interactive "P")
+  (let* ((initial-point (point-marker))
+ (p)
+ (end (save-excursion
+(when (elt (syntax-ppss) 4)
+  (re-search-backward comment-start-skip
+  (line-beginning-position)
+  t))
+(setq p (point-marker))
+(comment-forward (point-max))
+(point-marker)))
+ (beg (save-excursion
+(forward-line 0)
+(while (= end (save-excursion
+(comment-forward (point-max))
+(point)))
+  (forward-line -1))
+(goto-char (line-end-position))
+(re-search-backward comment-start-skip
+(line-beginning-position)
+t)
+(while (looking-at-p comment-start-skip)
+  (forward-char -1))
+(point-marker
+(unless (= beg end)
+  (uncomment-region beg end)
+  (goto-char p)
+  ;; Indentify the "top-level" sexp inside the comment.
+  (while (and (ignore-errors (backward-up-list) t)
+  (>= (point) beg))
+(skip-chars-backward (rx (syntax expression-prefix)))
+(setq p (point-marker)))
+  ;; Re-comment everything before it. 
+  (ignore-errors
+(comment-region beg p))
+  ;; And everything after it.
+  (goto-char p)
+  (forward-sexp (or n 1))
+  (skip-chars-forward "\r\n[:blank:]")
+  (if (< (point) end)
+  (ignore-errors
+(comment-region (point) end))
+;; If this is a closing delimiter, pull it up.
+(goto-char end)
+(skip-chars-forward "\r\n[:blank:]")
+(when (= 5 (car (syntax-after (point
+  (delete-indentation
+;; Without a prefix, it's more useful to leave point where
+;; it was.
+(unless n
+  (goto-char initial-point
+
+(defun sotlisp--comment-sexp-raw ()
+  "Comment the sexp at point or ahead of point."
+  (pcase (or (bounds-of-thing-at-point 'sexp)
+ (save-excursion
+   (skip-chars-forward "\r\n[:blank:]")
+   (bounds-of-thing-at-point 'sexp)))
+(`(,l . ,r)
+ (goto-char r)
+ (skip-chars-forward "\r\n[:blank:]")
+ (save-excursion
+   (comment-region l r))
+ (skip-chars-forward "\r\n[:blank:]"
+
+(defun sotlisp-comment-or-uncomment-sexp (&optional n)
+  "Comment the sexp at point and move past it.
+If already inside (or before) a comment, uncomment instead.
+With a prefix argument N, (un)comment that many sexps."
+  (interactive "P")
+  (if (or (elt (syntax-ppss) 4)
+  (< (save-excursion
+   (skip-chars-forward "\r\n[:blank:]")
+   (point))
+ (save-excursion
+   (comment-forward 1)
+   (point
+  (sotlisp-uncomment-sexp n)
+(dotimes (_ (or n 1))
+  (sotlisp--comment-sexp-raw
+
 (provide 'sotlisp)
 ;;; sotlisp.el ends here



[elpa] master f857d30 1/3: Add comment-or-uncomment-sexp command

2015-08-21 Thread Artur Malabarba
branch: master
commit f857d3025261e8f323e00566059771feb47a3eba
Author: Artur Malabarba 
Commit: Artur Malabarba 

Add comment-or-uncomment-sexp command
---
 sotlisp.el |   90 +++-
 1 files changed, 89 insertions(+), 1 deletions(-)

diff --git a/sotlisp.el b/sotlisp.el
index c67ed8a..ad5dc40 100644
--- a/sotlisp.el
+++ b/sotlisp.el
@@ -443,8 +443,11 @@ If `speed-of-thought-mode' is already on, call ON."
 ;;; The local minor-mode
 (define-minor-mode sotlisp-mode
   nil nil " SoT"
-  '(([M-return] . sotlisp-newline-and-parentheses)
+  `(([M-return] . sotlisp-newline-and-parentheses)
 ([C-return] . sotlisp-downlist-newline-and-parentheses)
+(,(kbd "C-M-;") . ,(if (boundp 'comment-or-uncomment-sexp)
+   #'comment-or-uncomment-sexp
+ #'sotlisp-comment-or-uncomment-sexp))
 ("\C-cf". sotlisp-find-or-define-function)
 ("\C-cv". sotlisp-find-or-define-variable)))
 
@@ -588,6 +591,91 @@ With a prefix argument, defines a `defvar' instead of a 
`defcustom'."
 (if prefix "" "\n  :type 'boolean")
 ")\n\n")))
 
+
+;;; Comment sexp
+(defun sotlisp-uncomment-sexp (&optional n)
+  "Uncomment a sexp around point."
+  (interactive "P")
+  (let* ((initial-point (point-marker))
+ (p)
+ (end (save-excursion
+(when (elt (syntax-ppss) 4)
+  (re-search-backward comment-start-skip
+  (line-beginning-position)
+  t))
+(setq p (point-marker))
+(comment-forward (point-max))
+(point-marker)))
+ (beg (save-excursion
+(forward-line 0)
+(while (= end (save-excursion
+(comment-forward (point-max))
+(point)))
+  (forward-line -1))
+(goto-char (line-end-position))
+(re-search-backward comment-start-skip
+(line-beginning-position)
+t)
+(while (looking-at-p comment-start-skip)
+  (forward-char -1))
+(point-marker
+(unless (= beg end)
+  (uncomment-region beg end)
+  (goto-char p)
+  ;; Indentify the "top-level" sexp inside the comment.
+  (while (and (ignore-errors (backward-up-list) t)
+  (>= (point) beg))
+(skip-chars-backward (rx (syntax expression-prefix)))
+(setq p (point-marker)))
+  ;; Re-comment everything before it. 
+  (ignore-errors
+(comment-region beg p))
+  ;; And everything after it.
+  (goto-char p)
+  (forward-sexp (or n 1))
+  (skip-chars-forward "\r\n[:blank:]")
+  (if (< (point) end)
+  (ignore-errors
+(comment-region (point) end))
+;; If this is a closing delimiter, pull it up.
+(goto-char end)
+(skip-chars-forward "\r\n[:blank:]")
+(when (= 5 (car (syntax-after (point
+  (delete-indentation
+;; Without a prefix, it's more useful to leave point where
+;; it was.
+(unless n
+  (goto-char initial-point
+
+(defun sotlisp--comment-sexp-raw ()
+  "Comment the sexp at point or ahead of point."
+  (pcase (or (bounds-of-thing-at-point 'sexp)
+ (save-excursion
+   (skip-chars-forward "\r\n[:blank:]")
+   (bounds-of-thing-at-point 'sexp)))
+(`(,l . ,r)
+ (goto-char r)
+ (skip-chars-forward "\r\n[:blank:]")
+ (save-excursion
+   (comment-region l r))
+ (skip-chars-forward "\r\n[:blank:]"
+
+(defun sotlisp-comment-or-uncomment-sexp (&optional n)
+  "Comment the sexp at point and move past it.
+If already inside (or before) a comment, uncomment instead.
+With a prefix argument N, (un)comment that many sexps."
+  (interactive "P")
+  (if (or (elt (syntax-ppss) 4)
+  (< (save-excursion
+   (skip-chars-forward "\r\n[:blank:]")
+   (point))
+ (save-excursion
+   (comment-forward 1)
+   (point
+  (sotlisp-uncomment-sexp n)
+(dotimes (_ (or n 1))
+  (sotlisp--comment-sexp-raw
+
 (provide 'sotlisp)
 ;;; sotlisp.el ends here
 



[elpa] master updated (f5dac47 -> bfe3469)

2015-08-21 Thread Artur Malabarba
malabarba pushed a change to branch master.

  from  f5dac47   Merge commit '09f86fca437f1b2e168093824e9d4ee0aea5130a' 
from swiper
   new  f857d30   Add comment-or-uncomment-sexp command
   new  8380161   Version bump
   new  bfe3469   Merge commit '8380161ecfa24a22ef95ce05b5567adc853efa01'


Summary of changes:
 packages/sotlisp/sotlisp.el |   92 ++-
 1 files changed, 90 insertions(+), 2 deletions(-)



[elpa] master 5de341c: * dts-mode/dts-mode.el (dts-indent-rules): Handle hanging "<".

2015-08-21 Thread Stefan Monnier
branch: master
commit 5de341c841d28fe41d6c8636c50123f0ed7e8290
Author: Stefan Monnier 
Commit: Stefan Monnier 

* dts-mode/dts-mode.el (dts-indent-rules): Handle hanging "<".
(dts-mode): Set indent-tabs-mode.
(dts--using-macro): Fix Edebug descriptor.
---
 packages/dts-mode/dts-mode.el |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/packages/dts-mode/dts-mode.el b/packages/dts-mode/dts-mode.el
index f150f33..99aff26 100644
--- a/packages/dts-mode/dts-mode.el
+++ b/packages/dts-mode/dts-mode.el
@@ -97,7 +97,7 @@
 
 ;; Compatibility macro.
 (defmacro dts--using-macro (name exp)
-  (declare (indent 1) (debug (symbol form)))
+  (declare (indent 1) (debug (symbolp form)))
   (if (fboundp name);If macro exists at compiler-time, just use it.
   exp
 `(when (fboundp ',name);Else, check if it exists at run-time.
@@ -135,6 +135,7 @@
;;  "clocks = <&apb1_gates 6>;".
(and (eq (char-before) ?<) (not (looking-at "&"
   (`(:before . "{") (smie-rule-parent))
+  (`(:before . "<") (if (smie-rule-hanging-p) (smie-rule-parent)))
   (`(:after . "=") (dts-indent-rules :elem 'basic))
   )))
 
@@ -150,10 +151,15 @@
   ;; Fonts
   (set (make-local-variable 'font-lock-defaults)
'(dts-mode-font-lock-keywords nil nil nil nil))
-
   (set (make-local-variable 'comment-start) "/* ")
   (set (make-local-variable 'comment-end)   " */")
   (set (make-local-variable 'comment-multi-line) t)
+
+  ;; This is not specific to the DTS format, really, but DTS is mostly
+  ;; used in the context of the Linux kernel (and U-boot loader) where
+  ;; there's a strong preference to indent with TABs.
+  (set (make-local-variable 'indent-tabs-mode) t)
+
   (dts--using-macro syntax-propertize-rules
 (set (make-local-variable 'syntax-propertize-function)
  (syntax-propertize-rules



[elpa] master 31f2776: iterators.el: fix comments

2015-08-21 Thread Michael Heerdegen
branch: master
commit 31f2776b8a6d89e0c32dadc0cc9b1c4df2af8900
Author: Michael Heerdegen 
Commit: Michael Heerdegen 

iterators.el: fix comments
---
 packages/iterators/iterators.el |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/packages/iterators/iterators.el b/packages/iterators/iterators.el
index 544b874..5ed1e8a 100644
--- a/packages/iterators/iterators.el
+++ b/packages/iterators/iterators.el
@@ -36,7 +36,7 @@
 (require 'generator)
 
 
-;; Basic stuff
+ Basic stuff
 
 (defmacro iterator-make (&rest body)
   "Create an anonymous iterator.
@@ -44,7 +44,7 @@ This is equivalent to (funcall (iter-lambda () BODY...))"
   `(funcall (iter-lambda () ,@body)))
 
 
-;; Special simple iterators
+ Special simple iterators
 
 (defun iterator-from-elts (&rest elements)
   "Return an iterator generating the ELEMENTS."
@@ -92,7 +92,7 @@ used between the numbers and defaults to 1."
   (iterator-make (while t (iter-yield (prog1 i (cl-incf i
 
 
-;; Operations on iterators, transducers
+ Operations on iterators, transducers
 
 (defun iterator-filter (predicate iterator)
   "Return an iterator filtering ITERATOR with PREDICATE.
@@ -174,7 +174,7 @@ returns an iterator of the factorials."
iterator
 
 
-;; Iteration
+ Iteration
 
 (defun iterator-flush (iterator)
   "Request all elements from ITERATOR, for side effects only."
@@ -183,7 +183,7 @@ returns an iterator of the factorials."
 (iter-end-of-sequence nil)))
 
 
-;; Processing elements
+ Processing elements
 
 (defun iterator-reduce (function init iterator)
   "Reduce two-argument FUNCTION across ITERATOR starting with INIT.
@@ -264,7 +264,7 @@ like `mapconcat', but for iterators."
  (iterator-map function iterator
 
 
-;;; ILists - "Delayed" lists via iterators
+ ILists - "Delayed" lists via iterators
 
 (defconst ilist--last-link-tag 'ilist--last-link-tag)