]> code.delx.au - gnu-emacs/blobdiff - lisp/ido.el
; Minor updates in admin/MAINTAINERS
[gnu-emacs] / lisp / ido.el
index 60a59d6e99d3fbbd2fe799c7e82f46955243f84d..6ad354c58f2baf19c4603a626558c15e0298a451 100644 (file)
 ;;; Code:
 
 (defvar recentf-list)
+(require 'seq)
 
 ;;;; Options
 
@@ -377,7 +378,7 @@ use either \\[customize] or the function `ido-mode'."
   '("\\` ")
   "List of regexps or functions matching buffer names to ignore.
 For example, traditional behavior is not to list buffers whose names begin
-with a space, for which the regexp is `\\` '.  See the source file for
+with a space, for which the regexp is `\\\\=` '.  See the source file for
 example functions that filter buffer names."
   :type '(repeat (choice regexp function))
   :group 'ido)
@@ -386,7 +387,7 @@ example functions that filter buffer names."
   '("\\`CVS/" "\\`#" "\\`.#" "\\`\\.\\./" "\\`\\./")
   "List of regexps or functions matching file names to ignore.
 For example, traditional behavior is not to list files whose names begin
-with a #, for which the regexp is `\\`#'.  See the source file for
+with a #, for which the regexp is `\\\\=`#'.  See the source file for
 example functions that filter filenames."
   :type '(repeat (choice regexp function))
   :group 'ido)
@@ -940,7 +941,7 @@ This hook is run during minibuffer setup if Ido is active.
 It is intended for use in customizing Ido for interoperation
 with other packages.  For instance:
 
-  (add-hook 'ido-minibuffer-setup-hook
+  (add-hook \\='ido-minibuffer-setup-hook
            (lambda () (setq-local max-mini-window-height 3)))
 
 will constrain Emacs to a maximum minibuffer height of 3 lines when
@@ -2274,7 +2275,8 @@ If cursor is not at the end of the user input, move to end of input."
 
        ((and (eq ido-create-new-buffer 'prompt)
             (null require-match)
-            (not (y-or-n-p (format "No buffer matching `%s', create one? " buf))))
+            (not (y-or-n-p (format-message
+                            "No buffer matching `%s', create one? " buf))))
        nil)
 
        ;; buffer doesn't exist
@@ -2284,7 +2286,8 @@ If cursor is not at the end of the user input, move to end of input."
 
        ((and (eq ido-create-new-buffer 'prompt)
             (null require-match)
-            (not (y-or-n-p (format "No buffer matching `%s', create one? " buf))))
+            (not (y-or-n-p (format-message
+                            "No buffer matching `%s', create one? " buf))))
        nil)
 
        ;; create a new buffer
@@ -3180,11 +3183,19 @@ for first matching file."
       (if (> i 0)
          (setq ido-cur-list (ido-chop ido-cur-list (nth i ido-matches)))))))
 
-(defun ido-restrict-to-matches ()
-  "Set current item list to the currently matched items."
-  (interactive)
+(defun ido-restrict-to-matches (&optional removep)
+  "Set current item list to the currently matched items.
+
+When argument REMOVEP is non-nil, the currently matched items are
+instead removed from the current item list."
+  (interactive "P")
   (when ido-matches
-    (setq ido-cur-list ido-matches
+    (setq ido-cur-list (if removep
+                           ;; An important feature is to preserve the
+                           ;; order of the elements.
+                           (seq-difference ido-cur-list ido-matches)
+                         ido-matches)
+          ido-matches ido-cur-list
          ido-text-init ""
          ido-rescan nil
          ido-exit 'keep)
@@ -3766,13 +3777,13 @@ frame, rather than all frames, regardless of value of `ido-all-frames'."
                       (not (and (eq ido-cur-item 'buffer)
                                 ido-buffer-disable-smart-matches))
                       (not ido-enable-regexp)
-                      (not (string-match "\$\\'" rex0))
+                      (not (string-match "$\\'" rex0))
                       (concat "\\`" rex0 (if slash "/" "") "\\'")))
         (suffix-re (and do-full slash
                         (not (and (eq ido-cur-item 'buffer)
                                   ido-buffer-disable-smart-matches))
                         (not ido-enable-regexp)
-                        (not (string-match "\$\\'" rex0))
+                        (not (string-match "$\\'" rex0))
                         (concat rex0 "/\\'")))
         (prefix-re (and full-re (not ido-enable-prefix)
                         (concat "\\`" rexq)))