Mercurial > emacs
changeset 47203:d7ff55da60cd
(ido-ignore-item-temp-list): New variable.
(ido-read-internal): Don't set ido-default-item if the default is
member of ido-ignore-item-temp-list.
Don't return first match for C-j if no text is entered.
(ido-buffer-internal): Check for empty string return.
(ido-make-buffer-list1): Use member instead of memq.
(ido-window-buffer-p): Likewise.
(ido-get-bufname): Ignore buffers on ido-ignore-item-temp-list.
(ido-ignore-item-p): Ignore items on ido-ignore-item-temp-list.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 02 Sep 2002 10:40:56 +0000 |
parents | 08c1b6123f86 |
children | 539aabdebd62 |
files | lisp/ido.el |
diffstat | 1 files changed, 37 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ido.el Mon Sep 02 10:40:23 2002 +0000 +++ b/lisp/ido.el Mon Sep 02 10:40:56 2002 +0000 @@ -835,6 +835,11 @@ "List of file-name-all-completions results. Each element in the list is of the form (dir (mtime) file...).") +(defvar ido-ignore-item-temp-list nil + "List of items to ignore in current ido invocation. +Intended to be let-bound by functions which calls ido repeatedly. +Should never be set permanently.") + ;; Temporary storage (defvar ido-eoinput 1 @@ -1451,17 +1456,19 @@ (setq ido-rescan t) (setq ido-rotate nil) (setq ido-text "") - (if ido-set-default-item - (setq ido-default-item - (cond - ((eq item 'buffer) - (if (bufferp default) (buffer-name default) default)) - ((stringp default) default) - ((eq item 'file) - (and ido-enable-last-directory-history - (let ((d (assoc ido-current-directory ido-last-directory-list))) - (and d (cdr d)))))) - ido-set-default-item nil)) + (when ido-set-default-item + (setq ido-default-item + (cond + ((eq item 'buffer) + (if (bufferp default) (buffer-name default) default)) + ((stringp default) default) + ((eq item 'file) + (and ido-enable-last-directory-history + (let ((d (assoc ido-current-directory ido-last-directory-list))) + (and d (cdr d))))))) + (if (member ido-default-item ido-ignore-item-temp-list) + (setq ido-default-item nil)) + (setq ido-set-default-item nil)) (if ido-process-ignore-lists-inhibit (setq ido-process-ignore-lists nil)) @@ -1620,13 +1627,11 @@ (t (setq ido-selected - (if (and ido-matches (equal ido-final-text "")) - (ido-name (car ido-matches)) ;; possibly choose the default file - (if (or (eq ido-exit 'takeprompt) - (null ido-matches)) - ido-final-text - ;; else take head of list - (ido-name (car ido-matches))))) + (if (or (eq ido-exit 'takeprompt) + (null ido-matches)) + ido-final-text + ;; else take head of list + (ido-name (car ido-matches)))) (cond ((eq item 'buffer) @@ -1641,7 +1646,6 @@ (or (ido-is-root-directory) (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))) (setq ido-set-default-item t)) - ((and (string-equal ido-current-directory "/") (string-match "..:\\'" ido-selected)) ;; Ange-ftp (ido-set-current-directory "/" ido-selected) @@ -1700,6 +1704,7 @@ ;; Check buf is non-nil. ((not buf) nil) + ((= (length buf) 0) nil) ;; View buffer if it exists ((get-buffer buf) @@ -2526,7 +2531,7 @@ (mapcar (lambda (x) (let ((name (buffer-name x))) - (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (memq name visible))) + (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible))) name))) (buffer-list frame)))) @@ -2716,12 +2721,13 @@ (defun ido-get-bufname (win) ;; Used by `ido-get-buffers-in-frames' to walk through all windows (let ((buf (buffer-name (window-buffer win)))) - (if (not (member buf ido-bufs-in-frame)) - ;; Only add buf if it is not already in list. - ;; This prevents same buf in two different windows being - ;; put into the list twice. - (setq ido-bufs-in-frame - (cons buf ido-bufs-in-frame))))) + (unless (or (member buf ido-bufs-in-frame) + (member buf ido-ignore-item-temp-list)) + ;; Only add buf if it is not already in list. + ;; This prevents same buf in two different windows being + ;; put into the list twice. + (setq ido-bufs-in-frame + (cons buf ido-bufs-in-frame))))) ;;; FIND MATCHING ITEMS @@ -2777,7 +2783,9 @@ (defun ido-ignore-item-p (name re-list &optional ignore-ext) ;; Return t if the buffer or file NAME should be ignored. - (and ido-process-ignore-lists re-list + (or (member name ido-ignore-item-temp-list) + (and + ido-process-ignore-lists re-list (let ((data (match-data)) (ext-list (and ignore-ext ido-ignore-extensions completion-ignored-extensions)) @@ -2808,7 +2816,7 @@ (if ignorep (setq ido-ignored-list (cons name ido-ignored-list))) (set-match-data data) - ignorep))) + ignorep)))) ;; Private variable used by `ido-word-matching-substring'. @@ -3009,7 +3017,7 @@ ;; If BUFFER is visible in the current frame, return nil. (let ((blist (ido-get-buffers-in-frames 'current))) ;;If the buffer is visible in current frame, return nil - (if (memq buffer blist) + (if (member buffer blist) nil ;; maybe in other frame or icon (get-buffer-window buffer 0) ; better than 'visible