[elpa] master 366689f 6/9: Fix byte-compiler warnings
branch: master commit 366689f15373ffacfe4d28b36e6325d193a4e752 Author: Oleh Krehel Commit: Oleh Krehel Fix byte-compiler warnings --- tiny.el | 19 +-- 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tiny.el b/tiny.el index eeebebe..90c89d5 100644 --- a/tiny.el +++ b/tiny.el @@ -4,7 +4,7 @@ ;; Author: Oleh Krehel ;; URL: https://github.com/abo-abo/tiny -;; Version: 0.1 +;; Version: 0.1.1 ;; Keywords: convenience ;; This file is part of GNU Emacs. @@ -122,6 +122,11 @@ At the moment, only `tiny-mapconcat' is supported. "Setup shortcuts." (global-set-key (kbd "C-;") 'tiny-expand)) +(defalias 'tiny--preceding-sexp +(if (fboundp 'elisp--preceding-sexp) +'elisp--preceding-sexp + 'preceding-sexp)) + ;;;###autoload (defun tiny-replace-this-sexp () "Eval and replace the current sexp. @@ -137,9 +142,9 @@ On error go up list and try again." (catch 'success (while t (ignore-errors - (unless (looking-back ")") + (unless (looking-back ")" (line-beginning-position)) (error "Bad location")) - (let ((sexp (preceding-sexp))) + (let ((sexp (tiny--preceding-sexp))) (if (eq (car sexp) 'lambda) (error "Lambda evaluates to itself") (let ((value (eval sexp))) @@ -272,7 +277,8 @@ Return nil if nothing was matched, otherwise (when (catch 'done (cond ;; either start with a number - ((looking-back "\\bm\\(-?[0-9]+\\)\\([^\n]*?\\)") + ((looking-back "\\bm\\(-?[0-9]+\\)\\([^\n]*?\\)" + (line-beginning-position)) (setq n1 (match-string-no-properties 1) str (match-string-no-properties 2) tiny-beg (match-beginning 0) @@ -282,7 +288,8 @@ Return nil if nothing was matched, otherwise n1 nil) (throw 'done t))) ;; else capture the whole thing - ((looking-back "\\bm\\([^%|\n]*[0-9][^\n]*\\)") + ((looking-back "\\bm\\([^%|\n]*[0-9][^\n]*\\)" + (line-beginning-position)) (setq str (match-string-no-properties 1) tiny-beg (match-beginning 0) tiny-end (match-end 0)) @@ -367,7 +374,7 @@ Return nil if nothing was matched, otherwise (cond ;; general functionp ((not (eq t (help-function-arglist sym))) - (setq expect-fun) + (setq expect-fun nil) (setq allow-spc t) ;; (when (zerop n-paren) (push "(" out)) (unless (equal (car out) "(")
[elpa] master 98726b3 2/9: Makefile: bring back cask for undercover to load
branch: master commit 98726b37174d00fc01c8b5d5561e31ea3f62520a Author: Oleh Krehel Commit: Oleh Krehel Makefile: bring back cask for undercover to load --- Makefile |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index 33f8666..591e863 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ +CASK = ~/.cask/bin/cask emacs ?= emacs all: test test: clean - $(emacs) -Q -batch -l tiny-test.el -l tiny.el --eval "(ert t)" + $(CASK) exec emacs -Q -batch -l tiny-test.el -l tiny.el -f ert-run-tests-batch-and-exit compile: $(emacs) -Q -batch -f batch-byte-compile tiny.el
[elpa] master 7e5f64e 5/9: hydra-ox.el: Add a require hydra
branch: master commit 7e5f64e17bead1cc680f3738191f329fe769ffe8 Author: Jonas Bernoulli Commit: Jonas Bernoulli hydra-ox.el: Add a require hydra --- hydra-ox.el |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/hydra-ox.el b/hydra-ox.el index 5f1a5c9..0d489e5 100644 --- a/hydra-ox.el +++ b/hydra-ox.el @@ -24,6 +24,8 @@ ;; This shows how a complex dispatch menu can be built with Hydra. ;;; Code: + +(require 'hydra) (require 'org) (defhydradio hydra-ox ()
[elpa] master updated (8574898 -> a0561bf)
abo_abo pushed a change to branch master. from 8574898 * .gitignore: Add .dir-locals?.el entry new 2f68d9c Allow empty separator though e.g. "mm10" new 98726b3 Makefile: bring back cask for undercover to load new 144892b Makefile: use plain cask new 366689f Fix byte-compiler warnings new 9b83857 Merge commit '366689f15373ffacfe4d28b36e6325d193a4e752' from tiny new 90a4e76 hydra.el (hydra-disable): Call the exit action only in one frame new 7e5f64e hydra-ox.el: Add a require hydra new 97c2270 Fix byte-compiler warning new a0561bf Merge commit '97c2270f7138530de21f773f094c1495498cac78' from hydra Summary of changes: packages/hydra/hydra-ox.el |2 ++ packages/hydra/hydra-test.el |2 +- packages/hydra/hydra.el | 14 +++--- packages/tiny/Makefile | 15 +-- packages/tiny/tiny-test.el |2 ++ packages/tiny/tiny.el| 33 +++-- 6 files changed, 40 insertions(+), 28 deletions(-)
[elpa] master a0561bf 9/9: Merge commit '97c2270f7138530de21f773f094c1495498cac78' from hydra
branch: master commit a0561bff0dfcf267ee1796924f5aad904c377ee9 Merge: 9b83857 97c2270 Author: Oleh Krehel Commit: Oleh Krehel Merge commit '97c2270f7138530de21f773f094c1495498cac78' from hydra --- packages/hydra/hydra-ox.el |2 ++ packages/hydra/hydra-test.el |2 +- packages/hydra/hydra.el | 14 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/hydra/hydra-ox.el b/packages/hydra/hydra-ox.el index 1dc7088..e8d48e3 100644 --- a/packages/hydra/hydra-ox.el +++ b/packages/hydra/hydra-ox.el @@ -24,6 +24,8 @@ ;; This shows how a complex dispatch menu can be built with Hydra. ;;; Code: + +(require 'hydra) (require 'org) (require 'hydra);`defhydradio' is not autoloaded! diff --git a/packages/hydra/hydra-test.el b/packages/hydra/hydra-test.el index 3fcd403..a40a0ca 100644 --- a/packages/hydra/hydra-test.el +++ b/packages/hydra/hydra-test.el @@ -1310,7 +1310,7 @@ _w_ Worf: % -8`hydra-tng/worf^^ _h_ Set phasers to (goto-char (point-max)) (search-backward "|") (delete-char 1) - (setq current-prefix-arg) + (setq current-prefix-arg nil) ,@body (insert "|") (when (region-active-p) diff --git a/packages/hydra/hydra.el b/packages/hydra/hydra.el index 16d44b0..a7a71ac 100644 --- a/packages/hydra/hydra.el +++ b/packages/hydra/hydra.el @@ -5,7 +5,7 @@ ;; Author: Oleh Krehel ;; Maintainer: Oleh Krehel ;; URL: https://github.com/abo-abo/hydra -;; Version: 0.13.3 +;; Version: 0.13.4 ;; Keywords: bindings ;; Package-Requires: ((cl-lib "0.5")) @@ -149,12 +149,12 @@ warn: keep KEYMAP and issue a warning instead of running the command." (dolist (frame (frame-list)) (with-selected-frame frame (when overriding-terminal-local-map -(internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map) -(unless hydra--ignore - (when hydra-curr-on-exit -(let ((on-exit hydra-curr-on-exit)) - (setq hydra-curr-on-exit nil) - (funcall on-exit +(internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map + (unless hydra--ignore +(when hydra-curr-on-exit + (let ((on-exit hydra-curr-on-exit)) +(setq hydra-curr-on-exit nil) +(funcall on-exit) (unless (fboundp 'internal-push-keymap) (defun internal-push-keymap (keymap symbol)
[elpa] master 90a4e76 4/9: hydra.el (hydra-disable): Call the exit action only in one frame
branch: master commit 90a4e76c378239940e22696f02b6843b162da2fd Author: Oleh Krehel Commit: Oleh Krehel hydra.el (hydra-disable): Call the exit action only in one frame * hydra.el (hydra-disable): Move the action calling code out of (frame-list) loop. The (frame-list) loop was added to fix #105 to restor the terminal-local-map in all frames. There's no reason for action-calling code to be in that loop. Fixes #169. --- hydra.el | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hydra.el b/hydra.el index 16d44b0..d4160bf 100644 --- a/hydra.el +++ b/hydra.el @@ -149,12 +149,12 @@ warn: keep KEYMAP and issue a warning instead of running the command." (dolist (frame (frame-list)) (with-selected-frame frame (when overriding-terminal-local-map -(internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map) -(unless hydra--ignore - (when hydra-curr-on-exit -(let ((on-exit hydra-curr-on-exit)) - (setq hydra-curr-on-exit nil) - (funcall on-exit +(internal-pop-keymap hydra-curr-map 'overriding-terminal-local-map + (unless hydra--ignore +(when hydra-curr-on-exit + (let ((on-exit hydra-curr-on-exit)) +(setq hydra-curr-on-exit nil) +(funcall on-exit) (unless (fboundp 'internal-push-keymap) (defun internal-push-keymap (keymap symbol)
[elpa] master 144892b 3/9: Makefile: use plain cask
branch: master commit 144892bdee1fc00a01a7a5ccaae1272c51998911 Author: Oleh Krehel Commit: Oleh Krehel Makefile: use plain cask --- Makefile |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 591e863..708ea1a 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,8 @@ -CASK = ~/.cask/bin/cask emacs ?= emacs all: test test: clean - $(CASK) exec emacs -Q -batch -l tiny-test.el -l tiny.el -f ert-run-tests-batch-and-exit + cask exec emacs -Q -batch -l tiny-test.el -l tiny.el -f ert-run-tests-batch-and-exit compile: $(emacs) -Q -batch -f batch-byte-compile tiny.el
[elpa] master 2f68d9c 1/9: Allow empty separator though e.g. "mm10"
branch: master commit 2f68d9c43add3ef43c088e8cc7afd5a04caa5723 Author: Oleh Krehel Commit: Oleh Krehel Allow empty separator though e.g. "mm10" * tiny.el (tiny-mapconcat): Update. * tiny-test.el (tiny-mapconcat): Add test. * Makefile: Simplify. Fixes #4. --- Makefile | 15 +-- tiny-test.el |2 ++ tiny.el | 14 ++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 6332238..33f8666 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,13 @@ -EMACS ?= emacs -CASK_EXEC ?= cask exec - +emacs ?= emacs all: test -test: clean-elc - ${MAKE} unit - -unit: - ${CASK_EXEC} ${EMACS} -Q -batch -l tiny-test.el -l tiny.el --eval "(ert t)" +test: clean + $(emacs) -Q -batch -l tiny-test.el -l tiny.el --eval "(ert t)" compile: - ${CASK_EXEC} ${EMACS} -Q -batch -f batch-byte-compile tiny.el + $(emacs) -Q -batch -f batch-byte-compile tiny.el -clean-elc: +clean: rm -f f.elc .PHONY:all test diff --git a/tiny-test.el b/tiny-test.el index dc9c3b9..3d9ec54 100644 --- a/tiny-test.el +++ b/tiny-test.el @@ -74,6 +74,8 @@ with point at the end of TXT." (ert-deftest tiny-mapconcat () (should (equal (with-text-value "m10" (lambda()(eval (read (tiny-mapconcat) "0 1 2 3 4 5 6 7 8 9 10")) + (should (equal (with-text-value "mm10" (lambda()(eval (read (tiny-mapconcat) + "012345678910")) (should (equal (with-text-value "m5 10" (lambda()(eval (read (tiny-mapconcat) "5 6 7 8 9 10")) (should (equal (with-text-value "m5 10*xx" (lambda()(eval (read (tiny-mapconcat) diff --git a/tiny.el b/tiny.el index 78d44bb..eeebebe 100644 --- a/tiny.el +++ b/tiny.el @@ -169,8 +169,14 @@ Must throw an error when can't go up further." Defaults are used in place of null values." (let ((parsed (tiny-mapconcat-parse))) (when parsed - (let* ((n1 (or (nth 0 parsed) "0")) - (s1 (or (nth 1 parsed) " ")) + (let* ((n0 (or (nth 0 parsed) "0")) + (n1 (nth 1 parsed)) + (s1 (cond ((null n1) +" ") + ((equal n1 "m") +"") + (t +n1))) (n2 (nth 2 parsed)) (expr (or (nth 3 parsed) "x")) (lexpr (read expr)) @@ -193,12 +199,12 @@ Defaults are used in place of null values." (cdr tes) " ") ")))(number-sequence %s %s) \"%s\")"))) -(unless (>= (read n1) (read n2)) +(unless (>= (read n0) (read n2)) (format format-expression expr (replace-regexp-in-string "n" "\n" fmt) - n1 + n0 n2 s1))
[elpa] master 97c2270 8/9: Fix byte-compiler warning
branch: master commit 97c2270f7138530de21f773f094c1495498cac78 Author: Oleh Krehel Commit: Oleh Krehel Fix byte-compiler warning --- hydra-test.el |2 +- hydra.el |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hydra-test.el b/hydra-test.el index 3fcd403..a40a0ca 100644 --- a/hydra-test.el +++ b/hydra-test.el @@ -1310,7 +1310,7 @@ _w_ Worf: % -8`hydra-tng/worf^^ _h_ Set phasers to (goto-char (point-max)) (search-backward "|") (delete-char 1) - (setq current-prefix-arg) + (setq current-prefix-arg nil) ,@body (insert "|") (when (region-active-p) diff --git a/hydra.el b/hydra.el index d4160bf..a7a71ac 100644 --- a/hydra.el +++ b/hydra.el @@ -5,7 +5,7 @@ ;; Author: Oleh Krehel ;; Maintainer: Oleh Krehel ;; URL: https://github.com/abo-abo/hydra -;; Version: 0.13.3 +;; Version: 0.13.4 ;; Keywords: bindings ;; Package-Requires: ((cl-lib "0.5"))
[elpa] master 9b83857 7/9: Merge commit '366689f15373ffacfe4d28b36e6325d193a4e752' from tiny
branch: master commit 9b838575be93d8bd2c1d0842b4692dae6090e0b0 Merge: 8574898 366689f Author: Oleh Krehel Commit: Oleh Krehel Merge commit '366689f15373ffacfe4d28b36e6325d193a4e752' from tiny --- packages/tiny/Makefile | 15 +-- packages/tiny/tiny-test.el |2 ++ packages/tiny/tiny.el | 33 +++-- 3 files changed, 30 insertions(+), 20 deletions(-) diff --git a/packages/tiny/Makefile b/packages/tiny/Makefile index 6332238..708ea1a 100644 --- a/packages/tiny/Makefile +++ b/packages/tiny/Makefile @@ -1,18 +1,13 @@ -EMACS ?= emacs -CASK_EXEC ?= cask exec - +emacs ?= emacs all: test -test: clean-elc - ${MAKE} unit - -unit: - ${CASK_EXEC} ${EMACS} -Q -batch -l tiny-test.el -l tiny.el --eval "(ert t)" +test: clean + cask exec emacs -Q -batch -l tiny-test.el -l tiny.el -f ert-run-tests-batch-and-exit compile: - ${CASK_EXEC} ${EMACS} -Q -batch -f batch-byte-compile tiny.el + $(emacs) -Q -batch -f batch-byte-compile tiny.el -clean-elc: +clean: rm -f f.elc .PHONY:all test diff --git a/packages/tiny/tiny-test.el b/packages/tiny/tiny-test.el index dc9c3b9..3d9ec54 100644 --- a/packages/tiny/tiny-test.el +++ b/packages/tiny/tiny-test.el @@ -74,6 +74,8 @@ with point at the end of TXT." (ert-deftest tiny-mapconcat () (should (equal (with-text-value "m10" (lambda()(eval (read (tiny-mapconcat) "0 1 2 3 4 5 6 7 8 9 10")) + (should (equal (with-text-value "mm10" (lambda()(eval (read (tiny-mapconcat) + "012345678910")) (should (equal (with-text-value "m5 10" (lambda()(eval (read (tiny-mapconcat) "5 6 7 8 9 10")) (should (equal (with-text-value "m5 10*xx" (lambda()(eval (read (tiny-mapconcat) diff --git a/packages/tiny/tiny.el b/packages/tiny/tiny.el index 78d44bb..90c89d5 100644 --- a/packages/tiny/tiny.el +++ b/packages/tiny/tiny.el @@ -4,7 +4,7 @@ ;; Author: Oleh Krehel ;; URL: https://github.com/abo-abo/tiny -;; Version: 0.1 +;; Version: 0.1.1 ;; Keywords: convenience ;; This file is part of GNU Emacs. @@ -122,6 +122,11 @@ At the moment, only `tiny-mapconcat' is supported. "Setup shortcuts." (global-set-key (kbd "C-;") 'tiny-expand)) +(defalias 'tiny--preceding-sexp +(if (fboundp 'elisp--preceding-sexp) +'elisp--preceding-sexp + 'preceding-sexp)) + ;;;###autoload (defun tiny-replace-this-sexp () "Eval and replace the current sexp. @@ -137,9 +142,9 @@ On error go up list and try again." (catch 'success (while t (ignore-errors - (unless (looking-back ")") + (unless (looking-back ")" (line-beginning-position)) (error "Bad location")) - (let ((sexp (preceding-sexp))) + (let ((sexp (tiny--preceding-sexp))) (if (eq (car sexp) 'lambda) (error "Lambda evaluates to itself") (let ((value (eval sexp))) @@ -169,8 +174,14 @@ Must throw an error when can't go up further." Defaults are used in place of null values." (let ((parsed (tiny-mapconcat-parse))) (when parsed - (let* ((n1 (or (nth 0 parsed) "0")) - (s1 (or (nth 1 parsed) " ")) + (let* ((n0 (or (nth 0 parsed) "0")) + (n1 (nth 1 parsed)) + (s1 (cond ((null n1) +" ") + ((equal n1 "m") +"") + (t +n1))) (n2 (nth 2 parsed)) (expr (or (nth 3 parsed) "x")) (lexpr (read expr)) @@ -193,12 +204,12 @@ Defaults are used in place of null values." (cdr tes) " ") ")))(number-sequence %s %s) \"%s\")"))) -(unless (>= (read n1) (read n2)) +(unless (>= (read n0) (read n2)) (format format-expression expr (replace-regexp-in-string "n" "\n" fmt) - n1 + n0 n2 s1)) @@ -266,7 +277,8 @@ Return nil if nothing was matched, otherwise (when (catch 'done (cond ;; either start with a number - ((looking-back "\\bm\\(-?[0-9]+\\)\\([^\n]*?\\)") + ((looking-back "\\bm\\(-?[0-9]+\\)\\([^\n]*?\\)" + (line-beginning-position)) (setq n1 (match-string-no-properties 1) str (match-string-no-properties 2) tiny-beg (match-beginning 0) @@ -276,7 +288,8 @@ Return nil if nothing was matched, otherwise n1 nil) (throw 'done t))) ;; else capture the whole thing - ((looking-back "\\bm\\([^%|\n]*[0-9][^\n]*\\)") + ((looking-back "\\bm\\([^%|\n]*[0-9][^\n]*\\)" + (line-beginning-position)) (setq str
[elpa] master 1714220 022/167: swiper.el (swiper-font-lock-ensure): Exclude help-mode
branch: master commit 171422065d7bdfb67076d4fb41b716cac310b86b Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper-font-lock-ensure): Exclude help-mode Fixes #248 --- swiper.el |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/swiper.el b/swiper.el index bd7dc18..3a31d81 100644 --- a/swiper.el +++ b/swiper.el @@ -203,7 +203,8 @@ Man-mode woman-mode mu4e-view-mode - mu4e-headers-mode))) + mu4e-headers-mode + help-mode))) (unless (> (buffer-size) 10) (if (fboundp 'font-lock-ensure) (font-lock-ensure)
[elpa] master dfb41d0 016/167: Implement ivy-avy
branch: master commit dfb41d0ddeef32f247e658672b4cbf82834b7f0f Author: PythonNut Commit: Oleh Krehel Implement ivy-avy --- ivy.el | 24 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/ivy.el b/ivy.el index 8839ba6..b983db0 100644 --- a/ivy.el +++ b/ivy.el @@ -152,6 +152,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse order." (define-key map (kbd "C-k") 'ivy-kill-line) (define-key map (kbd "S-SPC") 'ivy-restrict-to-matches) (define-key map (kbd "M-w") 'ivy-kill-ring-save) +(define-key map (kbd "C-'") 'ivy-avy) map) "Keymap used in the minibuffer.") (autoload 'hydra-ivy/body "ivy-hydra" "" t) @@ -744,6 +745,29 @@ On error (read-only), call `ivy-on-del-error-function'." (setq ivy--old-re nil) (cl-rotatef ivy--regex-function ivy--regexp-quote)) +(defun ivy-avy () + "Jump to one of the current ivy candidates." + (interactive) + (let* ((avy-all-windows nil) + (avy-background t) + (candidate (let ((candidates)) + (save-excursion +(save-restriction + (narrow-to-region (window-start) (window-end)) + (goto-char (point-min)) + (forward-line) + (while (< (point) (point-max)) +(push (cons (point) (selected-window)) + candidates) +(forward-line + (setq avy-action #'identity) + (avy--process (nreverse candidates) +(avy--style-fn 'at-full) +(ivy-set-index (- (line-number-at-pos candidate) 2)) +(ivy--exhibit) +(ivy-done) +(ivy-call))) + (defun ivy-sort-file-function-default (x y) "Compare two files X and Y. Prioritize directories."
[elpa] master b9d0502 026/167: ivy.el (ivy--filter): Fix typo
branch: master commit b9d0502bffa62111668cd32beb167d699c96ff7f Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy--filter): Fix typo Re #253 --- ivy.el |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ivy.el b/ivy.el index 6fbb84c..7320a11 100644 --- a/ivy.el +++ b/ivy.el @@ -1547,8 +1547,8 @@ CANDIDATES are assumed to be static." (if (cdr re) #'cl-remove-if-not #'cl-remove-if) -(let ((re (car re))) - (lambda (x) (string-match re x))) +(let ((re-str (car re))) + (lambda (x) (string-match re-str x))) res res (tail (nthcdr ivy--index ivy--old-cands)) @@ -1571,7 +1571,7 @@ CANDIDATES are assumed to be static." ;; Compare with eq to handle equal duplicates in cands (setq idx (cl-position (pop tail) cands))) (setq ivy--index (or idx 0 - (setq ivy-index 0)) + (setq ivy--index 0)) (when (and (string= name "") (not (equal ivy--old-re ""))) (setq ivy--index (or (cl-position (ivy-state-preselect ivy-last)
[elpa] master 6e3c692 029/167: Fix ivy-state-preselect for file name completion
branch: master commit 6e3c6925d3b5bd2f7b22adb0f2d3cfd668cc801b Author: Oleh Krehel Commit: Oleh Krehel Fix ivy-state-preselect for file name completion * ivy.el (ivy--preselect-index): Add a check for null preselect. (ivy--filter): Use `ivy--preselect-index' instead of `cl-position'. The reason is that the collection contains e.g "foo/" while the preselect is "foo". --- ivy.el | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ivy.el b/ivy.el index 64eff1e..59a02bd 100644 --- a/ivy.el +++ b/ivy.el @@ -1162,10 +1162,12 @@ When MATCHER is non-nil it's used instead of `cl-remove-if-not'." (when matcher (setq candidates (funcall matcher "" candidates (or (cl-position preselect candidates :test #'equal) - (cl-position-if - (lambda (x) - (string-match (regexp-quote preselect) x)) - candidates))) + (and (stringp preselect) + (let ((re (regexp-quote preselect))) + (cl-position-if + (lambda (x) +(string-match re x)) + candidates) ;;* Implementation ;;** Regex @@ -1577,8 +1579,11 @@ CANDIDATES are assumed to be static." (setq ivy--index 0)) (when (and (string= name "") (not (equal ivy--old-re ""))) (setq ivy--index -(or (cl-position (ivy-state-preselect ivy-last) - cands :test #'equal) +(or (ivy--preselect-index + cands + nil + (ivy-state-preselect ivy-last) + nil) ivy--index))) (setq ivy--old-re (if cands re-str "")) (when (and (require 'flx nil 'noerror)
[elpa] master 4045349 032/167: ivy.el (ivy-use-virtual-buffers): Update docstring
branch: master commit 4045349fc73c9e0c7d3e2a42340073eb04dc8b9d Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-use-virtual-buffers): Update docstring --- ivy.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 66e1e9b..04dd2dc 100644 --- a/ivy.el +++ b/ivy.el @@ -111,7 +111,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse order." :type 'list) (defcustom ivy-use-virtual-buffers nil - "When non-nil, add `recentf-mode' and bookmarks to the list of buffers." + "When non-nil, add `recentf-mode' and bookmarks to `ivy-switch-buffer'." :type 'boolean) (defvar ivy--actions-list nil
[elpa] master 126158d 025/167: ivy.el (ivy--filter): Anchor only for swiper
branch: master commit 126158d5e5f9eff0a23aa07b1adebdbdd5465770 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy--filter): Anchor only for swiper * ivy-test.el (ivy-read): Add tests. Except for `swiper', when the input changes `ivy-index' should usually be 0. Fixes #231 --- ivy-test.el | 11 ++- ivy.el | 36 +++- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/ivy-test.el b/ivy-test.el index 76f2dde..384cd4d 100644 --- a/ivy-test.el +++ b/ivy-test.el @@ -59,7 +59,16 @@ (should (equal (ivy-with '(ivy-read "pattern: " '("blue" "yellow")) "z C-m") - "z"))) + "z")) + (should (equal + (ivy-with '(ivy-read "pattern: " '("blue" "yellow")) + "y C-m") + "blue")) + (should (equal + (ivy-with '(let ((ivy-re-builders-alist '((t . ivy--regex-fuzzy + (ivy-read "pattern: " '("package-list-packages" "something-else"))) + "plp C-m") + "package-list-packages"))) (ert-deftest swiper--re-builder () (setq swiper--width 4) diff --git a/ivy.el b/ivy.el index 73ebbfa..6fbb84c 100644 --- a/ivy.el +++ b/ivy.el @@ -1553,23 +1553,25 @@ CANDIDATES are assumed to be static." res (tail (nthcdr ivy--index ivy--old-cands)) idx) -(when (and tail ivy--old-cands (not (equal "^" ivy--old-re))) - (unless (and (not (equal re-str ivy--old-re)) - (or (setq ivy--index - (or - (cl-position (if (and (> (length re-str) 0) -(eq ?^ (aref re-str 0))) - (substring re-str 1) - re-str) cands - :test #'equal) - (and ivy--directory - (cl-position -(concat re-str "/") cands -:test #'equal)) -(while (and tail (null idx)) - ;; Compare with eq to handle equal duplicates in cands - (setq idx (cl-position (pop tail) cands))) -(setq ivy--index (or idx 0 +(if (eq (ivy-state-unwind ivy-last) 'swiper--cleanup) +(when (and tail ivy--old-cands (not (equal "^" ivy--old-re))) + (unless (and (not (equal re-str ivy--old-re)) + (or (setq ivy--index + (or + (cl-position (if (and (> (length re-str) 0) +(eq ?^ (aref re-str 0))) + (substring re-str 1) + re-str) cands + :test #'equal) + (and ivy--directory + (cl-position +(concat re-str "/") cands +:test #'equal)) +(while (and tail (null idx)) + ;; Compare with eq to handle equal duplicates in cands + (setq idx (cl-position (pop tail) cands))) +(setq ivy--index (or idx 0 + (setq ivy-index 0)) (when (and (string= name "") (not (equal ivy--old-re ""))) (setq ivy--index (or (cl-position (ivy-state-preselect ivy-last)
[elpa] master f9df75e 037/167: ivy.el (ivy-index-functions-alist): New variable
branch: master commit f9df75e708149dd843e3ccc1f52ce3cd1d1ffa90 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-index-functions-alist): New variable * ivy.el (ivy-state): Add `caller' field. (ivy-read): Add `caller' keyword arg; update docstring. Use `ivy--recompute-index'. (ivy--recompute-index): New defun, dispatch according to `caller' and `ivy-index-functions-alist'. (ivy-recompute-index-swiper): New defun. (ivy-recompute-index-zero): New defun. Fixes #253 --- counsel.el |3 +- ivy.el | 108 +-- swiper.el |6 ++- 3 files changed, 74 insertions(+), 43 deletions(-) diff --git a/counsel.el b/counsel.el index ce23179..800e907 100644 --- a/counsel.el +++ b/counsel.el @@ -425,7 +425,8 @@ INITIAL-INPUT can be given as the initial minibuffer input." :keymap counsel-git-grep-map :action #'counsel-git-grep-action :unwind #'swiper--cleanup - :history 'counsel-git-grep-history))) + :history 'counsel-git-grep-history + :caller 'counsel-git-grep))) (defcustom counsel-find-file-at-point nil "When non-nil, add file-at-point to the list of candidates." diff --git a/ivy.el b/ivy.el index a841a4b..232f228 100644 --- a/ivy.el +++ b/ivy.el @@ -184,7 +184,8 @@ Only \"./\" and \"../\" apply here. They appear in reverse order." re-builder matcher ;; When this is non-nil, call it for each input change to get new candidates - dynamic-collection) + dynamic-collection + caller) (defvar ivy-last nil "The last parameters passed to `ivy-read'. @@ -846,6 +847,16 @@ buffer order, like `org-refile' or `Man-goto-section'. The entry associated to t is used for all fall-through cases.") +(defvar ivy-index-functions-alist + '((swiper . ivy-recompute-index-swiper) +(swiper-multi . ivy-recompute-index-swiper) +(counsel-git-grep . ivy-recompute-index-swiper) +(t . ivy-recompute-index-zero)) + "An alist of index recomputing functions for each collection function. +When the input changes, calling the appropriate function will +return an integer - the index of the matched candidate that +should be selected.") + (defvar ivy-re-builders-alist '((t . ivy--regex-plus)) "An alist of regex building functions for each collection function. @@ -902,7 +913,7 @@ Directories come first." (cl-defun ivy-read (prompt collection &key predicate require-match initial-input history preselect keymap update-fn sort - action unwind re-builder matcher dynamic-collection) + action unwind re-builder matcher dynamic-collection caller) "Read a string in the minibuffer, with completion. PROMPT is a string to prompt with; normally it ends in a colon @@ -911,7 +922,8 @@ 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. +COLLECTION is a list of strings, or a function, or an alist, or a +hash table. If INITIAL-INPUT is non-nil, insert it in the minibuffer initially. @@ -934,7 +946,11 @@ RE-BUILDER is a lambda that transforms text into a regex. MATCHER can completely override matching. DYNAMIC-COLLECTION is a function to call to update the list of -candidates with each input." +candidates with each input. + +CALLER is a symbol to uniquely identify the caller to `ivy-read'. +It's used in conjunction with COLLECTION to indentify which +customizations should apply to the current completion session." (let ((extra-actions (plist-get ivy--actions-list this-command))) (when extra-actions (setq action @@ -960,7 +976,8 @@ candidates with each input." :unwind unwind :re-builder re-builder :matcher matcher - :dynamic-collection dynamic-collection)) + :dynamic-collection dynamic-collection + :caller caller)) (ivy--reset-state ivy-last) (prog1 (unwind-protect @@ -970,9 +987,9 @@ candidates with each input." (minibuffer-completion-table collection) (minibuffer-completion-predicate predicate) (resize-mini-windows (cond - ((display-graphic-p) nil) - ((null resize-mini-windows) 'grow-only) - (t resize-mini-windows))) + ((display-graphic-p) nil) + ((null resize-mini-windows) 'grow-only) + (t resize-mini-windows))) (res (read-from-minibuffer prompt (ivy-state-initial-input ivy-last) @@ -1582,44 +1599,55 @@ CANDIDATES are assumed to be static."
[elpa] master 21b9edf 021/167: Fix up visual-line-mode limitation logic
branch: master commit 21b9edf64a3e2c0bde14e3dc31b2dd1669904009 Author: Oleh Krehel Commit: Oleh Krehel Fix up visual-line-mode limitation logic * swiper.el (swiper-use-visual-line): New defvar. (swiper--candidates): (swiper--update-input-ivy): (swiper--action): Update. Re #227 --- swiper.el | 16 +++- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/swiper.el b/swiper.el index 0f8ff31..bd7dc18 100644 --- a/swiper.el +++ b/swiper.el @@ -215,16 +215,22 @@ (defvar swiper--width nil "Store the amount of digits needed for the longest line nubmer.") +(defvar swiper-use-visual-line nil + "When non-nil, use `line-move' instead of `forward-line'.") + (defun swiper--candidates () "Return a list of this buffer lines." + (setq swiper-use-visual-line +(and (not (eq major-mode 'org-mode)) + visual-line-mode + (< (buffer-size) 2))) (let ((n-lines (count-lines (point-min) (point-max (unless (zerop n-lines) (setq swiper--width (1+ (floor (log n-lines 10 (setq swiper--format-spec (format "%%-%dd " swiper--width)) (let ((line-number 0) -(advancer (if (and visual-line-mode - (< (buffer-size) 2)) +(advancer (if swiper-use-visual-line (lambda (arg) (line-move arg t)) #'forward-line)) candidates) @@ -234,7 +240,7 @@ (while (< (point) (point-max)) (let ((str (concat " " (buffer-substring (point) -(if visual-line-mode +(if swiper-use-visual-line (save-excursion (end-of-visual-line) (point)) @@ -354,7 +360,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (goto-char (point-min)) (when (cl-plusp num) (goto-char (point-min)) - (if visual-line-mode + (if swiper-use-visual-line (line-move (1- num)) (forward-line (1- num))) (if (and (equal ivy-text "") @@ -423,7 +429,7 @@ BEG and END, when specified, are the point bounds." (if (null x) (user-error "No candidates") (goto-char (point-min)) -(funcall (if visual-line-mode +(funcall (if swiper-use-visual-line #'line-move #'forward-line) (1- (read (get-text-property 0 'display x
[elpa] master c89c167 007/167: Specify shell command for counsel-git-grep with prefix arg
branch: master commit c89c167bffa5d2774e06feb9d5fd9c99bf731ad4 Author: Oleh Krehel Commit: Oleh Krehel Specify shell command for counsel-git-grep with prefix arg * counsel.el (counsel-git-grep-cmd): New defvar. (counsel-git-grep-function): Use `counsel-git-grep-cmd'. (counsel-git-grep-cmd-history): New defvar. (counsel-git-grep): Update signature. When called with a prefix arg, prompt for a command reading from and recording to `counsel-git-grep-cmd-history'. Remember to use "M-i" to insert the current candidate into the minibuffer. Fixes #244 --- counsel.el | 26 +++--- 1 files changed, 23 insertions(+), 3 deletions(-) diff --git a/counsel.el b/counsel.el index 129a8ce..158c491 100644 --- a/counsel.el +++ b/counsel.el @@ -348,13 +348,16 @@ (list "" (format "%d chars more" (- n (length ivy-text) +(defvar counsel-git-grep-cmd "git --no-pager grep --full-name -n --no-color -i -e %S" + "Store the command for `counsel-git-grep'.") + (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)) (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" + (cmd (format counsel-git-grep-cmd (setq ivy--old-re (ivy--regex string t) (if (<= counsel--git-grep-count 2) (split-string (shell-command-to-string cmd) "\n" t) @@ -388,11 +391,28 @@ (defvar counsel-git-grep-history nil "History for `counsel-git-grep'.") +(defvar counsel-git-grep-cmd-history + '("git --no-pager grep --full-name -n --no-color -i -e %S") + "History for `counsel-git-grep' shell commands.") + ;;;###autoload -(defun counsel-git-grep (&optional initial-input) +(defun counsel-git-grep (&optional cmd initial-input) "Grep for a string in the current git repository. +When CMD is a string, use it as a \"git grep\" command. +When CMD is non-nil, prompt for a specific \"git grep\" command. INITIAL-INPUT can be given as the initial minibuffer input." - (interactive) + (interactive "P") + (cond +((stringp cmd) + (setq counsel-git-grep-cmd cmd)) +(cmd + (setq counsel-git-grep-cmd + (ivy-read "cmd: " counsel-git-grep-cmd-history + :history 'counsel-git-grep-cmd-history)) + (setq counsel-git-grep-cmd-history + (delete-dups counsel-git-grep-cmd-history))) +(t + (setq counsel-git-grep-cmd "git --no-pager grep --full-name -n --no-color -i -e %S"))) (setq counsel--git-grep-dir (locate-dominating-file default-directory ".git")) (if (null counsel--git-grep-dir)
[elpa] master 47a220d 023/167: Support hash tables in ivy-read
branch: master commit 47a220d521b9fb916f0d51da2df229a9ff7870b7 Author: Oleh Krehel Commit: Oleh Krehel Support hash tables in ivy-read * ivy.el (ivy--reset-state): `all-completions' also works fine for hash tables, so start using it. Hash tables as collections are rare. One example is "C-c C-w" in *rcirc* (`rcirc-cmd-whois'). --- ivy.el |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ivy.el b/ivy.el index 6c3c789..7885a9c 100644 --- a/ivy.el +++ b/ivy.el @@ -1026,10 +1026,9 @@ This is useful for recursive `ivy-read'." ((or (functionp collection) (byte-code-function-p collection) (vectorp collection) - (listp (car collection))) + (and (consp collection) (listp (car collection))) + (hash-table-p collection)) (setq coll (all-completions "" collection predicate))) -((hash-table-p collection) - (error "Hash table as a collection unsupported")) (t (setq coll collection))) (when sort
[elpa] master 6f4d46b 034/167: Fix preselect for input "^"
branch: master commit 6f4d46b76a96082ebc1cfc4f2b4a73bf8c0aca82 Author: Oleh Krehel Commit: Oleh Krehel Fix preselect for input "^" * ivy.el (ivy--filter): Update. Notably, e.g. `counsel-describe-variable' should properly preselect variable at point. --- ivy.el |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index ba7027b..e06c3dd 100644 --- a/ivy.el +++ b/ivy.el @@ -1588,7 +1588,9 @@ CANDIDATES are assumed to be static." (setq idx (cl-position (pop tail) cands))) (setq ivy--index (or idx 0 (setq ivy--index 0)) -(when (and (string= name "") (not (equal ivy--old-re ""))) +(when (and (or (string= name "") + (string= name "^")) + (not (equal ivy--old-re ""))) (setq ivy--index (or (ivy--preselect-index cands
[elpa] master 19d2a40 004/167: Add flx sorting
branch: master commit 19d2a407cb7fd8688b426106f063b971fd91e6a8 Author: Oleh Krehel Commit: Oleh Krehel Add flx sorting * ivy.el (ivy--flx-cache): New defvar. (ivy--filter): Since flx is costly, move the caching to an earlier point. This means immediate return for when the input hasn't changed, i.e. for "C-n" or "C-p". When flx is installed, and (eq ivy--regex-function 'ivy--regex-fuzzy) for current function (through `ivy-re-builders-alist'), then sort the final candidates with `ivy--flx-sort'. (ivy--flx-sort): New defun. In the worst case when some error pops up return the same list. In the best case sort the `cands' that all match `name' by closeness to `name'. How to use: 1. Have flx installed - (require 'flx) should succeed. 2. Configure `ivy-re-builders-alist' appropriately to use `ivy--regex-fuzzy', for example: (setq ivy-re-builders-alist '((t . ivy--regex-fuzzy))) Fixes #207 --- ivy.el | 168 +++- 1 files changed, 103 insertions(+), 65 deletions(-) diff --git a/ivy.el b/ivy.el index 9b3e698..0dab956 100644 --- a/ivy.el +++ b/ivy.el @@ -1445,74 +1445,112 @@ all of the text contained in the minibuffer." (font-lock-append-text-property 0 (length str) 'face face str str) +(declare-function flx-make-string-cache "ext:flx") +(declare-function flx-score "ext:flx") + +(defvar ivy--flx-cache nil) + +(eval-after-load 'flx + '(setq ivy--flx-cache (flx-make-string-cache))) + (defun ivy--filter (name candidates) "Return all items that match NAME in CANDIDATES. CANDIDATES are assumed to be static." - (let* ((re (funcall ivy--regex-function name)) - (re-str (if (listp re) (caar re) re)) - (matcher (ivy-state-matcher ivy-last)) - (case-fold-search (string= name (downcase name))) - (cands (cond - (matcher - (funcall matcher re candidates)) - ((and (equal re ivy--old-re) -ivy--old-cands) - ivy--old-cands) - ((and ivy--old-re -(stringp re) -(stringp ivy--old-re) -(not (string-match "" ivy--old-re)) -(not (equal ivy--old-re "")) -(memq (cl-search - (if (string-match ")\\'" ivy--old-re) - (substring ivy--old-re 0 -2) - ivy--old-re) - re) - '(0 2))) - (ignore-errors - (cl-remove-if-not - (lambda (x) (string-match re x)) - ivy--old-cands))) - (t - (let ((re-list (if (stringp re) (list (cons re t)) re)) - (res candidates)) - (dolist (re re-list) - (setq res - (ignore-errors - (funcall -(if (cdr re) -#'cl-remove-if-not - #'cl-remove-if) -(let ((re (car re))) - (lambda (x) (string-match re x))) -res - res - (tail (nthcdr ivy--index ivy--old-cands)) - idx) -(when (and tail ivy--old-cands (not (equal "^" ivy--old-re))) - (unless (and (not (equal re-str ivy--old-re)) - (or (setq ivy--index - (or - (cl-position (if (and (> (length re-str) 0) -(eq ?^ (aref re-str 0))) - (substring re-str 1) - re-str) cands - :test #'equal) - (and ivy--directory - (cl-position -(concat re-str "/") cands -:test #'equal)) -(while (and tail (null idx)) - ;; Compare with eq to handle equal duplicates in cands - (setq idx (cl-position (pop tail) cands))) -(setq ivy--index (or idx 0 -(when (and (string= name "") (not (equal ivy--old-re ""))) - (setq ivy--index -(or (cl-position (ivy-state-preselect ivy-last) - cands :test #'equal) -ivy--index))) -(setq ivy--old-re (if cands re-str "")) -(setq ivy--old-cands cands))) + (let ((re (funcall ivy--regex-function name))) +(if (and (equal re ivy--old-re) + ivy--old-cands) +;; quick caching for "C-n
[elpa] master eda091b 017/167: Customize ivy-avy and fix compile warnings
branch: master commit eda091bf5d0c501116585d73d35b2e3ec2652fcd Author: Oleh Krehel Commit: Oleh Krehel Customize ivy-avy and fix compile warnings * ivy.el (ivy-avy): Require avy. Allow the user to customize `avy-keys', `avy-background' and `avy-style' (but prefer 'pre to 'at-full, since it doesn't obscure any letters). Don't issue an extra `ivy-call'. Fixes #246 --- ivy.el | 55 +++ 1 files changed, 39 insertions(+), 16 deletions(-) diff --git a/ivy.el b/ivy.el index b983db0..6c3c789 100644 --- a/ivy.el +++ b/ivy.el @@ -745,28 +745,51 @@ On error (read-only), call `ivy-on-del-error-function'." (setq ivy--old-re nil) (cl-rotatef ivy--regex-function ivy--regexp-quote)) +(defvar avy-all-windows) +(defvar avy-action) +(defvar avy-keys) +(defvar avy-keys-alist) +(defvar avy-style) +(defvar avy-styles-alist) +(declare-function avy--process "ext:avy") +(declare-function avy--style-fn "ext:avy") + +(eval-after-load 'avy + '(add-to-list 'avy-styles-alist '(ivy-avy . pre))) + (defun ivy-avy () "Jump to one of the current ivy candidates." (interactive) + (unless (require 'avy nil 'noerror) +(error "Package avy isn't installed")) (let* ((avy-all-windows nil) - (avy-background t) - (candidate (let ((candidates)) - (save-excursion -(save-restriction - (narrow-to-region (window-start) (window-end)) - (goto-char (point-min)) - (forward-line) - (while (< (point) (point-max)) -(push (cons (point) (selected-window)) - candidates) -(forward-line - (setq avy-action #'identity) - (avy--process (nreverse candidates) -(avy--style-fn 'at-full) + (avy-keys (or (cdr (assq 'ivy-avy avy-keys-alist)) + avy-keys)) + (avy-style (or (cdr (assq 'ivy-avy + avy-styles-alist)) +avy-style)) + (candidate + (let ((candidates)) +(save-excursion + (save-restriction +(narrow-to-region + (window-start) + (window-end)) +(goto-char (point-min)) +(forward-line) +(while (< (point) (point-max)) + (push + (cons (point) + (selected-window)) + candidates) + (forward-line +(setq avy-action #'identity) +(avy--process + (nreverse candidates) + (avy--style-fn avy-style) (ivy-set-index (- (line-number-at-pos candidate) 2)) (ivy--exhibit) -(ivy-done) -(ivy-call))) +(ivy-done))) (defun ivy-sort-file-function-default (x y) "Compare two files X and Y.
[elpa] master f04aec8 009/167: ivy-hydra.el: Bind "t" to toggle-truncate-lines
branch: master commit f04aec86cd60918d64caa6e5fd244fb12790662f Author: Oleh Krehel Commit: Oleh Krehel ivy-hydra.el: Bind "t" to toggle-truncate-lines * ivy.el (ivy-format-function-default): When `truncate-lines' is non-nil don't truncate with "...". Use "C-o t" when you complete very long lines and want to see them whole. Fixes #214 --- ivy-hydra.el |9 + ivy.el | 10 ++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ivy-hydra.el b/ivy-hydra.el index 6ab1f9a..152812b 100644 --- a/ivy-hydra.el +++ b/ivy-hydra.el @@ -47,11 +47,11 @@ (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) +^ ^ _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_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow window +^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate: %`truncate-lines " ;; arrows ("h" ivy-beginning-of-buffer) @@ -73,7 +73,8 @@ _h_ ^+^ _l_ _d_one_o_ops _m_: matcher %s(if (eq ivy--regex-function 'i (">" ivy-minibuffer-grow) ("<" ivy-minibuffer-shrink) ("w" ivy-prev-action) - ("s" ivy-next-action)) + ("s" ivy-next-action) + ("t" (setq truncate-lines (not truncate-lines (provide 'ivy-hydra) diff --git a/ivy.el b/ivy.el index 25ea6c6..bf3981a 100644 --- a/ivy.el +++ b/ivy.el @@ -1568,10 +1568,12 @@ This string will be inserted into the minibuffer.") (let ((ww (- (window-width) (if (and (boundp 'fringe-mode) (eq fringe-mode 0)) 1 0 (mapconcat - (lambda (s) - (if (> (length s) ww) - (concat (substring s 0 (- ww 3)) "...") - s)) + (if truncate-lines + (lambda (s) + (if (> (length s) ww) + (concat (substring s 0 (- ww 3)) "...") + s)) + #'identity) cands "\n" (defun ivy-format-function-arrow (cands)
[elpa] master 52c9565 020/167: swiper.el (swiper--candidates): Avoid line-move for large buffers
branch: master commit 52c95656d4fbab47952e92f64c032a46fa52c0e7 Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper--candidates): Avoid line-move for large buffers Re #227 --- swiper.el |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/swiper.el b/swiper.el index 09c266e..0f8ff31 100644 --- a/swiper.el +++ b/swiper.el @@ -223,7 +223,8 @@ (setq swiper--format-spec (format "%%-%dd " swiper--width)) (let ((line-number 0) -(advancer (if visual-line-mode +(advancer (if (and visual-line-mode + (< (buffer-size) 2)) (lambda (arg) (line-move arg t)) #'forward-line)) candidates)
[elpa] master fa49a81 018/167: Fix "End of buffer" for swiper and visual-line-mode
branch: master commit fa49a81f6e6ed1e8e7573f95c68853298213bd68 Author: Oleh Krehel Commit: Oleh Krehel Fix "End of buffer" for swiper and visual-line-mode Fixes #247 --- swiper.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/swiper.el b/swiper.el index 9e70265..19d0a59 100644 --- a/swiper.el +++ b/swiper.el @@ -196,7 +196,7 @@ (format "%%-%dd " swiper--width)) (let ((line-number 0) (advancer (if visual-line-mode - #'line-move + (lambda (arg) (line-move arg t)) #'forward-line)) candidates) (save-excursion
[elpa] master ff077c6 013/167: counsel.el (counsel--gg-candidates): Use counsel-git-grep-cmd
branch: master commit ff077c66e09891bd071b1ca342f39054b33d7f1c Author: Oleh Krehel Commit: Oleh Krehel counsel.el (counsel--gg-candidates): Use counsel-git-grep-cmd --- counsel.el |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/counsel.el b/counsel.el index 432d141..87d0eb7 100644 --- a/counsel.el +++ b/counsel.el @@ -689,8 +689,9 @@ The libraries are offered from `load-path'." (setq proc (start-process-shell-command counsel-gg-process counsel-gg-process -(format "git --no-pager grep --full-name -n --no-color -i -e %S | head -n 200" -regex))) +(concat + (format counsel-git-grep-cmd regex) + " | head -n 200"))) (set-process-sentinel proc #'counsel--gg-sentinel)))
[elpa] master b06daca 040/167: ivy.el (ivy-virtual-abbreviate): New defcustom
branch: master commit b06daca74bd7b09116b9d4f3bd9a93b2c11a5272 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-virtual-abbreviate): New defcustom * ivy.el (ivy--virtual-buffers): Update. Fixes #255 --- ivy.el | 13 - 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 7228acb..02b6c73 100644 --- a/ivy.el +++ b/ivy.el @@ -1786,6 +1786,14 @@ CANDS is a list of strings." (defface ivy-virtual '((t :inherit font-lock-builtin-face)) "Face used by Ivy for matching virtual buffer names.") +(defcustom ivy-virtual-abbreviate 'name + "The mode of abbreviation for virtual buffer names." + :type '(choice + (const :tag "Only name" 'name) + (const :tag "Full path" 'full) + ;; eventually, uniquify + )) + (defun ivy--virtual-buffers () "Adapted from `ido-add-virtual-buffers-to-list'." (unless recentf-mode @@ -1799,7 +1807,10 @@ CANDS is a list of strings." (delq nil (mapcar (lambda (bookmark) (cdr (assoc 'filename bookmark))) bookmarks) - (setq name (file-name-nondirectory head)) + (setq name +(if (eq ivy-virtual-abbreviate 'name) +(file-name-nondirectory head) + (expand-file-name head))) (when (equal name "") (setq name (file-name-nondirectory (directory-file-name head (when (equal name "")
[elpa] master e5105ef 054/167: Don't re-anchor to matching old candidate if flx is on
branch: master commit e5105efd187edb4a9c8c5e63c07be073d831db82 Author: Oleh Krehel Commit: Oleh Krehel Don't re-anchor to matching old candidate if flx is on * ivy.el (ivy--recompute-index): If `flx' is in position to select the "best" candidate, don't re-anchor to the still-matching previous candidate. Fixes #263 --- ivy.el |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/ivy.el b/ivy.el index 7420afe..ead3742 100644 --- a/ivy.el +++ b/ivy.el @@ -1639,6 +1639,9 @@ CANDIDATES are assumed to be static." #'ivy-recompute-index-zero))) (setq ivy--index (or (and (not (string= name "")) + (not (and (require 'flx nil 'noerror) + (eq ivy--regex-function 'ivy--regex-fuzzy) + (< (length cands) 200))) (cl-position (nth ivy--index ivy--old-cands) cands)) (funcall func re-str cands)))
[elpa] master e70ca07 003/167: ivy.el (ivy-call): "C-M-n" should not leave the minibuffer
branch: master commit e70ca07a27720ab3a46d2185940df7a10bd2d622 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-call): "C-M-n" should not leave the minibuffer Make sure that the minibuffer window remains selected as long as the completion hasn't finished. For example, " f" to call `counsel-describe-function' input "forward" and spam "C-M-n" to read the doc for each function that starts with "forward". The *Help* window popup would move the window focus, but this change moves it back to the minibuffer. --- ivy.el |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 1bb3326..9b3e698 100644 --- a/ivy.el +++ b/ivy.el @@ -604,7 +604,11 @@ If the input is empty, select the previous history element instead." (if (equal ivy--current "") ivy-text ivy--current -(funcall action x) +(prog1 (funcall action x) + (unless (or (eq ivy-exit 'done) + (equal (selected-window) + (active-minibuffer-window))) +(select-window (active-minibuffer-window (defun ivy-next-line-and-call (&optional arg) "Move cursor vertically down ARG candidates.
[elpa] master 41b5850 005/167: ivy.el (ivy--regex-fuzzy): Add minibuffer highlighting
branch: master commit 41b58500e0c978a005b24b332e896d567f28795e Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy--regex-fuzzy): Add minibuffer highlighting * ivy-test.el (ivy--regex-fuzzy): Update test. Re #207 --- ivy-test.el |7 +++ ivy.el | 11 --- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ivy-test.el b/ivy-test.el index 10dd8f9..76f2dde 100644 --- a/ivy-test.el +++ b/ivy-test.el @@ -84,11 +84,11 @@ (ert-deftest ivy--regex-fuzzy () (should (string= (ivy--regex-fuzzy "tmux") - "t.*m.*u.*x")) + "\\(t\\).*\\(m\\).*\\(u\\).*\\(x\\)")) (should (string= (ivy--regex-fuzzy "^tmux") - "^t.*m.*u.*x")) + "^\\(t\\).*\\(m\\).*\\(u\\).*\\(x\\)")) (should (string= (ivy--regex-fuzzy "^tmux$") - "^t.*m.*u.*x$")) + "^\\(t\\).*\\(m\\).*\\(u\\).*\\(x\\)$")) (should (string= (ivy--regex-fuzzy "") "")) (should (string= (ivy--regex-fuzzy "^") @@ -121,4 +121,3 @@ '("the" "The"))) (should (equal (ivy--filter "The" '("foo" "the" "The")) '("The" - diff --git a/ivy.el b/ivy.el index 0dab956..5f7ed6f 100644 --- a/ivy.el +++ b/ivy.el @@ -1226,9 +1226,14 @@ Everything after \"!\" should not match." "Build a regex sequence from STR. Insert .* between each char." (if (string-match "\\`\\(\\^?\\)\\(.*?\\)\\(\\$?\\)\\'" str) - (concat (match-string 1 str) - (mapconcat #'string (string-to-list (match-string 2 str)) ".*") - (match-string 3 str)) + (prog1 + (concat (match-string 1 str) + (mapconcat + (lambda (x) + (format "\\(%c\\)" x)) + (string-to-list (match-string 2 str)) ".*") + (match-string 3 str)) +(setq ivy--subexps (length (match-string 2 str str)) ;;** Rest
[elpa] master 0630395 043/167: Fix the count when git-grep for "->foo"
branch: master commit 0630395232db84ad276457c97c11c29b45a98619 Author: Oleh Krehel Commit: Oleh Krehel Fix the count when git-grep for "->foo" * counsel.el: For some reason, "-" gets interpreted in a bad way. Escaping it as "\-" makes it work fine. --- counsel.el |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/counsel.el b/counsel.el index 800e907..da1e04c 100644 --- a/counsel.el +++ b/counsel.el @@ -718,7 +718,9 @@ The libraries are offered from `load-path'." When NO-ASYNC is non-nil, do it synchronously." (let ((default-directory counsel--git-grep-dir) (cmd (format "git grep -i -c '%s' | sed 's/.*:\\(.*\\)/\\1/g' | awk '{s+=$1} END {print s}'" - (replace-regexp-in-string "'" "''" regex))) + (replace-regexp-in-string + "-" "-" + (replace-regexp-in-string "'" "''" regex (counsel-ggc-process " *counsel-gg-count*")) (if no-async (string-to-number (shell-command-to-string cmd))
[elpa] master 85682ee 048/167: Fix "C-x h" selection and "C-b" bug
branch: master commit 85682ee152f151bda6d929ac8cb24f983ebc92e0 Author: Oleh Krehel Commit: Oleh Krehel Fix "C-x h" selection and "C-b" bug * ivy.el (ivy--exhibit): Add another `constrain-to-field'. This ensures that the point doesn't cross into the prompt text. Previously, there was a bug that pressing "C-b" once more when already at the start of the input set `ivy-text' to "", i.e. ignoring the minibuffer input. --- ivy.el |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/ivy.el b/ivy.el index 98f8eab..0e1d141 100644 --- a/ivy.el +++ b/ivy.el @@ -1454,6 +1454,7 @@ Insert .* between each char." "Insert Ivy completions display. Should be run via minibuffer `post-command-hook'." (when (memq 'ivy--exhibit post-command-hook) +(constrain-to-field nil (point-max)) (setq ivy-text (ivy--input)) (if (ivy-state-dynamic-collection ivy-last) ;; while-no-input would cause annoying
[elpa] master 3699fa9 041/167: Don't reset the match to first if the current one still works
branch: master commit 3699fa9b416ba129c448cb60a1eb016d3a820ee9 Author: Oleh Krehel Commit: Oleh Krehel Don't reset the match to first if the current one still works * ivy.el (ivy--recompute-index): If the old match is still located in the current matches after the change in input, keep it selected. * ivy-test.el (ivy-read): Add test. Fixes #258 --- ivy-test.el |6 +- ivy.el |5 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ivy-test.el b/ivy-test.el index 384cd4d..5c77394 100644 --- a/ivy-test.el +++ b/ivy-test.el @@ -68,7 +68,11 @@ (ivy-with '(let ((ivy-re-builders-alist '((t . ivy--regex-fuzzy (ivy-read "pattern: " '("package-list-packages" "something-else"))) "plp C-m") - "package-list-packages"))) + "package-list-packages")) + (should (equal + (ivy-with '(ivy-read "test" '("aaab" "aaac")) + "a C-n C-m") + "aaac"))) (ert-deftest swiper--re-builder () (setq swiper--width 4) diff --git a/ivy.el b/ivy.el index 02b6c73..235aca7 100644 --- a/ivy.el +++ b/ivy.el @@ -1612,7 +1612,10 @@ CANDIDATES are assumed to be static." (func (or (and caller (cdr (assoc caller ivy-index-functions-alist))) (cdr (assoc t ivy-index-functions-alist)) #'ivy-recompute-index-zero))) -(setq ivy--index (funcall func re-str cands)) +(setq ivy--index + (or (cl-position (nth ivy--index ivy--old-cands) + cands) + (funcall func re-str cands))) (when (and (or (string= name "") (string= name "^")) (not (equal ivy--old-re "")))
[elpa] master 83f704b 039/167: ivy-hydra.el (hydra-ivy): Make the docstring a rectangle
branch: master commit 83f704b8ceca52eb18ecad687690ec21dc085c8d Author: Oleh Krehel Commit: Oleh Krehel ivy-hydra.el (hydra-ivy): Make the docstring a rectangle --- ivy-hydra.el |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ivy-hydra.el b/ivy-hydra.el index 84b592d..51b4c1a 100644 --- a/ivy-hydra.el +++ b/ivy-hydra.el @@ -48,10 +48,10 @@ :color pink) " ^^ ^Yes^ ^No^ ^Maybe^^Action^ -^^--- -^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %s(ivy-action-name) -_h_ ^+^ _l_ _d_one_o_ops _m_: matcher %s(if (eq ivy--regex-function 'ivy--regex-fuzzy) \"fuzzy\" \"ivy\") -^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate: %`truncate-lines +^^--- +^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %-3s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %-14s(ivy-action-name) +_h_ ^+^ _l_ _d_one_o_ops _m_: matcher %-27s(if (eq ivy--regex-function 'ivy--regex-fuzzy) \"fuzzy\" \"ivy\") +^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate: %-11`truncate-lines " ;; arrows ("h" ivy-beginning-of-buffer)
[elpa] master 800e640 028/167: Fix "M-o k" when switching buffers
branch: master commit 800e6407565d33ce94f75e59d436e79aeae48d22 Author: Oleh Krehel Commit: Oleh Krehel Fix "M-o k" when switching buffers * ivy.el (ivy-call): Check if (active-minibuffer-window) is non-nil before switching. --- ivy.el |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index a36463b..64eff1e 100644 --- a/ivy.el +++ b/ivy.el @@ -608,7 +608,8 @@ If the input is empty, select the previous history element instead." (prog1 (funcall action x) (unless (or (eq ivy-exit 'done) (equal (selected-window) - (active-minibuffer-window))) + (active-minibuffer-window)) + (null (active-minibuffer-window))) (select-window (active-minibuffer-window (defun ivy-next-line-and-call (&optional arg)
[elpa] master 9cc75eb 050/167: Adjust the swiper regexp builder for the display change
branch: master commit 9cc75eb095ba158b31fc1fcf771a613c7a5fd908 Author: Oleh Krehel Commit: Oleh Krehel Adjust the swiper regexp builder for the display change * swiper.el (swiper--re-builder): Update. The old re-builder was for when the line numbers were part of the candidates. Now the line numbers are the text properties of the candidates. Fixes #262 --- swiper.el | 10 -- 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/swiper.el b/swiper.el index 8ad9c54..f702e90 100644 --- a/swiper.el +++ b/swiper.el @@ -320,12 +320,10 @@ there have line numbers. In the buffer, `ivy--regex' should be used." ((string-match "^\\^" str) (setq ivy--old-re "") (let ((re (ivy--regex-plus (substring str 1 - (format "^[0-9][0-9 ]\\{%d\\}%s" - swiper--width - (if (zerop ivy--subexps) - (prog1 (format "\\(%s\\)" re) - (setq ivy--subexps 1)) - re + (if (zerop ivy--subexps) + (prog1 (format "^ ?\\(%s\\)" re) + (setq ivy--subexps 1)) + (format "^ %s" re (t (ivy--regex-plus str
[elpa] master 6956311 027/167: Adjust ivy-state-preselect for file name completion
branch: master commit 69563119fc0d5ef6c468dbd5d1675deee8543381 Author: Oleh Krehel Commit: Oleh Krehel Adjust ivy-state-preselect for file name completion * ivy.el (ivy--reset-state): Since `ivy--index' is now recomputed more, `ivy-state-preselect' needs to be in the collection properly, so that `ivy--index' is set to preselect whenever the input is empty. --- ivy.el |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 7320a11..a36463b 100644 --- a/ivy.el +++ b/ivy.el @@ -1013,7 +1013,9 @@ This is useful for recursive `ivy-read'." (string= preselect-directory default-directory)) (setq ivy--directory preselect-directory)) - (setq preselect (file-name-nondirectory preselect + (setf + (ivy-state-preselect state) + (setq preselect (file-name-nondirectory preselect) (setq coll (ivy--sorted-files ivy--directory)) (when initial-input (unless (or require-match
[elpa] master 73e5799 012/167: Fix counsel-git-grep not updating to 0 candidates
branch: master commit 73e5799796f304f60af791c9d8d2271ca0bf7b7a Author: Oleh Krehel Commit: Oleh Krehel Fix counsel-git-grep not updating to 0 candidates * counsel.el (counsel--gg-candidates): `ivy--all-candidates' should not be nil in order for `ivy--exhibit' to update the minibuffer. --- counsel.el |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/counsel.el b/counsel.el index 158c491..432d141 100644 --- a/counsel.el +++ b/counsel.el @@ -699,7 +699,9 @@ The libraries are offered from `load-path'." (if (string= event "finished\n") (progn (with-current-buffer (process-buffer process) - (setq ivy--all-candidates (split-string (buffer-string) "\n" t)) + (setq ivy--all-candidates +(or (split-string (buffer-string) "\n" t) +'(""))) (setq ivy--old-cands ivy--all-candidates)) (when (= 0 (cl-incf counsel-gg-state)) (ivy--exhibit)))
[elpa] master b6d476a 042/167: ivy.el (ivy--recompute-index): Fixup
branch: master commit b6d476ac614b3d3c5e6898db28801022472359e8 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy--recompute-index): Fixup Fixes #258 --- ivy.el |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ivy.el b/ivy.el index 235aca7..9aaaf72 100644 --- a/ivy.el +++ b/ivy.el @@ -1613,8 +1613,9 @@ CANDIDATES are assumed to be static." (cdr (assoc t ivy-index-functions-alist)) #'ivy-recompute-index-zero))) (setq ivy--index - (or (cl-position (nth ivy--index ivy--old-cands) - cands) + (or (and (not (string= name "")) + (cl-position (nth ivy--index ivy--old-cands) +cands)) (funcall func re-str cands))) (when (and (or (string= name "") (string= name "^"))
[elpa] master 6db3d54 024/167: ivy.el (ivy--insert-prompt): Use newlines instead of truncation
branch: master commit 6db3d543cd277147886fec70658a0477ca83fb6f Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy--insert-prompt): Use newlines instead of truncation When the prompt string is longer than window-width, insert newlines appropriately so that the whole prompt fits in the window without scrolling. Finally, when prompt+entered text would be larger than window-width, reformat the prompt so that entered text starts on a newline. When completing file names, move the whole path to a new line in that case. Fixes #252 --- ivy.el | 20 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ivy.el b/ivy.el index 7885a9c..73ebbfa 100644 --- a/ivy.el +++ b/ivy.el @@ -1342,17 +1342,21 @@ Insert .* between each char." ivy--full-length) ivy--length))) ivy--prompt-extra - tail) - (if ivy--directory - (abbreviate-file-name ivy--directory) -"" + tail))) +(d-str (if ivy--directory + (abbreviate-file-name ivy--directory) + ""))) (save-excursion (goto-char (point-min)) (delete-region (point-min) (minibuffer-prompt-end)) - (when (> (length n-str) (- (window-width) 35)) -(setq n-str (concat (substring n-str 0 - (max (- (window-width) 35) -10)) "... "))) + (if (> (+ (mod (+ (length n-str) (length d-str)) (window-width)) +(length ivy-text)) + (window-width)) + (setq n-str (concat n-str "\n" d-str)) +(setq n-str (concat n-str d-str))) + (let ((regex (format "\\([^\n]\\{%d\\}\\)[^\n]" (window-width +(while (string-match regex n-str) + (setq n-str (replace-match (concat (match-string 1 n-str) "\n") nil t n-str 1 (set-text-properties 0 (length n-str) `(face minibuffer-prompt ,@std-props) n-str)
[elpa] master 340318d 044/167: ivy-count-format must be an empty string instead of nil
branch: master commit 340318dc9c9f9ce514e515dc5bddb16b0026a617 Author: Oleh Krehel Commit: Oleh Krehel ivy-count-format must be an empty string instead of nil Using an empty string is easier. No longer needed to check for nil when using `string-match', `concat' etc. * doc/Changelog.org: Update. * ivy.el (ivy-count-format): Update doc and customize type. (ivy--reset-state): Error if `ivy-count-format' nil is encountered. Fixes #257 Re #188 --- doc/Changelog.org |2 +- ivy.el| 11 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/Changelog.org b/doc/Changelog.org index 0f5ac2c..94f122f 100644 --- a/doc/Changelog.org +++ b/doc/Changelog.org @@ -65,7 +65,7 @@ To have this feature, use something like this: #+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]]. +You can also set this to "", 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 diff --git a/ivy.el b/ivy.el index 9aaaf72..71d80cd 100644 --- a/ivy.el +++ b/ivy.el @@ -72,11 +72,11 @@ (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. You can also set it -to e.g. \"(%d/%d) \" if you want to see both the candidate index -and the candidate count." +Set this to \"\" 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 '(choice - (const :tag "Count disabled" nil) + (const :tag "Count disabled" "") (const :tag "Count matches" "%-4d ") (const :tag "Count matches and show current match" "(%d/%d) ") string)) @@ -,7 +,8 @@ This is useful for recursive `ivy-read'." (cond ((string-match "%.*d" prompt) prompt) ((null ivy-count-format) - nil) + (error + "`ivy-count-format' can't be nil. Set it to an empty string instead.")) ((string-match "%d.*%d" ivy-count-format) (let ((w (length (number-to-string (length ivy--all-candidates
[elpa] master 6bf3239 006/167: ivy.el (ivy-yank-word): Add only one space each time
branch: master commit 6bf3239a12d7a7a9c1beec9f5d5e3bd3c3f4474a Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-yank-word): Add only one space each time The previous behavior got in trouble with consecutive spaces. --- ivy.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 5f7ed6f..f9d093b 100644 --- a/ivy.el +++ b/ivy.el @@ -1793,7 +1793,7 @@ BUFFER may be a string or nil." (goto-char pt) (setq amend (buffer-substring-no-properties pt (point)) (when amend - (insert amend + (insert (replace-regexp-in-string " +" " " amend) (defun ivy-kill-ring-save () "Store the current candidates into the kill ring.
[elpa] master 3a3b052 036/167: swiper.el: Add a lot of avy declares
branch: master commit 3a3b052ed5f1293233f5275a2dc78aa61c2e0a77 Author: Oleh Krehel Commit: Oleh Krehel swiper.el: Add a lot of avy declares --- swiper.el | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/swiper.el b/swiper.el index 3a31d81..a7327c3 100644 --- a/swiper.el +++ b/swiper.el @@ -131,10 +131,20 @@ (defvar avy-background) (defvar avy-all-windows) +(defvar avy-style) +(defvar avy-keys) (declare-function avy--regex-candidates "ext:avy") (declare-function avy--process "ext:avy") (declare-function avy--overlay-post "ext:avy") (declare-function avy-action-goto "ext:avy") +(declare-function avy--done "ext:avy") +(declare-function avy--make-backgrounds "ext:avy") +(declare-function avy-window-list "ext:avy") +(declare-function avy-read "ext:avy") +(declare-function avy-read-de-bruijn "ext:avy") +(declare-function avy-tree "ext:avy") +(declare-function avy-push-mark "ext:avy") +(declare-function avy--remove-leading-chars "ext:avy") ;;;###autoload (defun swiper-avy ()
[elpa] master updated (a0561bf -> 1f3fa31)
abo_abo pushed a change to branch master. from a0561bf Merge commit '97c2270f7138530de21f773f094c1495498cac78' from hydra new a71d5c8 ivy.el (ivy--insert-prompt): Improve truncation new 4ad797b Improve "C-g" out of a long-running async process new e70ca07 ivy.el (ivy-call): "C-M-n" should not leave the minibuffer new 19d2a40 Add flx sorting new 41b5850 ivy.el (ivy--regex-fuzzy): Add minibuffer highlighting new 6bf3239 ivy.el (ivy-yank-word): Add only one space each time new c89c167 Specify shell command for counsel-git-grep with prefix arg new 1c1e6fc ivy.el (ivy--reset-state): Less strict on :preselect new f04aec8 ivy-hydra.el: Bind "t" to toggle-truncate-lines new 3146501 ivy.el (ivy-resume): Don't regexp-quote preselect new 82a317c Make swiper compatible with visual-line-mode new 73e5799 Fix counsel-git-grep not updating to 0 candidates new ff077c6 counsel.el (counsel--gg-candidates): Use counsel-git-grep-cmd new cbaa811 Use forward-line instead of line-move if possible new 45b54e3 counsel.el (counsel--gg-count): Fix for "'" in query new dfb41d0 Implement ivy-avy new eda091b Customize ivy-avy and fix compile warnings new fa49a81 Fix "End of buffer" for swiper and visual-line-mode new 4e0c3f1 swiper-avy: show avy hints in minibuffer as well new 52c9565 swiper.el (swiper--candidates): Avoid line-move for large buffers new 21b9edf Fix up visual-line-mode limitation logic new 1714220 swiper.el (swiper-font-lock-ensure): Exclude help-mode new 47a220d Support hash tables in ivy-read new 6db3d54 ivy.el (ivy--insert-prompt): Use newlines instead of truncation new 126158d ivy.el (ivy--filter): Anchor only for swiper new b9d0502 ivy.el (ivy--filter): Fix typo new 6956311 Adjust ivy-state-preselect for file name completion new 800e640 Fix "M-o k" when switching buffers new 6e3c692 Fix ivy-state-preselect for file name completion new ef189f1 ivy.el (ivy-count-format): Extend customize choices new 4a04d6e Default ivy-display-style to 'fancy for Emacs>=24.5 new 4045349 ivy.el (ivy-use-virtual-buffers): Update docstring new c69b4b6 ivy.el (ivy-last): Update docstring new 6f4d46b Fix preselect for input "^" new 99698e6 ivy.el (ivy-dispatching-call): Add and bind to "C-M-o" new 3a3b052 swiper.el: Add a lot of avy declares new f9df75e ivy.el (ivy-index-functions-alist): New variable new fa0d04c Move setq ivy--index to ivy--recompute-index new 83f704b ivy-hydra.el (hydra-ivy): Make the docstring a rectangle new b06daca ivy.el (ivy-virtual-abbreviate): New defcustom new 3699fa9 Don't reset the match to first if the current one still works new b6d476a ivy.el (ivy--recompute-index): Fixup new 0630395 Fix the count when git-grep for "->foo" new 340318d ivy-count-format must be an empty string instead of nil new 877648a ivy.el (ivy-case-fold-search): New defvar new e722d6a swiper.el (swiper-mc): Add and bind to "C-7" new c99956a Fix window selection in counsel-locate new 85682ee Fix "C-x h" selection and "C-b" bug new 713fd6d Try to fix the previous commit new 9cc75eb Adjust the swiper regexp builder for the display change new 79924dc swiper.el (swiper--re-builder): Fix "^a" -> "^" case new 3ae4f1a ivy-test.el (swiper--re-builder): Update new 2404db1 Add feedback for long-running async processes new e5105ef Don't re-anchor to matching old candidate if flx is on new f4bd3a4 counsel.el (counsel-ag): Add initial-directory new f00696a ivy.el (ivy-extra-directories): Improve :type new e338785 ivy.el (ivy-sort-functions-alist): Upgrade to defcustom new 2ae7d74 Fix the count in user-specified counsel-git-grep new d4d53d8 ivy.el (ivy-partial): Fix for fuzzy completion new 2386277 ivy.el (ivy-resume): Pass caller new 607fd1f Bring back the lost perfect match logic new fd19ab1 Add a test for the perfect match logic new f0acebd Fix Custom menus new dfd6204 Fix pasting file paths on Windows new 71695df "C-j" should not stop completion for a pasted file path new f6dd9cd ivy.el (ivy-alt-done): Fix up last commit new 1af25f6 swiper.el (swiper-font-lock-ensure): Amend exception list new a11c978 ivy-immediate-done should use ivy--directory new 5f22310 counsel.el (counsel-git): Update default-directory new dc84ba3 Rename and move the minibuffer faces new 183b803 Use a specific blending method for dark themes new f9ef307 Imp
[elpa] master cbaa811 014/167: Use forward-line instead of line-move if possible
branch: master commit cbaa81195ec5cc0b4b06dcf29a12bd73bf0ad0ff Author: Oleh Krehel Commit: Oleh Krehel Use forward-line instead of line-move if possible * swiper.el (swiper--candidates): (swiper--update-input-ivy): (swiper--action): `line-move' is much slower than `forward-line'. Use it only if `visual-line-mode' is on. --- swiper.el | 14 +++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/swiper.el b/swiper.el index cfc80cd..9e70265 100644 --- a/swiper.el +++ b/swiper.el @@ -195,6 +195,9 @@ (setq swiper--format-spec (format "%%-%dd " swiper--width)) (let ((line-number 0) +(advancer (if visual-line-mode + #'line-move +#'forward-line)) candidates) (save-excursion (goto-char (point-min)) @@ -212,7 +215,7 @@ (cl-incf line-number)) str) (push str candidates)) -(line-move 1)) +(funcall advancer 1)) (nreverse candidates)) (defvar swiper--opoint 1 @@ -322,7 +325,9 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (goto-char (point-min)) (when (cl-plusp num) (goto-char (point-min)) - (line-move (1- num)) + (if visual-line-mode + (line-move (1- num)) +(forward-line (1- num))) (if (and (equal ivy-text "") (>= swiper--opoint (line-beginning-position)) (<= swiper--opoint (line-end-position))) @@ -389,7 +394,10 @@ BEG and END, when specified, are the point bounds." (if (null x) (user-error "No candidates") (goto-char (point-min)) -(line-move (1- (read (get-text-property 0 'display x +(funcall (if visual-line-mode + #'line-move + #'forward-line) + (1- (read (get-text-property 0 'display x (re-search-forward (ivy--regex input) (line-end-position) t) (swiper--ensure-visible)
[elpa] master 877648a 045/167: ivy.el (ivy-case-fold-search): New defvar
branch: master commit 877648a227fe34e1456776a4e6019029d65fc734 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-case-fold-search): New defvar * ivy.el (ivy--reset-state): Set `ivy-case-fold-search' to 'auto. (ivy-toggle-case-fold): New command. (ivy--filter): Use `ivy-case-fold-search' to determine `case-fold-search'. * ivy-hydra.el (hydra-ivy): Bind "C" to `ivy-toggle-case-fold'. Fixes #259 --- ivy-hydra.el | 19 +-- ivy.el | 24 +++- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/ivy-hydra.el b/ivy-hydra.el index 51b4c1a..19deabb 100644 --- a/ivy-hydra.el +++ b/ivy-hydra.el @@ -44,14 +44,20 @@ (byte-compile-file (buffer-file-name) t))) (error "Please install `hydra' and recompile/reinstall `ivy-hydra'"))) +(defun ivy--matcher-desc () + (if (eq ivy--regex-function + 'ivy--regex-fuzzy) + "fuzzy" +"ivy")) + (defhydra hydra-ivy (:hint nil :color pink) " -^^ ^Yes^ ^No^ ^Maybe^^Action^ -^^--- -^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %-3s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %-14s(ivy-action-name) -_h_ ^+^ _l_ _d_one_o_ops _m_: matcher %-27s(if (eq ivy--regex-function 'ivy--regex-fuzzy) \"fuzzy\" \"ivy\") -^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate: %-11`truncate-lines +^^ ^Yes^ ^No^ ^Maybe^ ^^^Action^ ^ +^^^--- +^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %-5s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %-14s(ivy-action-name) +_h_ ^+^ _l_ _d_one_o_ops _m_: matcher %-5s(ivy--matcher-desc) _C_ase-fold: %-10`ivy-case-fold-search +^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate: %-11`truncate-lines " ;; arrows ("h" ivy-beginning-of-buffer) @@ -75,7 +81,8 @@ _h_ ^+^ _l_ _d_one_o_ops _m_: matcher %-27s(if (eq ivy--regex-function ("w" ivy-prev-action) ("s" ivy-next-action) ("a" ivy-read-action) - ("t" (setq truncate-lines (not truncate-lines + ("t" (setq truncate-lines (not truncate-lines))) + ("C" ivy-toggle-case-fold)) (provide 'ivy-hydra) diff --git a/ivy.el b/ivy.el index 71d80cd..98f8eab 100644 --- a/ivy.el +++ b/ivy.el @@ -252,6 +252,9 @@ When non-nil, it should contain one %d.") (defvar ivy--old-text "" "Store old `ivy-text' for dynamic completion.") +(defvar ivy-case-fold-search 'auto + "Store the current overriding `case-fold-search'.") + (defvar Info-current-file) (defmacro ivy-quit-and-run (&rest body) @@ -1028,6 +1031,7 @@ This is useful for recursive `ivy-read'." (setq initial-input (cdr (assoc this-command ivy-initial-inputs-alist (setq ivy--directory nil) +(setq ivy-case-fold-search 'auto) (setq ivy--regex-function (or re-builder (and (functionp collection) @@ -1558,6 +1562,22 @@ all of the text contained in the minibuffer." (eval-after-load 'flx '(setq ivy--flx-cache (flx-make-string-cache))) +(defun ivy-toggle-case-fold () + "Toggle the case folding between nil and auto. +In any completion session, the case folding starts in auto: + +- when the input is all lower case, `case-fold-search' is t +- otherwise it's nil. + +You can toggle this to make `case-fold-search' nil regardless of input." + (interactive) + (setq ivy-case-fold-search +(if ivy-case-fold-search +nil + 'auto)) + ;; reset cache so that the candidate list updates + (setq ivy--old-re nil)) + (defun ivy--filter (name candidates) "Return all items that match NAME in CANDIDATES. CANDIDATES are assumed to be static." @@ -1568,7 +1588,9 @@ CANDIDATES are assumed to be static." ivy--old-cands (let* ((re-str (if (listp re) (caar re) re)) (matcher (ivy-state-matcher ivy-last)) - (case-fold-search (string= name (downcase name))) + (case-fold-search + (and ivy-case-fold-search + (string= name (downcase name (cands (cond (matcher (funcall matcher re candidates))
[elpa] master 3146501 010/167: ivy.el (ivy-resume): Don't regexp-quote preselect
branch: master commit 314650189a3331354561300cb11de79e524f9de5 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-resume): Don't regexp-quote preselect `ivy--preselect-index' uses `cl-position' before trying to match regex, so the string needs to be as is. Fixes #245 --- ivy.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index bf3981a..8839ba6 100644 --- a/ivy.el +++ b/ivy.el @@ -454,7 +454,7 @@ If the text hasn't changed as a result, forward to `ivy-alt-done'." :history (ivy-state-history ivy-last) :preselect (unless (eq (ivy-state-collection ivy-last) 'read-file-name-internal) -(regexp-quote ivy--current)) +ivy--current) :keymap (ivy-state-keymap ivy-last) :update-fn (ivy-state-update-fn ivy-last) :sort (ivy-state-sort ivy-last)
[elpa] master ef189f1 030/167: ivy.el (ivy-count-format): Extend customize choices
branch: master commit ef189f1eeb56abfc108c1fff5902ebbc3bd013aa Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-count-format): Extend customize choices --- ivy.el |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 59a02bd..c35ef52 100644 --- a/ivy.el +++ b/ivy.el @@ -75,7 +75,11 @@ 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 '(choice (const :tag "Count disabled" nil) string)) + :type '(choice + (const :tag "Count disabled" nil) + (const :tag "Count matches" "%-4d ") + (const :tag "Count matches and show current match" "(%d/%d) ") + string)) (defcustom ivy-wrap nil "Whether to wrap around after the first and last candidate."
[elpa] master f4bd3a4 055/167: counsel.el (counsel-ag): Add initial-directory
branch: master commit f4bd3a49bd009fe2e20bc2cfc83616bc9168a64b Author: Jon Miller Commit: Jon Miller counsel.el (counsel-ag): Add initial-directory Support alternative initial directory which helps other packages call this function with their unique starting directory. --- counsel.el |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/counsel.el b/counsel.el index 5d5263b..25f1f44 100644 --- a/counsel.el +++ b/counsel.el @@ -1040,18 +1040,19 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and "Grep in the current directory for STRING." (if (< (length string) 3) (counsel-more-chars 3) -(let ((regex (counsel-unquote-regex-parens +(let ((default-directory counsel--git-grep-dir) + (regex (counsel-unquote-regex-parens (setq ivy--old-re (ivy--regex string) (counsel--async-command (format "ag --noheading --nocolor %S" regex)) nil))) -(defun counsel-ag (&optional initial-input) +(defun counsel-ag (&optional initial-input initial-directory) "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) + (setq counsel--git-grep-dir (or initial-directory default-directory)) (ivy-read "ag: " 'counsel-ag-function :initial-input initial-input :dynamic-collection t
[elpa] master 99698e6 035/167: ivy.el (ivy-dispatching-call): Add and bind to "C-M-o"
branch: master commit 99698e68f02ddcc400fca63a282a099317e42b0a Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-dispatching-call): Add and bind to "C-M-o" * ivy.el (ivy-minibuffer-map): Update. (ivy-read-action): New command. (ivy-dispatching-done): Update. * ivy-hydra.el (hydra-ivy): Bind `ivy-read-action' to "a". Re #254 --- ivy-hydra.el |3 ++- ivy.el | 32 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/ivy-hydra.el b/ivy-hydra.el index 152812b..84b592d 100644 --- a/ivy-hydra.el +++ b/ivy-hydra.el @@ -49,7 +49,7 @@ " ^^ ^Yes^ ^No^ ^Maybe^^Action^ ^^--- -^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %s(if ivy-calling \"on\" \"off\") _w_/_s_: %s(ivy-action-name) +^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %s(ivy-action-name) _h_ ^+^ _l_ _d_one_o_ops _m_: matcher %s(if (eq ivy--regex-function 'ivy--regex-fuzzy) \"fuzzy\" \"ivy\") ^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate: %`truncate-lines " @@ -74,6 +74,7 @@ _h_ ^+^ _l_ _d_one_o_ops _m_: matcher %s(if (eq ivy--regex-function 'i ("<" ivy-minibuffer-shrink) ("w" ivy-prev-action) ("s" ivy-next-action) + ("a" ivy-read-action) ("t" (setq truncate-lines (not truncate-lines (provide 'ivy-hydra) diff --git a/ivy.el b/ivy.el index e06c3dd..a841a4b 100644 --- a/ivy.el +++ b/ivy.el @@ -157,6 +157,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 "M-o") 'ivy-dispatching-done) +(define-key map (kbd "C-M-o") 'ivy-dispatching-call) (define-key map (kbd "C-k") 'ivy-kill-line) (define-key map (kbd "S-SPC") 'ivy-restrict-to-matches) (define-key map (kbd "M-w") 'ivy-kill-ring-save) @@ -302,12 +303,11 @@ 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'." +(defun ivy-read-action () + "Change the action to one of the available ones." (interactive) (let ((actions (ivy-state-action ivy-last))) -(if (null (ivy--actionp actions)) -(ivy-done) +(unless (null (ivy--actionp actions)) (let* ((hint (concat ivy--current "\n" (mapconcat @@ -321,14 +321,30 @@ When non-nil, it should contain one %d.") "\n") "\n")) (key (string (read-key hint))) - (action (assoc key (cdr actions + (action-idx (cl-position-if + (lambda (x) (equal (car x) key)) + (cdr actions (cond ((string= key "")) - ((null action) + ((null action-idx) (error "%s is not bound" key)) (t (message "") - (ivy-set-action (nth 1 action)) - (ivy-done))) + (setcar actions (1+ action-idx)) + (ivy-set-action actions))) + +(defun ivy-dispatching-done () + "Select one of the available actions and call `ivy-done'." + (interactive) + (ivy-read-action) + (ivy-done)) + +(defun ivy-dispatching-call () + "Select one of the available actions and call `ivy-call'." + (interactive) + (let ((actions (copy-sequence (ivy-state-action ivy-last +(ivy-read-action) +(ivy-call) +(ivy-set-action actions))) (defun ivy-build-tramp-name (x) "Reconstruct X into a path.
[elpa] master 1c1e6fc 008/167: ivy.el (ivy--reset-state): Less strict on :preselect
branch: master commit 1c1e6fc418ae9354beb19a099283316576c455ba Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy--reset-state): Less strict on :preselect --- ivy.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index f9d093b..25ea6c6 100644 --- a/ivy.el +++ b/ivy.el @@ -998,7 +998,7 @@ This is useful for recursive `ivy-read'." (when preselect (unless (or (and require-match (not (eq collection 'internal-complete-buffer))) -(let ((re (format "\\`%s" (regexp-quote preselect +(let ((re (regexp-quote preselect))) (cl-find-if (lambda (x) (string-match re x)) coll))) (setq coll (cons preselect coll
[elpa] master 82a317c 011/167: Make swiper compatible with visual-line-mode
branch: master commit 82a317ce813d7364774dcf44bd432f363e878bea Author: Oleh Krehel Commit: Oleh Krehel Make swiper compatible with visual-line-mode * swiper.el (swiper--candidates): Use `end-of-visual-line' and `line-move' appropriately. (swiper--update-input-ivy): (swiper--action): Use `line-move' instead of `forward-line'. (swiper--add-overlays): Update. Fixes #227 --- swiper.el | 28 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/swiper.el b/swiper.el index 1b2d906..cfc80cd 100644 --- a/swiper.el +++ b/swiper.el @@ -201,14 +201,18 @@ (swiper-font-lock-ensure) (while (< (point) (point-max)) (let ((str (concat " " (buffer-substring -(line-beginning-position) -(line-end-position) +(point) +(if visual-line-mode +(save-excursion + (end-of-visual-line) + (point)) + (line-end-position)) (put-text-property 0 1 'display (format swiper--format-spec (cl-incf line-number)) str) (push str candidates)) -(forward-line 1)) +(line-move 1)) (nreverse candidates)) (defvar swiper--opoint 1 @@ -318,7 +322,7 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (goto-char (point-min)) (when (cl-plusp num) (goto-char (point-min)) - (forward-line (1- num)) + (line-move (1- num)) (if (and (equal ivy-text "") (>= swiper--opoint (line-beginning-position)) (<= swiper--opoint (line-end-position))) @@ -334,9 +338,17 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (defun swiper--add-overlays (re &optional beg end) "Add overlays for RE regexp in visible part of the current buffer. BEG and END, when specified, are the point bounds." - (let ((ov (make-overlay - (line-beginning-position) - (1+ (line-end-position) + (let ((ov (if visual-line-mode +(make-overlay + (save-excursion + (beginning-of-visual-line) + (point)) + (save-excursion + (end-of-visual-line) + (point))) + (make-overlay + (line-beginning-position) + (1+ (line-end-position)) (overlay-put ov 'face 'swiper-line-face) (overlay-put ov 'window (ivy-state-window ivy-last)) (push ov swiper--overlays) @@ -377,7 +389,7 @@ BEG and END, when specified, are the point bounds." (if (null x) (user-error "No candidates") (goto-char (point-min)) -(forward-line (1- (read (get-text-property 0 'display x +(line-move (1- (read (get-text-property 0 'display x (re-search-forward (ivy--regex input) (line-end-position) t) (swiper--ensure-visible)
[elpa] master e722d6a 046/167: swiper.el (swiper-mc): Add and bind to "C-7"
branch: master commit e722d6a7166eb75015a02445a6cb616b9ea289f2 Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper-mc): Add and bind to "C-7" * swiper.el (swiper-map): Update. (swiper-mc): New command. (swiper--ivy): Use :action. (swiper--action): Update arglist. --- swiper.el | 61 + 1 files changed, 41 insertions(+), 20 deletions(-) diff --git a/swiper.el b/swiper.el index 361769e..8ad9c54 100644 --- a/swiper.el +++ b/swiper.el @@ -109,6 +109,7 @@ (define-key map (kbd "M-q") 'swiper-query-replace) (define-key map (kbd "C-l") 'swiper-recenter-top-bottom) (define-key map (kbd "C-'") 'swiper-avy) +(define-key map (kbd "C-7") 'swiper-mc) map) "Keymap for swiper.") @@ -190,6 +191,27 @@ (ivy-quit-and-run (avy-action-goto (caar candidate))) +(declare-function mc/create-fake-cursor-at-point "ext:multiple-cursors-core") +(declare-function mc/maybe-multiple-cursors-mode "ext:multiple-cursors-core") + +;;;###autoload +(defun swiper-mc () + (interactive) + (unless (require 'multiple-cursors nil t) +(error "multiple-cursors isn't installed")) + (let ((cands (nreverse ivy--old-cands))) +(unless (string= ivy-text "") + (ivy-set-action + (lambda (_) + (let (cand) + (while (setq cand (pop cands)) + (swiper--action cand) + (when cands + (mc/create-fake-cursor-at-point + (mc/maybe-multiple-cursors-mode))) + (setq ivy-exit 'done) + (exit-minibuffer + (defun swiper-recenter-top-bottom (&optional arg) "Call (`recenter-top-bottom' ARG)." (interactive "P") @@ -319,24 +341,23 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (preselect (buffer-substring-no-properties (line-beginning-position) (line-end-position))) -(minibuffer-allow-text-properties t) -res) +(minibuffer-allow-text-properties t)) (unwind-protect - (setq res (ivy-read -"Swiper: " -candidates -:initial-input initial-input -:keymap swiper-map -:preselect preselect -:require-match t -:update-fn #'swiper--update-input-ivy -:unwind #'swiper--cleanup -:re-builder #'swiper--re-builder -:history 'swiper-history -:caller 'swiper)) - (if (null ivy-exit) - (goto-char swiper--opoint) -(swiper--action res ivy-text) +(ivy-read + "Swiper: " + candidates + :initial-input initial-input + :keymap swiper-map + :preselect preselect + :require-match t + :update-fn #'swiper--update-input-ivy + :unwind #'swiper--cleanup + :action #'swiper--action + :re-builder #'swiper--re-builder + :history 'swiper-history + :caller 'swiper) + (when (null ivy-exit) +(goto-char swiper--opoint) (defun swiper--ensure-visible () "Remove overlays hiding point." @@ -436,8 +457,8 @@ BEG and END, when specified, are the point bounds." (overlay-put overlay 'priority i))) (cl-incf i) -(defun swiper--action (x input) - "Goto line X and search for INPUT." +(defun swiper--action (x) + "Goto line X." (if (null x) (user-error "No candidates") (goto-char (point-min)) @@ -446,7 +467,7 @@ BEG and END, when specified, are the point bounds." #'forward-line) (1- (read (get-text-property 0 'display x (re-search-forward - (ivy--regex input) (line-end-position) t) + (ivy--regex ivy-text) (line-end-position) t) (swiper--ensure-visible) (when (/= (point) swiper--opoint) (unless (and transient-mark-mode mark-active)
[elpa] master 4e0c3f1 019/167: swiper-avy: show avy hints in minibuffer as well
branch: master commit 4e0c3f1132f16039e909301590661fb36063bf15 Author: PythonNut Commit: Oleh Krehel swiper-avy: show avy hints in minibuffer as well --- swiper.el | 46 +- 1 files changed, 37 insertions(+), 9 deletions(-) diff --git a/swiper.el b/swiper.el index 19d0a59..09c266e 100644 --- a/swiper.el +++ b/swiper.el @@ -141,16 +141,44 @@ "Jump to one of the current swiper candidates." (interactive) (unless (string= ivy-text "") -(with-ivy-window - (let* ((avy-all-windows nil) - (candidates - (avy--regex-candidates - (ivy--regex ivy-text))) - (avy-background nil) - (candidate - (avy--process candidates #'avy--overlay-post))) +(let* ((avy-all-windows nil) + (candidates (append +(with-ivy-window + (avy--regex-candidates + (ivy--regex ivy-text))) +(save-excursion + (save-restriction +(narrow-to-region (window-start) (window-end)) +(goto-char (point-min)) +(forward-line) +(let ((cands)) + (while (< (point) (point-max)) +(push (cons (1+ (point)) +(selected-window)) + cands) +(forward-line)) + cands) + (candidate (unwind-protect + (prog2 + (avy--make-backgrounds + (append (avy-window-list) + (list (ivy-state-window ivy-last + (if (eq avy-style 'de-bruijn) + (avy-read-de-bruijn + candidates avy-keys) +(avy-read (avy-tree candidates avy-keys) + #'avy--overlay-post + #'avy--remove-leading-chars)) +(avy-push-mark)) +(avy--done + (if (window-minibuffer-p (cdr candidate)) + (progn +(ivy-set-index (- (line-number-at-pos (car candidate)) 2)) +(ivy--exhibit) +(ivy-done) +(ivy-call)) (ivy-quit-and-run - (avy-action-goto candidate)) + (avy-action-goto (caar candidate))) (defun swiper-recenter-top-bottom (&optional arg) "Call (`recenter-top-bottom' ARG)."
[elpa] master a71d5c8 001/167: ivy.el (ivy--insert-prompt): Improve truncation
branch: master commit a71d5c8a1f699bc7212b06623a3b030ebe722cde Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy--insert-prompt): Improve truncation Re #240 --- ivy.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ivy.el b/ivy.el index 04c254e..1bb3326 100644 --- a/ivy.el +++ b/ivy.el @@ -1294,9 +1294,9 @@ Insert .* between each char." (save-excursion (goto-char (point-min)) (delete-region (point-min) (minibuffer-prompt-end)) - (when (> (length n-str) (window-width)) + (when (> (length n-str) (- (window-width) 35)) (setq n-str (concat (substring n-str 0 - (max (- (window-width) 30) + (max (- (window-width) 35) 10)) "... "))) (set-text-properties 0 (length n-str) `(face minibuffer-prompt ,@std-props)
[elpa] master c69b4b6 033/167: ivy.el (ivy-last): Update docstring
branch: master commit c69b4b6e6738644d04ef874b8c6aeead66d855e0 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-last): Update docstring --- ivy.el |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 04dd2dc..ba7027b 100644 --- a/ivy.el +++ b/ivy.el @@ -186,7 +186,10 @@ Only \"./\" and \"../\" apply here. They appear in reverse order." dynamic-collection) (defvar ivy-last nil - "The last parameters passed to `ivy-read'.") + "The last parameters passed to `ivy-read'. + +This should eventually become a stack so that you could use +`ivy-read' recursively.") (defsubst ivy-set-action (action) (setf (ivy-state-action ivy-last) action))
[elpa] master 4ad797b 002/167: Improve "C-g" out of a long-running async process
branch: master commit 4ad797bf49ef4a160ad556cdb2a284b9abf40e8d Author: Oleh Krehel Commit: Oleh Krehel Improve "C-g" out of a long-running async process * counsel.el (counsel-delete-process): New defun. (counsel-locate): (counsel-ag): Use `counsel-delete-process' as :unwind. --- counsel.el | 12 ++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/counsel.el b/counsel.el index 22dc505..129a8ce 100644 --- a/counsel.el +++ b/counsel.el @@ -556,6 +556,11 @@ Skip some dotfiles unless `ivy-text' requires them." (ivy--regex str '("" "working..."))) +(defun counsel-delete-process () + (let ((process (get-process " *counsel*"))) +(when process + (delete-process process + ;;;###autoload (defun counsel-locate () "Call locate shell command." @@ -565,7 +570,8 @@ Skip some dotfiles unless `ivy-text' requires them." :history 'counsel-locate-history :action (lambda (file) (when file -(find-file file) +(find-file file))) +:unwind #'counsel-delete-process)) (defun counsel--generic (completion-fn) "Complete thing at point with COMPLETION-FN." @@ -1000,7 +1006,9 @@ INITIAL-INPUT can be given as the initial minibuffer input." :dynamic-collection t :history 'counsel-git-grep-history :action #'counsel-git-grep-action -:unwind #'swiper--cleanup)) +:unwind (lambda () + (counsel-delete-process) + (swiper--cleanup (defun counsel-recoll-function (string &optional _pred &rest _unused) "Grep in the current directory for STRING."
[elpa] master 45b54e3 015/167: counsel.el (counsel--gg-count): Fix for "'" in query
branch: master commit 45b54e37cb0952cbafbd80fb6b0ccf4f2538c5da Author: Oleh Krehel Commit: Oleh Krehel counsel.el (counsel--gg-count): Fix for "'" in query Since "'" is used for quoting in bash, it needs to be replaced with "''" . --- counsel.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/counsel.el b/counsel.el index 87d0eb7..ce23179 100644 --- a/counsel.el +++ b/counsel.el @@ -717,7 +717,7 @@ The libraries are offered from `load-path'." When NO-ASYNC is non-nil, do it synchronously." (let ((default-directory counsel--git-grep-dir) (cmd (format "git grep -i -c '%s' | sed 's/.*:\\(.*\\)/\\1/g' | awk '{s+=$1} END {print s}'" - regex)) + (replace-regexp-in-string "'" "''" regex))) (counsel-ggc-process " *counsel-gg-count*")) (if no-async (string-to-number (shell-command-to-string cmd))
[elpa] master 5f22310 069/167: counsel.el (counsel-git): Update default-directory
branch: master commit 5f22310c612a940b6c118220c301bf009779a825 Author: Oleh Krehel Commit: Oleh Krehel counsel.el (counsel-git): Update default-directory --- counsel.el |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/counsel.el b/counsel.el index 402f55c..ef67be9 100644 --- a/counsel.el +++ b/counsel.el @@ -333,7 +333,9 @@ "git ls-files --full-name --") "\n" t)) - (action (lambda (x) (find-file x + (action `(lambda (x) +(let ((default-directory ,default-directory)) + (find-file x) (ivy-read "Find file: " cands :action action)))
[elpa] master 713fd6d 049/167: Try to fix the previous commit
branch: master commit 713fd6d23e8ae04b97fa72472e94dc8ff52249db Author: Oleh Krehel Commit: Oleh Krehel Try to fix the previous commit * ivy.el (ivy--exhibit): Update. Sometimes the cursor randomly moves to the start of the read-only prompt and it's impossible to move it. --- ivy.el |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 0e1d141..7420afe 100644 --- a/ivy.el +++ b/ivy.el @@ -1454,7 +1454,8 @@ Insert .* between each char." "Insert Ivy completions display. Should be run via minibuffer `post-command-hook'." (when (memq 'ivy--exhibit post-command-hook) -(constrain-to-field nil (point-max)) +(let ((inhibit-field-text-motion nil)) + (constrain-to-field nil (point-max))) (setq ivy-text (ivy--input)) (if (ivy-state-dynamic-collection ivy-last) ;; while-no-input would cause annoying
[elpa] master 6afce97 096/167: counsel.el (counsel-git-grep-query-replace): Should exit minibuffer
branch: master commit 6afce97543ec031a0f1fb3aea6fb9caa02cac055 Author: Oleh Krehel Commit: Oleh Krehel counsel.el (counsel-git-grep-query-replace): Should exit minibuffer --- counsel.el | 27 ++- 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/counsel.el b/counsel.el index 0e3010e..dee0e59 100644 --- a/counsel.el +++ b/counsel.el @@ -391,19 +391,20 @@ (let* ((enable-recursive-minibuffers t) (from (ivy--regex ivy-text)) (to (query-replace-read-to from "Query replace" t))) - (let (done-buffers) -(dolist (cand ivy--old-cands) - (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" cand) -(with-ivy-window - (let ((file-name (match-string-no-properties 1 cand))) -(setq file-name (expand-file-name file-name counsel--git-grep-dir)) -(unless (member file-name done-buffers) - (push file-name done-buffers) - (find-file file-name) - (goto-char (point-min))) -(perform-replace from to t t nil)) - (delete-minibuffer-contents) - (swiper--cleanup) + (ivy-set-action + (lambda (_) + (let (done-buffers) + (dolist (cand ivy--old-cands) + (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" cand) + (with-ivy-window + (let ((file-name (match-string-no-properties 1 cand))) + (setq file-name (expand-file-name file-name counsel--git-grep-dir)) + (unless (member file-name done-buffers) + (push file-name done-buffers) + (find-file file-name) + (goto-char (point-min))) + (perform-replace from to t t nil + (setq ivy-exit 'done) (exit-minibuffer (defun counsel-git-grep-recenter ()
[elpa] master 79924dc 051/167: swiper.el (swiper--re-builder): Fix "^a" -> "^" case
branch: master commit 79924dca8d8662df19e146505c7edffad130928d Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper--re-builder): Fix "^a" -> "^" case Fixes #262 --- swiper.el |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/swiper.el b/swiper.el index f702e90..4cd0bfc 100644 --- a/swiper.el +++ b/swiper.el @@ -316,6 +316,7 @@ there have line numbers. In the buffer, `ivy--regex' should be used." ((equal str "") "") ((equal str "^") + (setq ivy--subexps 0) ".") ((string-match "^\\^" str) (setq ivy--old-re "")
[elpa] master 86d0884 087/167: fix 1-too-far scrolling issue
branch: master commit 86d0884c29de43da7c15727144abe702ad0c436f Author: mike Commit: mike fix 1-too-far scrolling issue Functions `ivy-scroll-up-command' and `ivy-scroll-down-command' would scroll 1 unit too far. So one item in the list would be skipped and never seen for each scroll. --- ivy.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ivy.el b/ivy.el index d8d7592..459312c 100644 --- a/ivy.el +++ b/ivy.el @@ -545,13 +545,13 @@ If the text hasn't changed as a result, forward to `ivy-alt-done'." (defun ivy-scroll-up-command () "Scroll the candidates upward by the minibuffer height." (interactive) - (ivy-set-index (min (+ ivy--index ivy-height) + (ivy-set-index (min (1- (+ ivy--index ivy-height)) (1- ivy--length (defun ivy-scroll-down-command () "Scroll the candidates downward by the minibuffer height." (interactive) - (ivy-set-index (max (- ivy--index ivy-height) + (ivy-set-index (max (1+ (- ivy--index ivy-height)) 0))) (defun ivy-minibuffer-grow ()
[elpa] master 47f53b6 073/167: counsel.el (counsel--find-symbol): Resolve name clash better
branch: master commit 47f53b605abadccf19e3c6b55aef5360ae197249 Author: Oleh Krehel Commit: Oleh Krehel counsel.el (counsel--find-symbol): Resolve name clash better * counsel.el (counsel--find-symbol): When the symbol is both bound and fbound, prefer the fbound one, unless the :caller is `counsel-describe-variable'. (counsel-describe-variable): Declare :caller. (counsel-describe-function): Declare :caller. One example is going to the definition of `isearch-forward' (also with `counsel-M-x'). --- counsel.el | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/counsel.el b/counsel.el index ef67be9..eab1a3c 100644 --- a/counsel.el +++ b/counsel.el @@ -175,10 +175,14 @@ (if full-name (find-library full-name) (let ((sym (read x))) -(cond ((boundp sym) +(cond ((and (eq (ivy-state-caller ivy-last) +'counsel-describe-variable) +(boundp sym)) (find-variable sym)) ((fboundp sym) (find-function sym)) + ((boundp sym) + (find-variable sym)) ((or (featurep sym) (locate-library (prin1-to-string sym))) @@ -224,7 +228,8 @@ :sort t :action (lambda (x) (describe-variable -(intern x)) +(intern x))) + :caller 'counsel-describe-variable))) (ivy-set-actions 'counsel-describe-variable @@ -255,7 +260,8 @@ :sort t :action (lambda (x) (describe-function - (intern x)) + (intern x))) + :caller 'counsel-describe-function))) (defvar info-lookup-mode) (declare-function info-lookup->completions "info-look")
[elpa] master 5751119 124/167: README.md: Add more bindings
branch: master commit 5751119ec2a4610389bd01507dbe7d2beaeefc9a Author: Oleh Krehel Commit: Oleh Krehel README.md: Add more bindings --- README.md | 19 +-- 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d70eeaf..0d80f8d 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,18 @@ Here is some typical configuration: (ivy-mode 1) (setq ivy-use-virtual-buffers t) (global-set-key "\C-s" 'swiper) -(global-set-key "\C-r" 'swiper) (global-set-key (kbd "C-c C-r") 'ivy-resume) -(global-set-key [f6] 'ivy-resume) +(global-set-key (kbd "") 'ivy-resume) +(global-set-key (kbd "M-x") 'counsel-M-x) +(global-set-key (kbd "C-x C-f") 'counsel-find-file) +(global-set-key (kbd " f") 'counsel-describe-function) +(global-set-key (kbd " v") 'counsel-describe-variable) +(global-set-key (kbd " l") 'counsel-load-library) +(global-set-key (kbd " i") 'counsel-info-lookup-symbol) +(global-set-key (kbd " u") 'counsel-unicode-char) +(global-set-key (kbd "C-c g") 'counsel-git) +(global-set-key (kbd "C-c j") 'counsel-git-grep) +(global-set-key (kbd "C-c k") 'counsel-ag) +(global-set-key (kbd "C-x l") 'counsel-locate) +(global-set-key (kbd "C-S-o") 'counsel-rhythmbox) ``` - -## Issues - -Recently, the `ivy` package that provided `ivy.el` was removed from MELPA. Now, the `swiper` package provides `ivy.el`. You should remove the outdated `ivy` package from your system.
[elpa] master d89abf2 104/167: counsel.el (counsel--find-symbol): Silence byte compiler
branch: master commit d89abf274a68d50f8eeb671f4767c561dd7d274d Author: Oleh Krehel Commit: Oleh Krehel counsel.el (counsel--find-symbol): Silence byte compiler --- counsel.el |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/counsel.el b/counsel.el index 9ed334a..8bfcbdc 100644 --- a/counsel.el +++ b/counsel.el @@ -170,7 +170,8 @@ (defun counsel--find-symbol (x) "Find symbol definition that corresponds to string X." - (ring-insert find-tag-marker-ring (point-marker)) + (with-no-warnings +(ring-insert find-tag-marker-ring (point-marker))) (let ((full-name (get-text-property 0 'full-name x))) (if full-name (find-library full-name)
[elpa] master b948987 095/167: Input "/sudo::" goes to current directory instead of root's home
branch: master commit b9489873ece5ce0f08da91fa273d26ed2c400cba Author: Oleh Krehel Commit: Oleh Krehel Input "/sudo::" goes to current directory instead of root's home * ivy.el (ivy-alt-done): Update. Re #283 --- ivy.el |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/ivy.el b/ivy.el index 2457f3d..b7a238a 100644 --- a/ivy.el +++ b/ivy.el @@ -384,6 +384,11 @@ When ARG is t, exit with current text, ignoring the candidates." (cond (arg (ivy-immediate-done)) ((and ivy--directory +(equal ivy-text "/sudo::")) + (setq dir (concat ivy-text ivy--directory)) + (ivy--cd dir) + (ivy--exhibit)) + ((and ivy--directory (or (and (not (equal ivy-text ""))
[elpa] master adac116 126/167: Make ivy-completing-read handle history as cons
branch: master commit adac116cd79d26585263b90c4559fef8177c4a1c Author: Samuel Loury Commit: Oleh Krehel Make ivy-completing-read handle history as cons The ivy-read function assumes that history is a symbol, hence ivy-completing-read now makes sure that a symbol is given to ivy-read. Moreover, it makes sure that the value of initial-input is coherent with the value of the HISTPOS part of the history variable if it exists. Fixes #295 --- ivy.el |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/ivy.el b/ivy.el index 92b87fd..fe2d125 100644 --- a/ivy.el +++ b/ivy.el @@ -1238,6 +1238,12 @@ DEF is the default value. _INHERIT-INPUT-METHOD is ignored for now. The history, defaults and input-method arguments are ignored for now." + ;; See the doc of `completing-read'. + (when (consp history) +(when (numberp (cdr history)) + (setq initial-input (nth (cdr history) + (symbol-value (car history) +(setq history (car history))) (ivy-read (replace-regexp-in-string "%" "%%" prompt) collection :predicate predicate
[elpa] master c4c1878 121/167: Fix swiper preselect issue with similar or identical lines
branch: master commit c4c1878580eddb229cae98b7d02b5804c9bcc330 Author: Oleh Krehel Commit: Oleh Krehel Fix swiper preselect issue with similar or identical lines * ivy.el (ivy--preselect-index): Allow PRESELECT to be an integer. * swiper.el (swiper--anchor): (swiper--len): Remove unused defvar. (swiper--init): Update. (swiper--ivy): Set PRESELECT to `line-number-at-pos'. Fixes #290 --- ivy.el| 16 +--- swiper.el | 43 +++ 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/ivy.el b/ivy.el index bf89836..92b87fd 100644 --- a/ivy.el +++ b/ivy.el @@ -1293,13 +1293,15 @@ When MATCHER is non-nil it's used instead of `cl-remove-if-not'." candidates (when matcher (setq candidates (funcall matcher "" candidates - (or (cl-position preselect candidates :test #'equal) - (and (stringp preselect) - (let ((re (regexp-quote preselect))) - (cl-position-if - (lambda (x) -(string-match re x)) - candidates) + (cond ((integerp preselect) + preselect) +((cl-position preselect candidates :test #'equal)) +((stringp preselect) + (let ((re (regexp-quote preselect))) + (cl-position-if +(lambda (x) + (string-match re x)) +candidates) ;;* Implementation ;;** Regex diff --git a/swiper.el b/swiper.el index 56247ed..eec7434 100644 --- a/swiper.el +++ b/swiper.el @@ -298,19 +298,11 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (interactive) (swiper--ivy initial-input)) -(defvar swiper--anchor nil - "A line number to which the search should be anchored.") - -(defvar swiper--len 0 - "The last length of input for which an anchoring was made.") - (declare-function evil-jumper--set-jump "ext:evil-jumper") (defun swiper--init () "Perform initialization common to both completion methods." (setq swiper--opoint (point)) - (setq swiper--len 0) - (setq swiper--anchor (line-number-at-pos)) (when (bound-and-true-p evil-jumper-mode) (evil-jumper--set-jump))) @@ -348,24 +340,27 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (setq swiper-invocation-face (plist-get (text-properties-at (point)) 'face)) (let ((candidates (swiper--candidates)) -(preselect (buffer-substring-no-properties -(line-beginning-position) -(line-end-position))) +(preselect + (if (bound-and-true-p visual-line-mode) + (concat " " (buffer-substring-no-properties + (line-beginning-position) + (line-end-position))) + (1- (line-number-at-pos (minibuffer-allow-text-properties t)) (unwind-protect -(ivy-read - "Swiper: " - candidates - :initial-input initial-input - :keymap swiper-map - :preselect preselect - :require-match t - :update-fn #'swiper--update-input-ivy - :unwind #'swiper--cleanup - :action #'swiper--action - :re-builder #'swiper--re-builder - :history 'swiper-history - :caller 'swiper) + (ivy-read + "Swiper: " + candidates + :initial-input initial-input + :keymap swiper-map + :preselect preselect + :require-match t + :update-fn #'swiper--update-input-ivy + :unwind #'swiper--cleanup + :action #'swiper--action + :re-builder #'swiper--re-builder + :history 'swiper-history + :caller 'swiper) (when (null ivy-exit) (goto-char swiper--opoint)
[elpa] master c4562e0 109/167: swiper.el (swiper-font-lock-ensure): Add occur-mode
branch: master commit c4562e0bb9e14f9b6bd764290aa31e65b311f26b Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper-font-lock-ensure): Add occur-mode --- swiper.el |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/swiper.el b/swiper.el index 2fe3ef7..c99bda0 100644 --- a/swiper.el +++ b/swiper.el @@ -225,6 +225,9 @@ mu4e-headers-mode help-mode debbugs-gnu-mode + occur-mode + occur-edit-mode + bongo-mode w3m-mode))) (unless (> (buffer-size) 10) (if (fboundp 'font-lock-ensure)
[elpa] master 4544c69 105/167: ivy.el (ivy-dispatching-done): Don't set action permanently
branch: master commit 4544c6975c13abadd4012ca5e2d71fd4f9a8330c Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-dispatching-done): Don't set action permanently --- ivy.el |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ivy.el b/ivy.el index b117617..227ac3f 100644 --- a/ivy.el +++ b/ivy.el @@ -360,9 +360,10 @@ When non-nil, it should contain one %d.") "Select one of the available actions and call `ivy-call'." (interactive) (let ((actions (copy-sequence (ivy-state-action ivy-last -(ivy-read-action) -(ivy-call) -(ivy-set-action actions))) +(unwind-protect + (when (ivy-read-action) + (ivy-call)) + (ivy-set-action actions (defun ivy-build-tramp-name (x) "Reconstruct X into a path.
[elpa] master ed2367b 134/167: swiper.el (swiper--candidates): Require outline
branch: master commit ed2367b58587abaa1f97d4ccd94bd99c5abe9186 Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper--candidates): Require outline Fixes #297 --- swiper.el |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/swiper.el b/swiper.el index 68f6e32..e1f3d91 100644 --- a/swiper.el +++ b/swiper.el @@ -254,6 +254,7 @@ count." (< (buffer-size) 2)) (progn (when (eq major-mode 'org-mode) + (require 'outline) (outline-show-all)) (setq swiper-use-visual-line t)) (setq swiper-use-visual-line nil))
[elpa] master bb68b67 122/167: Intermediate fix for :preselect with visual-line-mode
branch: master commit bb68b67b2bc6f95ddf667e4c34eb2902bcbf604b Author: Oleh Krehel Commit: Oleh Krehel Intermediate fix for :preselect with visual-line-mode * swiper.el (swiper--ivy): Use `beginning-of-visual-line' and `end-of-visual-line'. This should fix the preselect problem for non-duplicate buffer lines. For duplicate buffer lines, a `visual-line-number-at-pos' function is necessary. I don't currently know how to implement such a function in an efficient way. The naive implementation could be pretty inefficient, comparable to doubling `swiper' startup time with `visual-line-mode'. Re #291 --- swiper.el |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/swiper.el b/swiper.el index eec7434..b9722d4 100644 --- a/swiper.el +++ b/swiper.el @@ -343,8 +343,8 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (preselect (if (bound-and-true-p visual-line-mode) (concat " " (buffer-substring-no-properties - (line-beginning-position) - (line-end-position))) + (save-excursion (beginning-of-visual-line) (point)) + (save-excursion (end-of-visual-line) (point (1- (line-number-at-pos (minibuffer-allow-text-properties t)) (unwind-protect
[elpa] master 607fd1f 061/167: Bring back the lost perfect match logic
branch: master commit 607fd1f6bed0dfd5bdfe65ee11f33fa8aac683d2 Author: Oleh Krehel Commit: Oleh Krehel Bring back the lost perfect match logic * ivy.el (ivy--recompute-index): Don't defer the perfect match logic to `ivy-index-functions-alist'. (ivy-recompute-index-swiper): Simplify. Once again, if the minibuffer text becomes `equal' to one of the candidates, that candidate will be selected. Fixes #270 --- ivy.el | 46 +++--- 1 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ivy.el b/ivy.el index f985ef7..1cbaaf7 100644 --- a/ivy.el +++ b/ivy.el @@ -1657,13 +1657,24 @@ CANDIDATES are assumed to be static." (cdr (assoc t ivy-index-functions-alist)) #'ivy-recompute-index-zero))) (setq ivy--index - (or (and (not (string= name "")) - (not (and (require 'flx nil 'noerror) - (eq ivy--regex-function 'ivy--regex-fuzzy) - (< (length cands) 200))) - (cl-position (nth ivy--index ivy--old-cands) -cands)) - (funcall func re-str cands))) + (or + (cl-position (if (and (> (length re-str) 0) + (eq ?^ (aref re-str 0))) +(substring re-str 1) + re-str) cands + :test #'equal) + (and ivy--directory +(cl-position + (concat re-str "/") cands + :test #'equal)) + (and (not (string= name "")) +(not (and (require 'flx nil 'noerror) + (eq ivy--regex-function 'ivy--regex-fuzzy) + (< (length cands) 200))) + +(cl-position (nth ivy--index ivy--old-cands) + cands)) + (funcall func re-str cands))) (when (and (or (string= name "") (string= name "^")) (not (equal ivy--old-re ""))) @@ -1679,22 +1690,11 @@ CANDIDATES are assumed to be static." (let ((tail (nthcdr ivy--index ivy--old-cands)) idx) (if (and tail ivy--old-cands (not (equal "^" ivy--old-re))) -(or (and (not (equal re-str ivy--old-re)) - (or - (cl-position (if (and (> (length re-str) 0) -(eq ?^ (aref re-str 0))) - (substring re-str 1) - re-str) cands - :test #'equal) - (and ivy--directory - (cl-position -(concat re-str "/") cands -:test #'equal -(progn - (while (and tail (null idx)) -;; Compare with eq to handle equal duplicates in cands -(setq idx (cl-position (pop tail) cands))) - (or idx 0))) +(progn + (while (and tail (null idx)) +;; Compare with eq to handle equal duplicates in cands +(setq idx (cl-position (pop tail) cands))) + (or idx 0)) ivy--index))) (defun ivy-recompute-index-zero (_re-str _cands)
[elpa] master 7cf7575 103/167: swiper.el (swiper-toggle-face-matching): Add and bind to "C-c C-f"
branch: master commit 7cf75750e90f9bb5ad4c61c863330a5f395b80d2 Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper-toggle-face-matching): Add and bind to "C-c C-f" * swiper.el (swiper-map): Bind `swiper-toggle-face-matching' to "C-c C-f". (swiper-invocation-face): New defvar. (swiper--ivy): Set `swiper-invocation-face'. (swiper-toggle-face-matching): Toggle `ivy-state-matcher' between nil (the initial value) and 'swiper--face-matcher. (swiper--face-matcher): New defun. In addition to filtering CANDIDATES by having them match REGEXP, also ensure that every match has `swiper-invocation-face'. Example of usage: 1. Move point to a variable with e.g. `font-lock-keyword-face' and "C-s" . 2. Use "C-c C-f" to filter the candidates further by selecting only the ones that have `font-lock-keyword-face'. Note that "M-q" (`swiper-query-replace') is also affected by the filtering. 3. Use "C-c C-f" to toggle the filtering off. Fixes #288 --- swiper.el | 33 + 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/swiper.el b/swiper.el index d1bf5de..2fe3ef7 100644 --- a/swiper.el +++ b/swiper.el @@ -93,6 +93,7 @@ (define-key map (kbd "C-l") 'swiper-recenter-top-bottom) (define-key map (kbd "C-'") 'swiper-avy) (define-key map (kbd "C-7") 'swiper-mc) +(define-key map (kbd "C-c C-f") 'swiper-toggle-face-matching) map) "Keymap for swiper.") @@ -319,11 +320,16 @@ there have line numbers. In the buffer, `ivy--regex' should be used." (defvar swiper-history nil "History for `swiper'.") +(defvar swiper-invocation-face nil + "The face at the point of invocation of `swiper'.") + (defun swiper--ivy (&optional initial-input) "`isearch' with an overview using `ivy'. When non-nil, INITIAL-INPUT is the initial search pattern." (interactive) (swiper--init) + (setq swiper-invocation-face +(plist-get (text-properties-at (point)) 'face)) (let ((candidates (swiper--candidates)) (preselect (buffer-substring-no-properties (line-beginning-position) @@ -346,6 +352,33 @@ When non-nil, INITIAL-INPUT is the initial search pattern." (when (null ivy-exit) (goto-char swiper--opoint) +(defun swiper-toggle-face-matching () + "Toggle matching only the candidates with `swiper-invocation-face'." + (interactive) + (setf (ivy-state-matcher ivy-last) +(if (ivy-state-matcher ivy-last) +nil + #'swiper--face-matcher)) + (setq ivy--old-re nil)) + +(defun swiper--face-matcher (regexp candidates) + "Return REGEXP-matching CANDIDATES. +Matched candidates should have `swiper-invocation-face'." + (cl-remove-if-not + (lambda (x) + (and + (string-match regexp x) + (let ((s (match-string 0 x)) +(i 0)) +(while (and (< i (length s)) +(text-property-any + i (1+ i) + 'face swiper-invocation-face + s)) + (cl-incf i)) +(eq i (length s) + candidates)) + (defun swiper--ensure-visible () "Remove overlays hiding point." (let ((overlays (overlays-at (point)))
[elpa] master d434071 120/167: swiper.el (swiper-all): New command to swiper all file buffers
branch: master commit d434071ff4ba1034751c4b2462720bb28cdb7018 Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper-all): New command to swiper all file buffers * swiper.el (swiper--candidates): Add NUMBERS-WIDTH arg. It could be done better by calculating the line count of each buffer and then getting the max of that, but this way is faster, since the collections are traversed only once. (swiper-multi): Update. (swiper-all): New command. This is like `swiper-multi' where the buffer list is pre-selected to be all file visiting buffers. (swiper--multi-candidates): New defun. (swiper-multi-action-1): Use `swiper--multi-candidates'. (swiper-multi-action-2): Update - the line number is in the 'display property of the first char. Re #234 --- swiper.el | 84 +++- 1 files changed, 54 insertions(+), 30 deletions(-) diff --git a/swiper.el b/swiper.el index 15d5478..56247ed 100644 --- a/swiper.el +++ b/swiper.el @@ -244,15 +244,20 @@ (defvar swiper-use-visual-line nil "When non-nil, use `line-move' instead of `forward-line'.") -(defun swiper--candidates () - "Return a list of this buffer lines." +(defun swiper--candidates (&optional numbers-width) + "Return a list of this buffer lines. + +NUMBERS-WIDTH, when specified, is used for line numbers width +spec, instead of calculating it as the log of the buffer line +count." (setq swiper-use-visual-line (and (not (eq major-mode 'org-mode)) visual-line-mode (< (buffer-size) 2))) (let ((n-lines (count-lines (point-min) (point-max (unless (zerop n-lines) - (setq swiper--width (1+ (floor (log n-lines 10 + (setq swiper--width (or numbers-width + (1+ (floor (log n-lines 10) (setq swiper--format-spec (format "%%-%dd " swiper--width)) (let ((line-number 0) @@ -537,7 +542,6 @@ WND, when specified is the window." Run `swiper' for those buffers." (interactive) (setq swiper-multi-buffers nil) - (setq swiper-multi-candidates nil) (ivy-read (swiper-multi-prompt) 'internal-complete-buffer :action 'swiper-multi-action-1) @@ -546,6 +550,48 @@ Run `swiper' for those buffers." :unwind #'swiper--cleanup :caller 'swiper-multi)) +(defun swiper-all () + "Run `swiper' for all opened buffers." + (interactive) + (ivy-read "Swiper: " (swiper--multi-candidates +(cl-remove-if-not + #'buffer-file-name + (buffer-list))) +:action 'swiper-multi-action-2 +:unwind #'swiper--cleanup +:caller 'swiper-multi)) + +(defun swiper--multi-candidates (buffers) + (let* ((ww (window-width)) + (res nil) + (column-2 (apply #'max + (mapcar + (lambda (b) + (length (buffer-name b))) + buffers))) + (column-1 (- ww 4 column-2 1))) +(dolist (buf buffers) + (with-current-buffer buf +(setq res + (append + (mapcar +(lambda (s) + (setq s (concat (ivy--truncate-string s column-1) " ")) + (let ((len (length s))) +(put-text-property + (1- len) len 'display + (concat + (make-string + (- ww (string-width s) (length (buffer-name)) 3) + ?\ ) + (buffer-name)) + s) +s)) +(swiper--candidates 4)) + res)) +nil)) +res)) + (defun swiper-multi-action-1 (x) (if (member x swiper-multi-buffers) (progn @@ -558,31 +604,9 @@ Run `swiper' for those buffers." (cond ((memq this-command '(ivy-done ivy-alt-done ivy-immediate-done)) - (let ((ww (window-width))) - (dolist (buf swiper-multi-buffers) - (with-current-buffer buf - (setq swiper-multi-candidates - (append - (mapcar - (lambda (s) - (setq s (concat s " ")) - (let ((len (length s))) - (put-text-property -(1- len) len 'display -(concat - (make-string - (max - (- ww - (string-width s) - (length (buffer-name)) - 1) - 0) - ?\ ) - (buffer-name)) -
[elpa] master ce557d1 119/167: swiper.el (swiper--candidates): Replace "\t" with " "
branch: master commit ce557d1ec13844b4d901379404468718376ae784 Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper--candidates): Replace "\t" with "" This will allow the minibuffer strings to align nicer for `swiper-multi'. --- swiper.el | 18 +++--- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/swiper.el b/swiper.el index 7d2741a..15d5478 100644 --- a/swiper.el +++ b/swiper.el @@ -264,13 +264,17 @@ (goto-char (point-min)) (swiper-font-lock-ensure) (while (< (point) (point-max)) -(let ((str (concat " " (buffer-substring -(point) -(if swiper-use-visual-line -(save-excursion - (end-of-visual-line) - (point)) - (line-end-position)) +(let ((str (concat +" " +(replace-regexp-in-string + "\t" "" + (buffer-substring + (point) + (if swiper-use-visual-line + (save-excursion +(end-of-visual-line) +(point)) +(line-end-position))) (put-text-property 0 1 'display (format swiper--format-spec (cl-incf line-number))
[elpa] master 6b612cf 093/167: Rebind ivy-occur to "C-c C-o" and "C-o u"
branch: master commit 6b612cf5c4a31ae336aa4589175f4708b96be1d2 Author: Oleh Krehel Commit: Oleh Krehel Rebind ivy-occur to "C-c C-o" and "C-o u" * ivy.el (ivy-minibuffer-map): Update. * ivy-hydra.el (hydra-ivy): Update. Wouldn't want to violate the "C-c LETTER" convention. --- ivy-hydra.el | 13 +++-- ivy.el |2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ivy-hydra.el b/ivy-hydra.el index 19deabb..63755da 100644 --- a/ivy-hydra.el +++ b/ivy-hydra.el @@ -53,11 +53,11 @@ (defhydra hydra-ivy (:hint nil :color pink) " -^^ ^Yes^ ^No^ ^Maybe^ ^^^Action^ ^ -^^^--- -^ ^ _k_ ^ ^ _f_ollow _i_nsert _c_: calling %-5s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %-14s(ivy-action-name) -_h_ ^+^ _l_ _d_one_o_ops _m_: matcher %-5s(ivy--matcher-desc) _C_ase-fold: %-10`ivy-case-fold-search -^ ^ _j_ ^ ^ _g_o ^ ^ _<_/_>_: shrink/grow _t_runcate: %-11`truncate-lines +^^ ^Yes^^^ ^No^ ^Maybe^ ^^^Action^ ^ +^^^--^--- +^ ^ _k_ ^ ^ _f_ollow occ_u_r _i_nsert _c_: calling %-5s(if ivy-calling \"on\" \"off\") _w_/_s_/_a_: %-14s(ivy-action-name) +_h_ ^+^ _l_ _d_one ^ ^ _o_ops _m_: matcher %-5s(ivy--matcher-desc) _C_ase-fold: %-10`ivy-case-fold-search +^ ^ _j_ ^ ^ _g_o^ ^ ^ ^ _<_/_>_: shrink/grow _t_runcate: %-11`truncate-lines " ;; arrows ("h" ivy-beginning-of-buffer) @@ -82,7 +82,8 @@ _h_ ^+^ _l_ _d_one_o_ops _m_: matcher %-5s(ivy--matcher-desc)^ ("s" ivy-next-action) ("a" ivy-read-action) ("t" (setq truncate-lines (not truncate-lines))) - ("C" ivy-toggle-case-fold)) + ("C" ivy-toggle-case-fold) + ("u" ivy-occur :exit t)) (provide 'ivy-hydra) diff --git a/ivy.el b/ivy.el index f5dbd94..73d2f8a 100644 --- a/ivy.el +++ b/ivy.el @@ -171,7 +171,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse order." (define-key map (kbd "M-w") 'ivy-kill-ring-save) (define-key map (kbd "C-'") 'ivy-avy) (define-key map (kbd "C-M-a") 'ivy-read-action) -(define-key map (kbd "C-c o") 'ivy-occur) +(define-key map (kbd "C-c C-o") 'ivy-occur) map) "Keymap used in the minibuffer.") (autoload 'hydra-ivy/body "ivy-hydra" "" t)
[elpa] master 1af25f6 067/167: swiper.el (swiper-font-lock-ensure): Amend exception list
branch: master commit 1af25f6224c5e781d7f3f31cd5d8a884ee6645a9 Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper-font-lock-ensure): Amend exception list Re #19 --- swiper.el |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/swiper.el b/swiper.el index 4cd0bfc..8793502 100644 --- a/swiper.el +++ b/swiper.el @@ -231,12 +231,14 @@ dired-mode jabber-chat-mode elfeed-search-mode + elfeed-show-mode fundamental-mode Man-mode woman-mode mu4e-view-mode mu4e-headers-mode - help-mode))) + help-mode + w3m-mode))) (unless (> (buffer-size) 10) (if (fboundp 'font-lock-ensure) (font-lock-ensure)
[elpa] master d5489af 100/167: doc/ivy.org: Start writing a manual
branch: master commit d5489afdd2713e9bbe30c7025460a3aa761b42c6 Author: Oleh Krehel Commit: Oleh Krehel doc/ivy.org: Start writing a manual --- doc/ivy.org | 421 doc/ivy.texi | 542 + doc/style.css | 107 +++ 3 files changed, 1070 insertions(+), 0 deletions(-) diff --git a/doc/ivy.org b/doc/ivy.org new file mode 100644 index 000..a0e8fdd --- /dev/null +++ b/doc/ivy.org @@ -0,0 +1,421 @@ +#+TITLE: Ivy User Manual +#+AUTHOR: Oleh Krehel +#+EMAIL: ohwoeo...@gmail.com +#+DATE: 2015 +#+LANGUAGE: en + +#+TEXINFO_DIR_CATEGORY: Emacs +#+TEXINFO_DIR_TITLE: Ivy: (ivy). +#+TEXINFO_DIR_DESC: Using Ivy for completion. +#+HTML_HEAD: + +#+OPTIONS: H:4 num:3 toc:2 +#+STARTUP: indent + +* Copying +:PROPERTIES: +:COPYING: t +:END: + +#+BEGIN_TEXINFO +@ifnottex +This manual is for Ivy version 0.7.0. + +Ivy is a completion interface for Emacs. When @code{ivy-mode} is active, +any time another Elisp code requires completion you'll be able to +preview the candidates in the minibuffer and select them with both +simple input and powerful regexps. +@end ifnottex + +Copyright @copyright{} 2015 Free Software Foundation, Inc. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,'' +and with the Back-Cover Texts as in (a) below. A copy of the license +is included in the section entitled ``GNU Free Documentation License.'' + +(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and +modify this GNU manual.'' +@end quotation +#+END_TEXINFO + +* Introduction +Any time Emacs prompts you for a string, with several choices, Ivy +allows you to preview and quickly select among these choices. + +The key aspects of Ivy are minimalism, simplicity, customizability and +being discoverable. + +#+BEGIN_TEXINFO +@subsubheading Minimalism +#+END_TEXINFO +Only the minimal necessary amount of information is +displayed in the minibuffer. Compared to the default completion, +additionally the current number of matches is displayed before the +prompt, and a few candidates are displayed below the input. You can +customize =ivy-length= to adjust the amount of displayed candidates, +it's 10 by default. + +#+BEGIN_TEXINFO +@subsubheading Simplicity +#+END_TEXINFO +The minibuffer area should behave as a +=fundamental-mode= buffer as much as possible. For example, unlike the +default completion, ~SPC~ simply inserts a space, instead of being +bound to =minibuffer-complete-word=. Additionally Ivy aims to have +simple to understand code: everything is stored in easy to examine +global variables, and no branch-introducing custom macros are used. + +#+BEGIN_TEXINFO +@subsubheading Customizability +#+END_TEXINFO +Ideally, you should be able to customize your completion session as +much as possible, with different settings for different completions, +if you so prefer. For example, you can add your own display function +to that points to a selected candidate with =->=, instead of +highlighting it with the =ivy-current-match= face. It's also possible +to customize many commands to do different things with the selected +candidate. For example, when describing functions with +=counsel-decribe-function=, you describe the candidate with ~RET~, but +can also jump to definition with ~M-o d~. While the ~M-o~ prefix isn't +normally customized, you can bind any following key like ~d~ to do +anything to the selected candidate. This way, it's possible to group +several functions into one through the completion interface. + +#+BEGIN_TEXINFO +@subsubheading Discoverability +#+END_TEXINFO +While in the minibuffer, you can press ~C-o~ to call +=hydra-ivy/body=. This will expose a large amount of commands +available in the minibuffer, all annotated with short docstrings. + +* Installation + +Ivy can be installed using Emacs' package manager or manually from its +development repository. + +** Installing from ELPA +If you haven't used Emacs' package manager before, you can read about +it in the Emacs manual, see [[info:emacs#Packages]]. + +Ivy is available from both GNU ELPA - the official Emacs package +repository, and from MELPA - the most popular unofficial Emacs package +repository. + +Your Emacs should be configured to use GNU ELPA automatically. To +also add MELPA, use this code: + +#+begin_src elisp +(require 'package) +(add-to-list 'package-archives + '("melpa" . "http://melpa.org/packages/";) t) +#+end_src + +After this do ~M-x~ =package-refresh-contents= ~RET~, followed by +~M-x~ =package-install= ~RET~ =swiper= ~RET~. + +There's a version difference between GELPA and MELPA. GELPA holds the +latest stable version, while MELPA contains current hourly builds. + +** Installing from the Git r
[elpa] master dc84ba3 070/167: Rename and move the minibuffer faces
branch: master commit dc84ba356c43f6aee0e3edfa900abbefa2cb4e31 Author: Oleh Krehel Commit: Oleh Krehel Rename and move the minibuffer faces * swiper.el (swiper-minibuffer-match-face-1): (swiper-minibuffer-match-face-2): (swiper-minibuffer-match-face-3): (swiper-minibuffer-match-face-4): Transform into obsolete aliases. * ivy.el (ivy-minibuffer-match-face-1): (ivy-minibuffer-match-face-2): (ivy-minibuffer-match-face-3): (ivy-minibuffer-match-face-4): New renamed faces. (ivy-minibuffer-faces): Rename from `swiper-minibuffer-faces'. Fixes #276 --- ivy.el| 48 ++-- swiper.el | 41 - 2 files changed, 50 insertions(+), 39 deletions(-) diff --git a/ivy.el b/ivy.el index b6715c9..3ae9abc 100644 --- a/ivy.el +++ b/ivy.el @@ -1762,12 +1762,40 @@ This string will be inserted into the minibuffer.") s)) cands "\n"))) -(defcustom swiper-minibuffer-faces - '(swiper-minibuffer-match-face-1 -swiper-minibuffer-match-face-2 -swiper-minibuffer-match-face-3 -swiper-minibuffer-match-face-4) - "List of `swiper' faces for minibuffer group matches.") +(defface ivy-minibuffer-match-face-1 + 'class color) (background light)) + :background "#d3d3d3") +(((class color) (background dark)) + :background "#55")) + "The background face for `ivy' minibuffer matches.") + +(defface ivy-minibuffer-match-face-2 + 'class color) (background light)) + :background "#e99ce8" :weight bold) +(((class color) (background dark)) + :background "#77" :weight bold)) + "Face for `ivy' minibuffer matches modulo 1.") + +(defface ivy-minibuffer-match-face-3 + 'class color) (background light)) + :background "#ff" :weight bold) +(((class color) (background dark)) + :background "#ff" :weight bold)) + "Face for `ivy' minibuffer matches modulo 2.") + +(defface ivy-minibuffer-match-face-4 + 'class color) (background light)) + :background "#ffbbff" :weight bold) +(((class color) (background dark)) + :background "#8a498a" :weight bold)) + "Face for `ivy' minibuffer matches modulo 3.") + +(defcustom ivy-minibuffer-faces + '(ivy-minibuffer-match-face-1 +ivy-minibuffer-match-face-2 +ivy-minibuffer-match-face-3 +ivy-minibuffer-match-face-4) + "List of `ivy' faces for minibuffer group matches.") (defun ivy--format-minibuffer-line (str) (let ((start 0) @@ -1782,12 +1810,12 @@ This string will be inserted into the minibuffer.") (while (<= i ivy--subexps) (let ((face (cond ((zerop ivy--subexps) - (cadr swiper-minibuffer-faces)) + (cadr ivy-minibuffer-faces)) ((zerop i) - (car swiper-minibuffer-faces)) + (car ivy-minibuffer-faces)) (t - (nth (1+ (mod (+ i 2) (1- (length swiper-minibuffer-faces - swiper-minibuffer-faces) + (nth (1+ (mod (+ i 2) (1- (length ivy-minibuffer-faces + ivy-minibuffer-faces) (if (fboundp 'add-face-text-property) (add-face-text-property (match-beginning i) diff --git a/swiper.el b/swiper.el index 8793502..607108c 100644 --- a/swiper.el +++ b/swiper.el @@ -4,7 +4,7 @@ ;; Author: Oleh Krehel ;; URL: https://github.com/abo-abo/swiper -;; Version: 0.5.1 +;; Version: 0.6.0 ;; Package-Requires: ((emacs "24.1")) ;; Keywords: matching @@ -61,34 +61,17 @@ '((t (:inherit isearch-fail))) "Face for `swiper' matches modulo 3.") -(defface swiper-minibuffer-match-face-1 - 'class color) (background light)) - :background "#d3d3d3") -(((class color) (background dark)) - :background "#55")) - "The background face for `swiper' minibuffer matches." - :group 'function-args-faces) - -(defface swiper-minibuffer-match-face-2 - 'class color) (background light)) - :background "#e99ce8" :weight bold) -(((class color) (background dark)) - :background "#77" :weight bold)) - "Face for `swiper' minibuffer matches modulo 1.") - -(defface swiper-minibuffer-match-face-3 - 'class color) (background light)) - :background "#ff" :weight bold) -(((class color) (background dark)) - :background "#ff" :weight bold)) - "Face for `swiper' minibuffer matches modulo 2.") - -(defface swiper-minibuffer-match-face-4 - 'class color) (background light)) - :background "#ffbbff" :weight bold) -(((class color) (background dark)) - :background "#8a498a" :weight bold)) - "Face for `swiper' minibuffer matches modulo 3.") +(define-obsolete-face-alias 'swiper-minibuffer-match-face-1 +'ivy-minibuffer-match-face-1 "0.6.0") + +(define-obsole
[elpa] master 16ccb0f 084/167: swiper.el (swiper-font-lock-ensure): Exclude debbugs-gnu-mode
branch: master commit 16ccb0f2e6d04905056c5101cd449e2fe4d4f512 Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper-font-lock-ensure): Exclude debbugs-gnu-mode --- swiper.el |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/swiper.el b/swiper.el index ffbdea0..595ed43 100644 --- a/swiper.el +++ b/swiper.el @@ -223,6 +223,7 @@ mu4e-view-mode mu4e-headers-mode help-mode + debbugs-gnu-mode w3m-mode))) (unless (> (buffer-size) 10) (if (fboundp 'font-lock-ensure)
[elpa] master a11c978 068/167: ivy-immediate-done should use ivy--directory
branch: master commit a11c978648b60246fa82ba305c625a2872b10887 Author: Oleh Krehel Commit: Oleh Krehel ivy-immediate-done should use ivy--directory * ivy.el (ivy-immediate-done): When completing file names, expand the file name properly. Fixes #275 --- ivy.el |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 24bc824..b6715c9 100644 --- a/ivy.el +++ b/ivy.el @@ -480,7 +480,10 @@ If the text hasn't changed as a result, forward to `ivy-alt-done'." "Exit the minibuffer with the current input." (interactive) (delete-minibuffer-contents) - (insert (setq ivy--current ivy-text)) + (insert (setq ivy--current +(if ivy--directory +(expand-file-name ivy-text ivy--directory) + ivy-text))) (setq ivy-exit 'done) (exit-minibuffer))
[elpa] master 5d90542 112/167: ivy.el (ivy-sort-functions-alist): Update doc
branch: master commit 5d90542e6fa73a7a6f9fb4bd3db67549d7434971 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-sort-functions-alist): Update doc Mention `ivy-sort-max-size'. --- ivy.el |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 7561822..929b71d 100644 --- a/ivy.el +++ b/ivy.el @@ -911,7 +911,9 @@ 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'. -The entry associated to t is used for all fall-through cases." +The entry associated to t is used for all fall-through cases. + +See also `ivy-sort-max-size'." :type '(alist :key-type (choice
[elpa] master 2797a9b 090/167: ivy.el (ivy-minibuffer-map): Bind "C-M-a" to ivy-read-action
branch: master commit 2797a9b91acf1d0e7c45e0a2aee6d49947d1ec33 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-minibuffer-map): Bind "C-M-a" to ivy-read-action --- ivy.el |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/ivy.el b/ivy.el index 9afc0f3..741a5a4 100644 --- a/ivy.el +++ b/ivy.el @@ -170,6 +170,7 @@ Only \"./\" and \"../\" apply here. They appear in reverse order." (define-key map (kbd "S-SPC") 'ivy-restrict-to-matches) (define-key map (kbd "M-w") 'ivy-kill-ring-save) (define-key map (kbd "C-'") 'ivy-avy) +(define-key map (kbd "C-M-a") 'ivy-read-action) (define-key map (kbd "C-c o") 'ivy-occur) map) "Keymap used in the minibuffer.")
[elpa] master f6dd9cd 066/167: ivy.el (ivy-alt-done): Fix up last commit
branch: master commit f6dd9cdff6f9dc6c16e2ee2990a797d45bb05b41 Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-alt-done): Fix up last commit --- ivy.el |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ivy.el b/ivy.el index 51721a5..24bc824 100644 --- a/ivy.el +++ b/ivy.el @@ -374,9 +374,11 @@ When ARG is t, exit with current text, ignoring the candidates." (ivy-immediate-done)) ((and ivy--directory (or - (and (file-directory-p ivy-text) - (setq dir (expand-file-name - ivy-text ivy--directory))) + (and + (not (equal ivy-text "")) + (file-directory-p ivy-text) + (setq dir (expand-file-name + ivy-text ivy--directory))) (and (not (string= ivy--current "./")) (cl-plusp ivy--length)
[elpa] master fa0d04c 038/167: Move setq ivy--index to ivy--recompute-index
branch: master commit fa0d04c6867f06096faef372d59cd4a5124fc261 Author: Oleh Krehel Commit: Oleh Krehel Move setq ivy--index to ivy--recompute-index * ivy.el (ivy--recompute-index): Move the setq statement here, so that the customization functions have less internal variables to deal with. (ivy-recompute-index-swiper): Update. (ivy-recompute-index-zero): Update. Re #253 --- ivy.el | 39 --- 1 files changed, 20 insertions(+), 19 deletions(-) diff --git a/ivy.el b/ivy.el index 232f228..7228acb 100644 --- a/ivy.el +++ b/ivy.el @@ -1612,7 +1612,7 @@ CANDIDATES are assumed to be static." (func (or (and caller (cdr (assoc caller ivy-index-functions-alist))) (cdr (assoc t ivy-index-functions-alist)) #'ivy-recompute-index-zero))) -(funcall func re-str cands) +(setq ivy--index (funcall func re-str cands)) (when (and (or (string= name "") (string= name "^")) (not (equal ivy--old-re ""))) @@ -1627,26 +1627,27 @@ CANDIDATES are assumed to be static." (defun ivy-recompute-index-swiper (re-str cands) (let ((tail (nthcdr ivy--index ivy--old-cands)) idx) -(when (and tail ivy--old-cands (not (equal "^" ivy--old-re))) - (unless (and (not (equal re-str ivy--old-re)) - (or (setq ivy--index - (or - (cl-position (if (and (> (length re-str) 0) -(eq ?^ (aref re-str 0))) - (substring re-str 1) - re-str) cands - :test #'equal) - (and ivy--directory - (cl-position -(concat re-str "/") cands -:test #'equal)) -(while (and tail (null idx)) - ;; Compare with eq to handle equal duplicates in cands - (setq idx (cl-position (pop tail) cands))) -(setq ivy--index (or idx 0)) +(if (and tail ivy--old-cands (not (equal "^" ivy--old-re))) +(or (and (not (equal re-str ivy--old-re)) + (or + (cl-position (if (and (> (length re-str) 0) +(eq ?^ (aref re-str 0))) + (substring re-str 1) + re-str) cands + :test #'equal) + (and ivy--directory + (cl-position +(concat re-str "/") cands +:test #'equal +(progn + (while (and tail (null idx)) +;; Compare with eq to handle equal duplicates in cands +(setq idx (cl-position (pop tail) cands))) + (or idx 0))) + ivy--index))) (defun ivy-recompute-index-zero (_re-str _cands) - (setq ivy--index 0)) + 0) (defun ivy--flx-sort (name cands) "Sort according to closeness to string NAME the string list CANDS."
[elpa] master 57800f6 110/167: swiper.el (swiper-font-lock-ensure): Add eww-mode
branch: master commit 57800f64706fe26150c49908e897e47bf71e8e31 Author: Oleh Krehel Commit: Oleh Krehel swiper.el (swiper-font-lock-ensure): Add eww-mode --- swiper.el |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/swiper.el b/swiper.el index c99bda0..e6145c0 100644 --- a/swiper.el +++ b/swiper.el @@ -228,6 +228,7 @@ occur-mode occur-edit-mode bongo-mode + eww-mode w3m-mode))) (unless (> (buffer-size) 10) (if (fboundp 'font-lock-ensure)
[elpa] master d8673f8 078/167: ivy.el (ffap): Move require
branch: master commit d8673f85baae047c27e268497f4ba65a06b2869f Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ffap): Move require --- ivy.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 6a900fb..4cde295 100644 --- a/ivy.el +++ b/ivy.el @@ -37,6 +37,7 @@ ;;; Code: (require 'cl-lib) +(require 'ffap) ;;* Customization (defgroup ivy nil @@ -693,7 +694,6 @@ Call the permanent action if possible." (defun ivy--cd-maybe () "Check if the current input points to a different directory. If so, move to that directory, while keeping only the file name." - (require 'ffap) (when ivy--directory (let ((input (ivy--input)) url)
[elpa] master b91870e 094/167: Fix /ssh: and /sudo:: broken in 71695df
branch: master commit b91870eb1c4861ad5ef7700caf5c45ec192d84df Author: Oleh Krehel Commit: Oleh Krehel Fix /ssh: and /sudo:: broken in 71695df * ivy.el (ivy-alt-done): `file-directory-p' errors when given "/ssh:" or "/sudo::". Re #283 --- ivy.el |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 73d2f8a..2457f3d 100644 --- a/ivy.el +++ b/ivy.el @@ -387,7 +387,8 @@ When ARG is t, exit with current text, ignoring the candidates." (or (and (not (equal ivy-text "")) - (file-directory-p ivy-text) + (ignore-errors +(file-directory-p ivy-text)) (setq dir (expand-file-name ivy-text ivy--directory))) (and
[elpa] master 32025e5 098/167: Add a better ivy-occur pulse to swiper and counsel-git-grep
branch: master commit 32025e51f86cb6dde03088e0bfea18d87f1f2cff Author: Oleh Krehel Commit: Oleh Krehel Add a better ivy-occur pulse to swiper and counsel-git-grep * ivy.el (ivy-occur-press): Bind `ivy-exit' to 'done, so that `swiper--add-overlays' called by ACTION don't do anything. Call another `swiper--add-overlays' for swiper and counsel-git-grep, limited to the current line. Call `swiper--cleanup' with a delay of 1 second. --- ivy.el | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ivy.el b/ivy.el index b7a238a..5aa109d 100644 --- a/ivy.el +++ b/ivy.el @@ -2148,14 +2148,24 @@ EVENT gives the mouse position." (+ 4 (line-beginning-position)) (line-end-position))) (coll (ivy-state-collection ivy-last)) - (action ivy-occur-action)) + (action ivy-occur-action) + (ivy-exit 'done)) (with-ivy-window (funcall action (if (and (consp coll) (consp (car coll))) (cdr (assoc str coll)) str)) - (pulse-momentary-highlight-one-line (point) + (if (memq (ivy-state-caller ivy-last) +'(swiper counsel-git-grep)) + (with-current-buffer (window-buffer (selected-window)) +(swiper--add-overlays + (ivy--regex ivy-text) + (line-beginning-position) + (line-end-position) + (selected-window)) +(run-at-time 1 nil 'swiper--cleanup)) +(pulse-momentary-highlight-one-line (point)) (defun ivy-insert-current () "Make the current candidate into current input.
[elpa] master 39e6733 129/167: Improve ivy TRAMP support
branch: master commit 39e6733cdd5d5a3b7aec12d14e4e6cb8a267346c Author: Stephen Whipple Commit: Stephen Whipple Improve ivy TRAMP support --- ivy.el | 33 ++--- 1 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ivy.el b/ivy.el index 9fd181a..01baeab 100644 --- a/ivy.el +++ b/ivy.el @@ -411,9 +411,11 @@ When ARG is t, exit with current text, ignoring the candidates." (and (not (string= ivy--current "./")) (cl-plusp ivy--length) - (file-directory-p - (setq dir (expand-file-name - ivy--current ivy--directory)) + (ignore-errors +(file-directory-p + (setq dir (file-name-as-directory +(expand-file-name + ivy--current ivy--directory (ivy--cd dir) (ivy--exhibit)) ((eq (ivy-state-collection ivy-last) 'Info-read-node-name-1) @@ -427,12 +429,18 @@ When ARG is t, exit with current text, ignoring the candidates." "Top" (ivy-done))) ((and ivy--directory -(string-match "\\`/[^/]+:.*:.*\\'" ivy-text)) +(or (and (equal ivy--directory "/") + (string-match "\\`[^/]+:.*:.*\\'" ivy-text)) +(string-match "\\`/[^/]+:.*:.*\\'" ivy-text))) (ivy-done)) ((and ivy--directory -(string-match - "\\`/\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'" - ivy-text)) +(or (and (equal ivy--directory "/") + (string-match + "\\`\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'" + ivy-text)) +(string-match + "\\`/\\([^/]+?\\):\\(?:\\(.*\\)@\\)?\\(.*\\)\\'" + ivy-text))) (let ((method (match-string 1 ivy-text)) (user (match-string 2 ivy-text)) (rest (match-string 3 ivy-text)) @@ -466,13 +474,16 @@ When ARG is t, exit with current text, ignoring the candidates." If the text hasn't changed as a result, forward to `ivy-alt-done'." (interactive) (if (and (eq (ivy-state-collection ivy-last) #'read-file-name-internal) - (string-match "\\`/" ivy-text)) + (or (and (equal ivy--directory "/") +(string-match "\\`[^/]+:.*\\'" ivy-text)) + (string-match "\\`/" ivy-text))) (let ((default-directory ivy--directory)) (minibuffer-complete) (setq ivy-text (ivy--input)) -(when (and (file-directory-p ivy-text) - (= ivy--length 1)) - (ivy--cd (expand-file-name ivy-text +(when (file-directory-p + (expand-file-name ivy-text ivy--directory)) + (ivy--cd (file-name-as-directory +(expand-file-name ivy-text ivy--directory) (or (ivy-partial) (when (or (eq this-command last-command) (eq ivy--length 1))
[elpa] master e037fb0 101/167: counsel.el (counsel-M-x): Show current-prefix-arg in the prompt
branch: master commit e037fb0c5da751d5a33200c5483cfef651b0f446 Author: Oleh Krehel Commit: Oleh Krehel counsel.el (counsel-M-x): Show current-prefix-arg in the prompt * counsel.el (counsel--M-x-prompt): New defun. (counsel-M-x): Update. Fixes #287 --- counsel.el | 16 +++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/counsel.el b/counsel.el index dee0e59..9ed334a 100644 --- a/counsel.el +++ b/counsel.el @@ -830,6 +830,20 @@ CMD is a command name." (declare-function smex-update "ext:smex") (declare-function smex-rank "ext:smex") +(defun counsel--M-x-prompt () + "M-x plus the string representation of `current-prefix-arg'." + (if (not current-prefix-arg) + "M-x " +(concat + (if (eq current-prefix-arg '-) + "- " + (if (integerp current-prefix-arg) + (format "%d " current-prefix-arg) + (if (= (car current-prefix-arg) 4) + "C-u " + (format "%d " (car current-prefix-arg) + "M-x "))) + ;;;###autoload (defun counsel-M-x (&optional initial-input) "Ivy version of `execute-extended-command'. @@ -856,7 +870,7 @@ Optional INITIAL-INPUT is the initial input in the minibuffer." (setq cands smex-ido-cache) (setq pred nil) (setq sort nil)) -(ivy-read "M-x " cands +(ivy-read (counsel--M-x-prompt) cands :predicate pred :require-match t :history 'extended-command-history
[elpa] master f0acebd 063/167: Fix Custom menus
branch: master commit f0acebd4c2bb99902009330ea19f7d013d07f266 Author: Stephen Whipple Commit: Oleh Krehel Fix Custom menus Custom menus for `ivy-virtual-abbreviate' and `ivy-sort-functions-alist' now display a better user interface. Fixes #274 --- ivy.el | 10 -- 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ivy.el b/ivy.el index 1cbaaf7..3c0f229 100644 --- a/ivy.el +++ b/ivy.el @@ -841,8 +841,6 @@ Prioritize directories." nil (string< x y -(autoload 'Man-goto-section "man" "" t) - (defcustom ivy-sort-functions-alist '((read-file-name-internal . ivy-sort-file-function-default) (internal-complete-buffer . nil) @@ -862,7 +860,7 @@ The entry associated to t is used for all fall-through cases." '(alist :key-type (choice (const :tag "All other functions" t) - (function :tag "Function")) + (symbol :tag "Function")) :value-type (choice (const :tag "plain sort" string-lessp) (const :tag "file sort" ivy-sort-file-function-default) @@ -1686,7 +1684,7 @@ CANDIDATES are assumed to be static." nil) ivy--index) -(defun ivy-recompute-index-swiper (re-str cands) +(defun ivy-recompute-index-swiper (_re-str cands) (let ((tail (nthcdr ivy--index ivy--old-cands)) idx) (if (and tail ivy--old-cands (not (equal "^" ivy--old-re))) @@ -1840,8 +1838,8 @@ CANDS is a list of strings." (defcustom ivy-virtual-abbreviate 'name "The mode of abbreviation for virtual buffer names." :type '(choice - (const :tag "Only name" 'name) - (const :tag "Full path" 'full) + (const :tag "Only name" name) + (const :tag "Full path" full) ;; eventually, uniquify ))
[elpa] master bc00eaf 137/167: Fix `counsel-ag` on Windows
branch: master commit bc00eafb326101e45a852fb36263ef445ef27b9b Author: kovrik Commit: kovrik Fix `counsel-ag` on Windows --- counsel.el |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/counsel.el b/counsel.el index bee493b..7e6b9fd 100644 --- a/counsel.el +++ b/counsel.el @@ -1104,7 +1104,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and (setq ivy--old-re (ivy--regex string) (counsel--async-command - (format "ag --noheading --nocolor %S" regex)) + (format "ag --vimgrep %S" regex)) nil))) (defun counsel-ag (&optional initial-input initial-directory)
[elpa] master 6666cf8 099/167: Fix directory validity check
branch: master commit cf8c863f02d9a81715a7801d7345ed45d942 Author: Stephen Whipple Commit: Oleh Krehel Fix directory validity check Directory validity check should be based on `ivy-text` and `ivy--directory` rather than only `ivy-text`. Fixes #283 Fixes #284 --- ivy.el |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ivy.el b/ivy.el index 5aa109d..3e1cd31 100644 --- a/ivy.el +++ b/ivy.el @@ -393,9 +393,9 @@ When ARG is t, exit with current text, ignoring the candidates." (and (not (equal ivy-text "")) (ignore-errors -(file-directory-p ivy-text)) - (setq dir (expand-file-name - ivy-text ivy--directory))) +(file-directory-p + (setq dir (expand-file-name +ivy-text ivy--directory) (and (not (string= ivy--current "./")) (cl-plusp ivy--length)
[elpa] master c99956a 047/167: Fix window selection in counsel-locate
branch: master commit c99956aae847ec77d09ef7eb8cc3d02fdeafa356 Author: Oleh Krehel Commit: Oleh Krehel Fix window selection in counsel-locate * counsel.el (counsel-locate): Use `with-ivy-window'. --- counsel.el |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/counsel.el b/counsel.el index da1e04c..96b7b00 100644 --- a/counsel.el +++ b/counsel.el @@ -590,8 +590,9 @@ Skip some dotfiles unless `ivy-text' requires them." :dynamic-collection t :history 'counsel-locate-history :action (lambda (file) - (when file -(find-file file))) + (with-ivy-window +(when file + (find-file file :unwind #'counsel-delete-process)) (defun counsel--generic (completion-fn)
[elpa] master 564e235 091/167: ivy.el (ivy-occur-press): Extend with-ivy-window
branch: master commit 564e23528b0c181206fa684ec2262daf6fd90ebc Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-occur-press): Extend with-ivy-window ivy-occur-action should be called in (ivy--get-window ivy-last). This means, for purposes of e.g. `counsel-find-symbol' or `lispy--action-jump` that if *ivy-occur* is the only window, it will be re-used. But if the user wants *ivy-occur* not to get buried, then having at least 2 windows solves that problem. --- ivy.el | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ivy.el b/ivy.el index 741a5a4..f5dbd94 100644 --- a/ivy.el +++ b/ivy.el @@ -2141,13 +2141,14 @@ EVENT gives the mouse position." (str (buffer-substring (+ 4 (line-beginning-position)) (line-end-position))) - (coll (ivy-state-collection ivy-last))) -(funcall ivy-occur-action - (if (and (consp coll) - (consp (car coll))) - (cdr (assoc str coll)) - str)) + (coll (ivy-state-collection ivy-last)) + (action ivy-occur-action)) (with-ivy-window + (funcall action + (if (and (consp coll) +(consp (car coll))) + (cdr (assoc str coll)) + str)) (pulse-momentary-highlight-one-line (point) (defun ivy-insert-current ()
[elpa] master 7a069be 088/167: ivy.el (ivy-occur-press): Work with counsel-rhythmbox
branch: master commit 7a069be4766cf54d07d176ad4133687ce230b34b Author: Oleh Krehel Commit: Oleh Krehel ivy.el (ivy-occur-press): Work with counsel-rhythmbox > (cdr (assoc str coll)) Special behavior for `counsel-rhythmbox'. Maybe not taking `cdr' is the right thing, but that's how Helm and `helm-rhythmbox-play-song' works. --- ivy.el | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ivy.el b/ivy.el index 459312c..9afc0f3 100644 --- a/ivy.el +++ b/ivy.el @@ -627,7 +627,7 @@ If the input is empty, select the previous history element instead." window (if (= (length (window-list)) 1) (selected-window) -(next-window ) +(next-window) (defun ivy--actionp (x) "Return non-nil when X is a list of actions." @@ -2136,11 +2136,16 @@ EVENT gives the mouse position." (interactive) (require 'pulse) (let* ((ivy-last ivy-occur-last) - (ivy-text (ivy-state-text ivy-last))) + (ivy-text (ivy-state-text ivy-last)) + (str (buffer-substring + (+ 4 (line-beginning-position)) + (line-end-position))) + (coll (ivy-state-collection ivy-last))) (funcall ivy-occur-action - (buffer-substring - (+ 4 (line-beginning-position)) - (line-end-position))) + (if (and (consp coll) + (consp (car coll))) + (cdr (assoc str coll)) + str)) (with-ivy-window (pulse-momentary-highlight-one-line (point)