update packages
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
(define-package "ivy" "20200624.1140" "Incremental Vertical completYon"
|
||||
(define-package "ivy" "20210105.2002" "Incremental Vertical completYon"
|
||||
'((emacs "24.5"))
|
||||
:commit "d951004c7f3ebf98d55fc5a80a3471ec95b6db05" :keywords
|
||||
'("matching")
|
||||
:authors
|
||||
:commit "71c59aecf669142ebe264fac8ff7b440c0c71712" :authors
|
||||
'(("Oleh Krehel" . "ohwoeowho@gmail.com"))
|
||||
:maintainer
|
||||
'("Oleh Krehel" . "ohwoeowho@gmail.com")
|
||||
:keywords
|
||||
'("matching")
|
||||
:url "https://github.com/abo-abo/swiper")
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
|
||||
211
lisp/ivy/ivy.el
211
lisp/ivy/ivy.el
@@ -577,11 +577,12 @@ functionality, e.g. as seen in `isearch'."
|
||||
(defvar ivy-case-fold-search ivy-case-fold-search-default
|
||||
"Store the current overriding `case-fold-search'.")
|
||||
|
||||
(defvar ivy-more-chars-alist
|
||||
(defcustom ivy-more-chars-alist
|
||||
'((t . 3))
|
||||
"Map commands to their minimum required input length.
|
||||
That is the number of characters prompted for before fetching
|
||||
candidates. The special key t is used as a fallback.")
|
||||
candidates. The special key t is used as a fallback."
|
||||
:type '(alist :key-type symbol :value-type integer))
|
||||
|
||||
(defun ivy-more-chars ()
|
||||
"Return two fake candidates prompting for at least N input.
|
||||
@@ -852,9 +853,9 @@ selection, non-nil otherwise."
|
||||
(string-prefix-p key (car x)))
|
||||
(cdr actions)))
|
||||
(not (string= key (car (nth action-idx (cdr actions))))))
|
||||
(setq key (concat key (key-description (string (read-key hint))))))
|
||||
(setq key (concat key (key-description (vector (read-key hint))))))
|
||||
(ivy-shrink-after-dispatching)
|
||||
(cond ((member key '("ESC" "C-g"))
|
||||
(cond ((member key '("ESC" "C-g" "M-o"))
|
||||
nil)
|
||||
((null action-idx)
|
||||
(message "%s is not bound" key)
|
||||
@@ -928,9 +929,13 @@ Is is a cons cell, related to `tramp-get-completion-function'."
|
||||
|
||||
(defcustom ivy-alt-done-functions-alist nil
|
||||
"Customize what `ivy-alt-done' does per-collection."
|
||||
:type '(alist
|
||||
:key-type symbol
|
||||
:value-type function))
|
||||
:type '(alist :key-type symbol :value-type function))
|
||||
|
||||
(defun ivy--completing-fname-p ()
|
||||
(eq 'file (cdr (assoc
|
||||
'category
|
||||
(ignore-errors
|
||||
(funcall (ivy-state-collection ivy-last) ivy-text nil 'metadata))))))
|
||||
|
||||
(defun ivy-alt-done (&optional arg)
|
||||
"Exit the minibuffer with the selected candidate.
|
||||
@@ -945,6 +950,8 @@ of exiting. This function is otherwise like `ivy-done'."
|
||||
(ivy-immediate-done))
|
||||
((setq alt-done-fn (ivy-alist-setting ivy-alt-done-functions-alist))
|
||||
(funcall alt-done-fn))
|
||||
((ivy--completing-fname-p)
|
||||
(ivy--directory-done))
|
||||
(t
|
||||
(ivy-done)))))
|
||||
|
||||
@@ -1006,38 +1013,37 @@ contains a single candidate.")
|
||||
(defun ivy--directory-done ()
|
||||
"Handle exit from the minibuffer when completing file names."
|
||||
(let ((dir (ivy--handle-directory ivy-text)))
|
||||
(cond
|
||||
((equal (ivy-state-current ivy-last) (ivy-state-def ivy-last))
|
||||
(ivy-done))
|
||||
((and (ivy-state-require-match ivy-last)
|
||||
(equal ivy-text "")
|
||||
(null ivy--old-cands))
|
||||
(ivy-immediate-done))
|
||||
(dir
|
||||
(let ((inhibit-message t))
|
||||
(ivy--cd dir)))
|
||||
((ivy--directory-enter))
|
||||
((unless (string= ivy-text "")
|
||||
;; Obsolete since 26.1 and removed in 28.1.
|
||||
(defvar tramp-completion-mode)
|
||||
(with-no-warnings
|
||||
(let* ((tramp-completion-mode t)
|
||||
(file (expand-file-name
|
||||
(if (> ivy--length 0) (ivy-state-current ivy-last) ivy-text)
|
||||
ivy--directory)))
|
||||
(when (ignore-errors (file-exists-p file))
|
||||
(if (file-directory-p file)
|
||||
(ivy--cd (file-name-as-directory file))
|
||||
(ivy-done))
|
||||
ivy-text)))))
|
||||
((or (and (equal ivy--directory "/")
|
||||
(string-match-p "\\`[^/]+:.*:.*\\'" ivy-text))
|
||||
(string-match-p "\\`/[^/]+:.*:.*\\'" ivy-text))
|
||||
(ivy-done))
|
||||
((ivy--tramp-prefix-p)
|
||||
(ivy--tramp-candidates))
|
||||
(t
|
||||
(ivy-done)))))
|
||||
(cond ((equal (ivy-state-current ivy-last) (ivy-state-def ivy-last))
|
||||
(ivy-done))
|
||||
((and (ivy-state-require-match ivy-last)
|
||||
(equal ivy-text "")
|
||||
(null ivy--old-cands))
|
||||
(ivy-immediate-done))
|
||||
(dir
|
||||
(let ((inhibit-message t))
|
||||
(ivy--cd dir)))
|
||||
((ivy--directory-enter))
|
||||
((unless (string= ivy-text "")
|
||||
;; Obsolete since 26.1 and removed in 28.1.
|
||||
(defvar tramp-completion-mode)
|
||||
(with-no-warnings
|
||||
(let* ((tramp-completion-mode t)
|
||||
(file (expand-file-name
|
||||
(if (> ivy--length 0) (ivy-state-current ivy-last) ivy-text)
|
||||
ivy--directory)))
|
||||
(when (ignore-errors (file-exists-p file))
|
||||
(if (file-directory-p file)
|
||||
(ivy--cd (file-name-as-directory file))
|
||||
(ivy-done))
|
||||
ivy-text)))))
|
||||
((or (and (equal ivy--directory "/")
|
||||
(string-match-p "\\`[^/]+:.*:.*\\'" ivy-text))
|
||||
(string-match-p "\\`/[^/]+:.*:.*\\'" ivy-text))
|
||||
(ivy-done))
|
||||
((ivy--tramp-prefix-p)
|
||||
(ivy--tramp-candidates))
|
||||
(t
|
||||
(ivy-done)))))
|
||||
|
||||
(defun ivy--tramp-prefix-p ()
|
||||
(or (and (equal ivy--directory "/")
|
||||
@@ -1589,24 +1595,25 @@ If so, move to that directory, while keeping only the file name."
|
||||
|
||||
(defun ivy--cd (dir)
|
||||
"When completing file names, move to directory DIR."
|
||||
(if (null ivy--directory)
|
||||
(error "Unexpected")
|
||||
(push dir ivy--directory-hist)
|
||||
(setq ivy--old-cands nil)
|
||||
(setq ivy--old-re nil)
|
||||
(ivy-set-index 0)
|
||||
(setq ivy--all-candidates
|
||||
(append
|
||||
(ivy--sorted-files (setq ivy--directory dir))
|
||||
(when (and (string= dir "/") (featurep 'tramp))
|
||||
(sort
|
||||
(mapcar
|
||||
(lambda (s) (substring s 1))
|
||||
(tramp-get-completion-methods ""))
|
||||
#'string<))))
|
||||
(ivy-set-text "")
|
||||
(setf (ivy-state-directory ivy-last) dir)
|
||||
(delete-minibuffer-contents)))
|
||||
(if (ivy--completing-fname-p)
|
||||
(progn
|
||||
(push dir ivy--directory-hist)
|
||||
(setq ivy--old-cands nil)
|
||||
(setq ivy--old-re nil)
|
||||
(ivy-set-index 0)
|
||||
(setq ivy--all-candidates
|
||||
(append
|
||||
(ivy--sorted-files (setq ivy--directory dir))
|
||||
(when (and (string= dir "/") (featurep 'tramp))
|
||||
(sort
|
||||
(mapcar
|
||||
(lambda (s) (substring s 1))
|
||||
(tramp-get-completion-methods ""))
|
||||
#'string<))))
|
||||
(ivy-set-text "")
|
||||
(setf (ivy-state-directory ivy-last) dir)
|
||||
(delete-minibuffer-contents))
|
||||
(error "Unexpected")))
|
||||
|
||||
(defun ivy--parent-dir (filename)
|
||||
"Return parent directory of absolute FILENAME."
|
||||
@@ -1682,6 +1689,7 @@ minibuffer."
|
||||
(interactive)
|
||||
(setq ivy--old-re nil)
|
||||
(cl-rotatef ivy--regex-function ivy--regexp-quote)
|
||||
(setq ivy--old-text "")
|
||||
(setq ivy-regex (funcall ivy--regex-function ivy-text)))
|
||||
|
||||
(defcustom ivy-format-functions-alist
|
||||
@@ -1766,12 +1774,13 @@ specified for the current collection in
|
||||
(setcdr cell (nconc (cddr cell) (list (cadr cell))))
|
||||
(ivy--reset-state ivy-last))))
|
||||
|
||||
(defvar ivy-index-functions-alist
|
||||
(defcustom ivy-index-functions-alist
|
||||
'((t . ivy-recompute-index-zero))
|
||||
"An alist of index recomputing functions for each collection function.
|
||||
When the input changes, the appropriate function returns an
|
||||
integer - the index of the matched candidate that should be
|
||||
selected.")
|
||||
selected."
|
||||
:type '(alist :key-type symbol :value-type function))
|
||||
|
||||
(defvar ivy-re-builders-alist
|
||||
'((t . ivy--regex-plus))
|
||||
@@ -1839,20 +1848,32 @@ May supersede `ivy-initial-inputs-alist'."
|
||||
(const :tag "Off" nil)
|
||||
(const :tag "Call action on change" auto))))
|
||||
|
||||
(defvar ivy-unwind-fns-alist nil
|
||||
"An alist associating commands to their :unwind values.")
|
||||
(defcustom ivy-unwind-fns-alist nil
|
||||
"An alist associating commands to their :unwind values."
|
||||
:type '(alist :key-type symbol :value-type function))
|
||||
|
||||
(defvar ivy-init-fns-alist nil
|
||||
(defcustom ivy-init-fns-alist nil
|
||||
"An alist associating commands to their :init values.
|
||||
An :init is a function with no arguments.
|
||||
`ivy-read' calls it to initialize.")
|
||||
`ivy-read' calls it to initialize."
|
||||
:type '(alist :key-type symbol :value-type function))
|
||||
|
||||
(defun ivy--alist-set (alist-sym key val)
|
||||
(let ((cell (assoc key (symbol-value alist-sym))))
|
||||
(if cell
|
||||
(setcdr cell val)
|
||||
(set alist-sym (cons (cons key val)
|
||||
(symbol-value alist-sym))))))
|
||||
(let ((curr-val (symbol-value alist-sym))
|
||||
(customized-val (get alist-sym 'customized-value))
|
||||
(default-val (eval (car (get alist-sym 'standard-value)))))
|
||||
;; when the value was set by `customize-set-variable', don't touch it
|
||||
(unless customized-val
|
||||
;; only works if the value wasn't customized by the user
|
||||
(when (or (null default-val) (equal curr-val default-val))
|
||||
(let ((cell (assoc key curr-val)))
|
||||
(if cell
|
||||
(setcdr cell val)
|
||||
(set alist-sym (cons (cons key val)
|
||||
(symbol-value alist-sym)))))
|
||||
(when default-val
|
||||
(put alist-sym 'standard-value
|
||||
(list (list 'quote (symbol-value alist-sym)))))))))
|
||||
|
||||
(declare-function counsel-set-async-exit-code "counsel")
|
||||
|
||||
@@ -2235,7 +2256,8 @@ This is useful for recursive `ivy-read'."
|
||||
(setq ivy-use-ignore ivy-use-ignore-default)
|
||||
(setf (ivy-state-ignore state) ivy-use-ignore)
|
||||
(setq ivy--highlight-function
|
||||
(or (cdr (assq ivy--regex-function ivy-highlight-functions-alist))
|
||||
(or (cdr (assq (ivy-alist-setting ivy-re-builders-alist)
|
||||
ivy-highlight-functions-alist))
|
||||
#'ivy--highlight-default))
|
||||
(let ((ivy-recursive-restore nil)
|
||||
coll sort-fn)
|
||||
@@ -2392,8 +2414,6 @@ This is useful for recursive `ivy-read'."
|
||||
prompt)))
|
||||
((string-match-p "%.*d" ivy-count-format)
|
||||
(concat ivy-count-format prompt))
|
||||
(ivy--directory
|
||||
prompt)
|
||||
(t
|
||||
prompt)))
|
||||
|
||||
@@ -2608,6 +2628,12 @@ See `ivy-set-prompt'."
|
||||
"When non-nil `ivy-mode' will set `completion-in-region-function'."
|
||||
:type 'boolean)
|
||||
|
||||
(defvar ivy--old-crf nil
|
||||
"Store previous value of `completing-read-function'.")
|
||||
|
||||
(defvar ivy--old-cirf nil
|
||||
"Store previous value of `completion-in-region-function'.")
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode ivy-mode
|
||||
"Toggle Ivy mode on or off.
|
||||
@@ -2626,11 +2652,21 @@ Minibuffer bindings:
|
||||
:lighter " ivy"
|
||||
(if ivy-mode
|
||||
(progn
|
||||
(setq completing-read-function 'ivy-completing-read)
|
||||
(unless (eq completing-read-function #'ivy-completing-read)
|
||||
(setq ivy--old-crf completing-read-function)
|
||||
(setq completing-read-function #'ivy-completing-read))
|
||||
(when ivy-do-completion-in-region
|
||||
(setq completion-in-region-function 'ivy-completion-in-region)))
|
||||
(setq completing-read-function 'completing-read-default)
|
||||
(setq completion-in-region-function 'completion--in-region)))
|
||||
(unless (eq completion-in-region-function #'ivy-completion-in-region)
|
||||
(setq ivy--old-cirf completion-in-region-function)
|
||||
(setq completion-in-region-function #'ivy-completion-in-region))))
|
||||
(when (eq completing-read-function #'ivy-completing-read)
|
||||
(setq completing-read-function (or ivy--old-crf
|
||||
#'completing-read-default))
|
||||
(setq ivy--old-crf nil))
|
||||
(when (eq completion-in-region-function #'ivy-completion-in-region)
|
||||
(setq completion-in-region-function (or ivy--old-cirf
|
||||
#'completion--in-region))
|
||||
(setq ivy--old-cirf nil))))
|
||||
|
||||
(defun ivy--preselect-index (preselect candidates)
|
||||
"Return the index of PRESELECT in CANDIDATES."
|
||||
@@ -3248,10 +3284,14 @@ The function was added in Emacs 26.1.")
|
||||
"~"
|
||||
home)))))
|
||||
|
||||
(defvar ivy--minibuffer-metadata nil)
|
||||
|
||||
(defun ivy-update-candidates (cands)
|
||||
(ivy--insert-minibuffer
|
||||
(ivy--format
|
||||
(setq ivy--all-candidates cands))))
|
||||
(let ((ivy--minibuffer-metadata
|
||||
(completion-metadata "" minibuffer-completion-table minibuffer-completion-predicate)))
|
||||
(ivy--insert-minibuffer
|
||||
(ivy--format
|
||||
(setq ivy--all-candidates cands)))))
|
||||
|
||||
(defun ivy--exhibit ()
|
||||
"Insert Ivy completions display.
|
||||
@@ -3670,13 +3710,14 @@ CANDS are the current candidates."
|
||||
((cl-position (string-remove-prefix "^" re-str)
|
||||
cands
|
||||
:test #'ivy--case-fold-string=))
|
||||
((and ivy--directory
|
||||
((and (ivy--completing-fname-p)
|
||||
(cl-position (concat re-str "/")
|
||||
cands
|
||||
:test #'ivy--case-fold-string=)))
|
||||
((and (eq caller 'ivy-switch-buffer)
|
||||
(not empty)
|
||||
0))
|
||||
(not empty))
|
||||
(or (cl-position current cands :test #'string=)
|
||||
0))
|
||||
((and (not empty)
|
||||
(not (eq caller 'swiper))
|
||||
(not (and ivy--flx-featurep
|
||||
@@ -3962,7 +4003,8 @@ in this case."
|
||||
(let ((beg (match-beginning i))
|
||||
(end (match-end i)))
|
||||
(when (and beg end)
|
||||
(unless (and prev (= prev beg))
|
||||
(unless (or (and prev (= prev beg))
|
||||
(zerop i))
|
||||
(cl-incf n))
|
||||
(let ((face
|
||||
(cond ((and ivy-use-group-face-if-no-groups
|
||||
@@ -3992,7 +4034,8 @@ in this case."
|
||||
(funcall ivy--highlight-function str))
|
||||
str))
|
||||
(olen (length str))
|
||||
(annot (plist-get completion-extra-properties :annotation-function)))
|
||||
(annot (or (completion-metadata-get ivy--minibuffer-metadata 'annotation-function)
|
||||
(plist-get completion-extra-properties :annotation-function))))
|
||||
(add-text-properties
|
||||
0 olen
|
||||
'(mouse-face
|
||||
@@ -5094,7 +5137,7 @@ EVENT gives the mouse position."
|
||||
(ivy--occur-press-update-window)
|
||||
(when (save-excursion
|
||||
(beginning-of-line)
|
||||
(looking-at "\\(?:./\\| \\)\\(.*\\)$"))
|
||||
(looking-at "\\(?:.[/\\]\\| \\)\\(.*\\)$"))
|
||||
(let* ((ivy-last ivy-occur-last)
|
||||
(ivy-text (ivy-state-text ivy-last))
|
||||
(str (buffer-substring
|
||||
|
||||
Reference in New Issue
Block a user