diff options
author | João Távora <joaotavora@gmail.com> | 2019-01-14 12:46:34 +0000 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2019-01-14 19:05:20 +0000 |
commit | cdb082322d4209c5104bc1a98b21bf3dd75e8f17 (patch) | |
tree | ad84bf55dd85e6b932a77ffacf625512683c7804 /lisp/icomplete.el | |
parent | 80c3b9aebaf99da73d10a949f475c5778e843cf8 (diff) | |
download | emacs-cdb082322d4209c5104bc1a98b21bf3dd75e8f17.tar.gz |
Fix icomplete's cycling when filename filtering kicks in
Fixes: bug#34070
* lisp/icomplete.el (icomplete--filtered-completions): New variable.
(icomplete-forward-completions, icomplete-backward-completions):
Use it.
(icomplete-completions): Set it.
Diffstat (limited to 'lisp/icomplete.el')
-rw-r--r-- | lisp/icomplete.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 8bed46cb3b3..82e2728487b 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -162,6 +162,9 @@ the default otherwise." (minibuffer-force-complete-and-exit) (minibuffer-complete-and-exit))) +(defvar icomplete--filtered-completions nil + "If non-nil completions as filtered by `icomplete-completions'") + (defun icomplete-forward-completions () "Step forward completions by one entry. Second entry becomes the first and can be selected with @@ -169,7 +172,8 @@ Second entry becomes the first and can be selected with (interactive) (let* ((beg (icomplete--field-beg)) (end (icomplete--field-end)) - (comps (completion-all-sorted-completions beg end)) + (comps (or icomplete--filtered-completions + (completion-all-sorted-completions beg end))) (last (last comps))) (when comps (setcdr last (cons (car comps) (cdr last))) @@ -182,7 +186,8 @@ Last entry becomes the first and can be selected with (interactive) (let* ((beg (icomplete--field-beg)) (end (icomplete--field-end)) - (comps (completion-all-sorted-completions beg end)) + (comps (or icomplete--filtered-completions + (completion-all-sorted-completions beg end))) (last-but-one (last comps 2)) (last (cdr last-but-one))) (when (consp last) ; At least two elements in comps @@ -382,9 +387,11 @@ matches exist." (progn ;;(debug (format "Candidates=%S field=%S" candidates name)) (format " %sNo matches%s" open-bracket close-bracket)) (if last (setcdr last nil)) - (when (and minibuffer-completing-file-name - icomplete-with-completion-tables) - (setq comps (completion-pcm--filename-try-filter comps))) + (if (and minibuffer-completing-file-name + icomplete-with-completion-tables) + (setq comps (completion-pcm--filename-try-filter comps) + icomplete--filtered-completions comps) + (setq icomplete--filtered-completions nil)) (let* ((most-try (if (and base-size (> base-size 0)) (completion-try-completion |