branch: master commit c10ba4bc0ffd0dc1c2acb0443e52044adb2cdeed Merge: f9b63e4 725e12a Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Merge commit '725e12a51e837ed75361f9f2258a887cacb120cd' from swiper --- packages/swiper/counsel.el | 17 ++++++------ packages/swiper/ivy.el | 60 ++++++++++++++++++++----------------------- packages/swiper/swiper.el | 8 ++++- 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/packages/swiper/counsel.el b/packages/swiper/counsel.el index a99bda8..f41608d 100644 --- a/packages/swiper/counsel.el +++ b/packages/swiper/counsel.el @@ -229,15 +229,14 @@ (ivy--dynamic-function (when (> counsel--git-grep-count 20000) 'counsel-git-grep-function)) (ivy--persistent-action (lambda (x) - (setq lst (split-string x ":")) - (find-file (expand-file-name (car lst) counsel--git-grep-dir)) - (goto-char (point-min)) - (forward-line (1- (string-to-number (cadr lst)))) - (setq swiper--window (selected-window)) - (swiper--cleanup) - (swiper--add-overlays (ivy--regex ivy-text)))) - (val (ivy-read "pattern: " 'counsel-git-grep-function)) - lst) + (let ((lst (split-string x ":"))) + (find-file (expand-file-name (car lst) counsel--git-grep-dir)) + (goto-char (point-min)) + (forward-line (1- (string-to-number (cadr lst)))) + (setq swiper--window (selected-window)) + (swiper--cleanup) + (swiper--add-overlays (ivy--regex ivy-text))))) + (val (ivy-read "pattern: " 'counsel-git-grep-function))) (when val (funcall ivy--persistent-action val))) (swiper--cleanup))) diff --git a/packages/swiper/ivy.el b/packages/swiper/ivy.el index 6fca361..ed9d3f9 100644 --- a/packages/swiper/ivy.el +++ b/packages/swiper/ivy.el @@ -166,6 +166,8 @@ When non-nil, it should contain one %d.") (defvar ivy--regex-function 'ivy--regex "Current function for building a regex.") +(defvar Info-current-file) + ;;** Commands (defun ivy-done () "Exit the minibuffer with the selected candidate." @@ -173,16 +175,9 @@ When non-nil, it should contain one %d.") (delete-minibuffer-contents) (when (cond (ivy--directory (insert - (cond ((string= ivy-text "") - (if (equal ivy--current "./") - ivy--directory - (if (string-match "\\*" ivy--current) - ivy--current - (expand-file-name ivy--current ivy--directory)))) - ((zerop ivy--length) - (expand-file-name ivy-text ivy--directory)) - (t - (expand-file-name ivy--current ivy--directory)))) + (if (zerop ivy--length) + (expand-file-name ivy-text ivy--directory) + (expand-file-name ivy--current ivy--directory))) (setq ivy-exit 'done)) ((zerop ivy--length) (if (memq ivy-require-match @@ -214,21 +209,16 @@ When ARG is t, exit with current text, ignoring the candidates." (if arg (ivy-immediate-done) (let (dir) - (cond ((and ivy--directory - (= 0 ivy--index) - (= 0 (length ivy-text))) - (ivy-done)) - - ((and ivy--directory - (cl-plusp ivy--length) - (file-directory-p - (setq dir (expand-file-name - ivy--current ivy--directory)))) - (ivy--cd dir) - (ivy--exhibit)) - - (t - (ivy-done)))))) + (if (and ivy--directory + (not (string= ivy--current "./")) + (cl-plusp ivy--length) + (file-directory-p + (setq dir (expand-file-name + ivy--current ivy--directory)))) + (progn + (ivy--cd dir) + (ivy--exhibit)) + (ivy-done))))) (defun ivy-immediate-done () "Exit the minibuffer with the current input." @@ -343,7 +333,9 @@ On error (read-only), call `ivy-on-del-error-function'." (if (and ivy--directory (= (minibuffer-prompt-end) (point))) (progn (ivy--cd (file-name-directory - (directory-file-name ivy--directory))) + (directory-file-name + (expand-file-name + ivy--directory)))) (ivy--exhibit)) (condition-case nil (backward-delete-char 1) @@ -414,8 +406,8 @@ Directories come first." ;;** Entry Point (cl-defun ivy-read (prompt collection - &key predicate require-match initial-input - history preselect keymap update-fn sort) + &key predicate require-match initial-input + history preselect keymap update-fn sort) "Read a string in the minibuffer, with completion. PROMPT is a string to prompt with; normally it ends in a colon @@ -477,9 +469,10 @@ When SORT is t, refer to `ivy-sort-functions-alist' for sorting." (when (and (setq sort-fn (cdr sort-fn)) (not (eq collection 'read-file-name-internal))) (setq coll (cl-sort coll sort-fn))) - (if (and (setq sort-fn (cdr (assoc t ivy-sort-functions-alist))) - (<= (length coll) ivy-sort-max-size)) - (setq coll (cl-sort (copy-sequence coll) sort-fn))))) + (unless (eq history 'org-refile-history) + (if (and (setq sort-fn (cdr (assoc t ivy-sort-functions-alist))) + (<= (length coll) ivy-sort-max-size)) + (setq coll (cl-sort (copy-sequence coll) sort-fn)))))) (when preselect (unless (or require-match (member preselect coll)) @@ -678,6 +671,8 @@ When GREEDY is non-nil, join words in a greedy way." ;; get out of the prompt area (constrain-to-field nil (point-max))))) +(defvar inhibit-message) + (defun ivy--exhibit () "Insert Ivy completions display. Should be run via minibuffer `post-command-hook'." @@ -697,7 +692,8 @@ Should be run via minibuffer `post-command-hook'." (if (string-match "/$" ivy-text) (if (member ivy-text ivy--all-candidates) (ivy--cd (expand-file-name ivy-text ivy--directory)) - (ivy--cd "/")) + (when (string-match "//$" ivy-text) + (ivy--cd "/"))) (if (string-match "~$" ivy-text) (ivy--cd (expand-file-name "~/"))))) (ivy--insert-minibuffer diff --git a/packages/swiper/swiper.el b/packages/swiper/swiper.el index c58f20f..114acb1 100644 --- a/packages/swiper/swiper.el +++ b/packages/swiper/swiper.el @@ -92,7 +92,7 @@ (lambda () (with-selected-window swiper--window (perform-replace from to - t t t)))) + t t nil)))) (swiper--cleanup) (exit-minibuffer)))) @@ -114,7 +114,8 @@ gnus-group-mode emms-playlist-mode erc-mode org-agenda-mode - dired-mode))) + dired-mode + jabber-chat-mode))) (unless (> (buffer-size) 100000) (if (fboundp 'font-lock-ensure) (font-lock-ensure) @@ -172,6 +173,9 @@ When non-nil, INITIAL-INPUT is the initial search pattern." "`isearch' with an overview using `ivy'. When non-nil, INITIAL-INPUT is the initial search pattern." (interactive) + (unless (eq (length (help-function-arglist 'ivy-read)) 4) + (warn "You seem to be using the outdated stand-alone \"ivy\" package. +Please remove it and update the \"swiper\" package.")) (swiper--init) (let ((candidates (swiper--candidates)) (preselect (format