diff options
| author | Kim F. Storm | 2002-09-02 10:40:56 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2002-09-02 10:40:56 +0000 |
| commit | 69beb26d2f8ed51d86a8572bcd0d369d60872ee7 (patch) | |
| tree | 406d0cfee6a8e6609634b0593e531cea936c61cd | |
| parent | efa1b437a11c28714764879067c3c0d319657b44 (diff) | |
| download | emacs-69beb26d2f8ed51d86a8572bcd0d369d60872ee7.tar.gz emacs-69beb26d2f8ed51d86a8572bcd0d369d60872ee7.zip | |
(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.
| -rw-r--r-- | lisp/ido.el | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/lisp/ido.el b/lisp/ido.el index 7a8a8dd92ed..054c084968e 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -835,6 +835,11 @@ whenever a file is opened with ido-find-file and family.") | |||
| 835 | "List of file-name-all-completions results. | 835 | "List of file-name-all-completions results. |
| 836 | Each element in the list is of the form (dir (mtime) file...).") | 836 | Each element in the list is of the form (dir (mtime) file...).") |
| 837 | 837 | ||
| 838 | (defvar ido-ignore-item-temp-list nil | ||
| 839 | "List of items to ignore in current ido invocation. | ||
| 840 | Intended to be let-bound by functions which calls ido repeatedly. | ||
| 841 | Should never be set permanently.") | ||
| 842 | |||
| 838 | ;; Temporary storage | 843 | ;; Temporary storage |
| 839 | 844 | ||
| 840 | (defvar ido-eoinput 1 | 845 | (defvar ido-eoinput 1 |
| @@ -1451,17 +1456,19 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 1451 | (setq ido-rescan t) | 1456 | (setq ido-rescan t) |
| 1452 | (setq ido-rotate nil) | 1457 | (setq ido-rotate nil) |
| 1453 | (setq ido-text "") | 1458 | (setq ido-text "") |
| 1454 | (if ido-set-default-item | 1459 | (when ido-set-default-item |
| 1455 | (setq ido-default-item | 1460 | (setq ido-default-item |
| 1456 | (cond | 1461 | (cond |
| 1457 | ((eq item 'buffer) | 1462 | ((eq item 'buffer) |
| 1458 | (if (bufferp default) (buffer-name default) default)) | 1463 | (if (bufferp default) (buffer-name default) default)) |
| 1459 | ((stringp default) default) | 1464 | ((stringp default) default) |
| 1460 | ((eq item 'file) | 1465 | ((eq item 'file) |
| 1461 | (and ido-enable-last-directory-history | 1466 | (and ido-enable-last-directory-history |
| 1462 | (let ((d (assoc ido-current-directory ido-last-directory-list))) | 1467 | (let ((d (assoc ido-current-directory ido-last-directory-list))) |
| 1463 | (and d (cdr d)))))) | 1468 | (and d (cdr d))))))) |
| 1464 | ido-set-default-item nil)) | 1469 | (if (member ido-default-item ido-ignore-item-temp-list) |
| 1470 | (setq ido-default-item nil)) | ||
| 1471 | (setq ido-set-default-item nil)) | ||
| 1465 | 1472 | ||
| 1466 | (if ido-process-ignore-lists-inhibit | 1473 | (if ido-process-ignore-lists-inhibit |
| 1467 | (setq ido-process-ignore-lists nil)) | 1474 | (setq ido-process-ignore-lists nil)) |
| @@ -1620,13 +1627,11 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 1620 | 1627 | ||
| 1621 | (t | 1628 | (t |
| 1622 | (setq ido-selected | 1629 | (setq ido-selected |
| 1623 | (if (and ido-matches (equal ido-final-text "")) | 1630 | (if (or (eq ido-exit 'takeprompt) |
| 1624 | (ido-name (car ido-matches)) ;; possibly choose the default file | 1631 | (null ido-matches)) |
| 1625 | (if (or (eq ido-exit 'takeprompt) | 1632 | ido-final-text |
| 1626 | (null ido-matches)) | 1633 | ;; else take head of list |
| 1627 | ido-final-text | 1634 | (ido-name (car ido-matches)))) |
| 1628 | ;; else take head of list | ||
| 1629 | (ido-name (car ido-matches))))) | ||
| 1630 | 1635 | ||
| 1631 | (cond | 1636 | (cond |
| 1632 | ((eq item 'buffer) | 1637 | ((eq item 'buffer) |
| @@ -1641,7 +1646,6 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 1641 | (or (ido-is-root-directory) | 1646 | (or (ido-is-root-directory) |
| 1642 | (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))) | 1647 | (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))) |
| 1643 | (setq ido-set-default-item t)) | 1648 | (setq ido-set-default-item t)) |
| 1644 | |||
| 1645 | ((and (string-equal ido-current-directory "/") | 1649 | ((and (string-equal ido-current-directory "/") |
| 1646 | (string-match "..:\\'" ido-selected)) ;; Ange-ftp | 1650 | (string-match "..:\\'" ido-selected)) ;; Ange-ftp |
| 1647 | (ido-set-current-directory "/" ido-selected) | 1651 | (ido-set-current-directory "/" ido-selected) |
| @@ -1700,6 +1704,7 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 1700 | 1704 | ||
| 1701 | ;; Check buf is non-nil. | 1705 | ;; Check buf is non-nil. |
| 1702 | ((not buf) nil) | 1706 | ((not buf) nil) |
| 1707 | ((= (length buf) 0) nil) | ||
| 1703 | 1708 | ||
| 1704 | ;; View buffer if it exists | 1709 | ;; View buffer if it exists |
| 1705 | ((get-buffer buf) | 1710 | ((get-buffer buf) |
| @@ -2526,7 +2531,7 @@ for first matching file." | |||
| 2526 | (mapcar | 2531 | (mapcar |
| 2527 | (lambda (x) | 2532 | (lambda (x) |
| 2528 | (let ((name (buffer-name x))) | 2533 | (let ((name (buffer-name x))) |
| 2529 | (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (memq name visible))) | 2534 | (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible))) |
| 2530 | name))) | 2535 | name))) |
| 2531 | (buffer-list frame)))) | 2536 | (buffer-list frame)))) |
| 2532 | 2537 | ||
| @@ -2716,12 +2721,13 @@ for first matching file." | |||
| 2716 | (defun ido-get-bufname (win) | 2721 | (defun ido-get-bufname (win) |
| 2717 | ;; Used by `ido-get-buffers-in-frames' to walk through all windows | 2722 | ;; Used by `ido-get-buffers-in-frames' to walk through all windows |
| 2718 | (let ((buf (buffer-name (window-buffer win)))) | 2723 | (let ((buf (buffer-name (window-buffer win)))) |
| 2719 | (if (not (member buf ido-bufs-in-frame)) | 2724 | (unless (or (member buf ido-bufs-in-frame) |
| 2720 | ;; Only add buf if it is not already in list. | 2725 | (member buf ido-ignore-item-temp-list)) |
| 2721 | ;; This prevents same buf in two different windows being | 2726 | ;; Only add buf if it is not already in list. |
| 2722 | ;; put into the list twice. | 2727 | ;; This prevents same buf in two different windows being |
| 2723 | (setq ido-bufs-in-frame | 2728 | ;; put into the list twice. |
| 2724 | (cons buf ido-bufs-in-frame))))) | 2729 | (setq ido-bufs-in-frame |
| 2730 | (cons buf ido-bufs-in-frame))))) | ||
| 2725 | 2731 | ||
| 2726 | ;;; FIND MATCHING ITEMS | 2732 | ;;; FIND MATCHING ITEMS |
| 2727 | 2733 | ||
| @@ -2777,7 +2783,9 @@ for first matching file." | |||
| 2777 | 2783 | ||
| 2778 | (defun ido-ignore-item-p (name re-list &optional ignore-ext) | 2784 | (defun ido-ignore-item-p (name re-list &optional ignore-ext) |
| 2779 | ;; Return t if the buffer or file NAME should be ignored. | 2785 | ;; Return t if the buffer or file NAME should be ignored. |
| 2780 | (and ido-process-ignore-lists re-list | 2786 | (or (member name ido-ignore-item-temp-list) |
| 2787 | (and | ||
| 2788 | ido-process-ignore-lists re-list | ||
| 2781 | (let ((data (match-data)) | 2789 | (let ((data (match-data)) |
| 2782 | (ext-list (and ignore-ext ido-ignore-extensions | 2790 | (ext-list (and ignore-ext ido-ignore-extensions |
| 2783 | completion-ignored-extensions)) | 2791 | completion-ignored-extensions)) |
| @@ -2808,7 +2816,7 @@ for first matching file." | |||
| 2808 | (if ignorep | 2816 | (if ignorep |
| 2809 | (setq ido-ignored-list (cons name ido-ignored-list))) | 2817 | (setq ido-ignored-list (cons name ido-ignored-list))) |
| 2810 | (set-match-data data) | 2818 | (set-match-data data) |
| 2811 | ignorep))) | 2819 | ignorep)))) |
| 2812 | 2820 | ||
| 2813 | 2821 | ||
| 2814 | ;; Private variable used by `ido-word-matching-substring'. | 2822 | ;; Private variable used by `ido-word-matching-substring'. |
| @@ -3009,7 +3017,7 @@ Record command in command-history if optional RECORD is non-nil." | |||
| 3009 | ;; If BUFFER is visible in the current frame, return nil. | 3017 | ;; If BUFFER is visible in the current frame, return nil. |
| 3010 | (let ((blist (ido-get-buffers-in-frames 'current))) | 3018 | (let ((blist (ido-get-buffers-in-frames 'current))) |
| 3011 | ;;If the buffer is visible in current frame, return nil | 3019 | ;;If the buffer is visible in current frame, return nil |
| 3012 | (if (memq buffer blist) | 3020 | (if (member buffer blist) |
| 3013 | nil | 3021 | nil |
| 3014 | ;; maybe in other frame or icon | 3022 | ;; maybe in other frame or icon |
| 3015 | (get-buffer-window buffer 0) ; better than 'visible | 3023 | (get-buffer-window buffer 0) ; better than 'visible |