diff options
| author | Nicolas Richard | 2015-06-30 09:18:27 +0200 |
|---|---|---|
| committer | Nicolas Richard | 2015-07-02 00:57:07 +0200 |
| commit | 2f020e82195d6870b45d24d0c46af6d92b31deca (patch) | |
| tree | 41e797202521bc313d58bea416b47472d93b213e | |
| parent | 7d5a7a43f1f6630b269fa7f7dc13e9c80181a709 (diff) | |
| download | emacs-2f020e82195d6870b45d24d0c46af6d92b31deca.tar.gz emacs-2f020e82195d6870b45d24d0c46af6d92b31deca.zip | |
Add argument to reverse the meaning of ido-restrict-to-matches
* lisp/ido.el (ido-restrict-to-matches): Add an optional argument
to reverse the meaning (Bug#15631).
; * etc/NEWS: Mention the change.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/ido.el | 17 |
2 files changed, 16 insertions, 4 deletions
| @@ -398,6 +398,9 @@ If you need your objects to be named, do it by inheriting from `eieio-named'. | |||
| 398 | *** New command `ido-bury-buffer-at-head' bound to C-S-b | 398 | *** New command `ido-bury-buffer-at-head' bound to C-S-b |
| 399 | Bury the buffer at the head of `ido-matches', analogous to how C-k | 399 | Bury the buffer at the head of `ido-matches', analogous to how C-k |
| 400 | kills the buffer at head. | 400 | kills the buffer at head. |
| 401 | *** A prefix argument to `ido-restrict-to-matches' will reverse its | ||
| 402 | meaning, and the list is restricted to those elements that do not | ||
| 403 | match the current input. | ||
| 401 | 404 | ||
| 402 | ** Minibuffer | 405 | ** Minibuffer |
| 403 | 406 | ||
diff --git a/lisp/ido.el b/lisp/ido.el index 5995fcd41e3..1f12fbfa9ee 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -322,6 +322,7 @@ | |||
| 322 | ;;; Code: | 322 | ;;; Code: |
| 323 | 323 | ||
| 324 | (defvar recentf-list) | 324 | (defvar recentf-list) |
| 325 | (require 'seq) | ||
| 325 | 326 | ||
| 326 | ;;;; Options | 327 | ;;;; Options |
| 327 | 328 | ||
| @@ -3180,11 +3181,19 @@ for first matching file." | |||
| 3180 | (if (> i 0) | 3181 | (if (> i 0) |
| 3181 | (setq ido-cur-list (ido-chop ido-cur-list (nth i ido-matches))))))) | 3182 | (setq ido-cur-list (ido-chop ido-cur-list (nth i ido-matches))))))) |
| 3182 | 3183 | ||
| 3183 | (defun ido-restrict-to-matches () | 3184 | (defun ido-restrict-to-matches (&optional removep) |
| 3184 | "Set current item list to the currently matched items." | 3185 | "Set current item list to the currently matched items. |
| 3185 | (interactive) | 3186 | |
| 3187 | When argument REMOVEP is non-nil, the currently matched items are | ||
| 3188 | instead removed from the current item list." | ||
| 3189 | (interactive "P") | ||
| 3186 | (when ido-matches | 3190 | (when ido-matches |
| 3187 | (setq ido-cur-list ido-matches | 3191 | (setq ido-cur-list (if removep |
| 3192 | ;; An important feature is to preserve the | ||
| 3193 | ;; order of the elements. | ||
| 3194 | (seq-difference ido-cur-list ido-matches) | ||
| 3195 | ido-matches) | ||
| 3196 | ido-matches ido-cur-list | ||
| 3188 | ido-text-init "" | 3197 | ido-text-init "" |
| 3189 | ido-rescan nil | 3198 | ido-rescan nil |
| 3190 | ido-exit 'keep) | 3199 | ido-exit 'keep) |