diff options
| author | Richard M. Stallman | 1994-12-23 05:05:22 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-12-23 05:05:22 +0000 |
| commit | af447694e7ceb50ea86e9ea8207e2ae18d1820fa (patch) | |
| tree | a5e236c6222c64d0864ec97310c42efbef670617 | |
| parent | 906848bd86441fb963a870d0558545a9d58f123c (diff) | |
| download | emacs-af447694e7ceb50ea86e9ea8207e2ae18d1820fa.tar.gz emacs-af447694e7ceb50ea86e9ea8207e2ae18d1820fa.zip | |
(imenu-always-use-completion-buffer-p): A value of
`never' now means never display a completion buffer.
(imenu--completion-buffer): implement 'never behaviour.
| -rw-r--r-- | lisp/imenu.el | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el index bd7c1adbe02..aa4dd433dbe 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Ake Stenhoff <etxaksf@aom.ericsson.se> | 5 | ;; Author: Ake Stenhoff <etxaksf@aom.ericsson.se> |
| 6 | ;; Lars Lindberg <lli@sypro.cap.se> | 6 | ;; Lars Lindberg <lli@sypro.cap.se> |
| 7 | ;; Created: 8 Feb 1994 | 7 | ;; Created: 8 Feb 1994 |
| 8 | ;; Version: 1.14 | 8 | ;; Version: 1.15 |
| 9 | ;; Keywords: tools | 9 | ;; Keywords: tools |
| 10 | ;; | 10 | ;; |
| 11 | ;; This program is free software; you can redistribute it and/or modify | 11 | ;; This program is free software; you can redistribute it and/or modify |
| @@ -49,7 +49,7 @@ | |||
| 49 | ;; [greg] - Greg Thompson gregt@porsche.visix.COM | 49 | ;; [greg] - Greg Thompson gregt@porsche.visix.COM |
| 50 | ;; [wolfgang] - Wolfgang Bangerth zcg51122@rpool1.rus.uni-stuttgart.de | 50 | ;; [wolfgang] - Wolfgang Bangerth zcg51122@rpool1.rus.uni-stuttgart.de |
| 51 | ;; [kai] - Kai Grossjohann grossjoh@linus.informatik.uni-dortmund.de | 51 | ;; [kai] - Kai Grossjohann grossjoh@linus.informatik.uni-dortmund.de |
| 52 | 52 | ;; [david] - David M. Smith dsmith@stats.adelaide.edu.au | |
| 53 | ;;; Code | 53 | ;;; Code |
| 54 | (eval-when-compile (require 'cl)) | 54 | (eval-when-compile (require 'cl)) |
| 55 | 55 | ||
| @@ -64,7 +64,8 @@ | |||
| 64 | 64 | ||
| 65 | Non-nil means always display the index in a completion buffer. | 65 | Non-nil means always display the index in a completion buffer. |
| 66 | Nil means display the index as a mouse menu when the mouse was | 66 | Nil means display the index as a mouse menu when the mouse was |
| 67 | used to invoke `imenu'.") | 67 | used to invoke `imenu'. |
| 68 | `never' means never automatically display a listing of any kind.") | ||
| 68 | 69 | ||
| 69 | (defvar imenu-sort-function nil | 70 | (defvar imenu-sort-function nil |
| 70 | "*The function to use for sorting the index mouse-menu. | 71 | "*The function to use for sorting the index mouse-menu. |
| @@ -653,21 +654,25 @@ Returns t for rescan and otherwise a position number." | |||
| 653 | (cons (imenu--replace-spaces (car item) imenu-space-replacement) | 654 | (cons (imenu--replace-spaces (car item) imenu-space-replacement) |
| 654 | (cdr item)))) | 655 | (cdr item)))) |
| 655 | index-alist))) | 656 | index-alist))) |
| 656 | (save-window-excursion | 657 | (if (eq imenu-always-use-completion-buffer-p 'never) |
| 657 | ;; Display the completion buffer | 658 | (setq name (completing-read (or prompt "Index item: ") |
| 658 | (with-output-to-temp-buffer "*Completions*" | 659 | prepared-index-alist |
| 659 | (display-completion-list | 660 | nil t nil 'imenu--history-list)) |
| 660 | (all-completions "" prepared-index-alist ))) | 661 | (save-window-excursion |
| 661 | (let ((minibuffer-setup-hook | 662 | ;; Display the completion buffer |
| 662 | (function (lambda () | 663 | (with-output-to-temp-buffer "*Completions*" |
| 663 | (let ((buffer (current-buffer))) | 664 | (display-completion-list |
| 664 | (save-excursion | 665 | (all-completions "" prepared-index-alist ))) |
| 665 | (set-buffer "*Completions*") | 666 | (let ((minibuffer-setup-hook |
| 666 | (setq completion-reference-buffer buffer))))))) | 667 | (function (lambda () |
| 667 | ;; Make a completion question | 668 | (let ((buffer (current-buffer))) |
| 668 | (setq name (completing-read (or prompt "Index item: ") | 669 | (save-excursion |
| 669 | prepared-index-alist | 670 | (set-buffer "*Completions*") |
| 670 | nil t nil 'imenu--history-list)))) | 671 | (setq completion-reference-buffer buffer))))))) |
| 672 | ;; Make a completion question | ||
| 673 | (setq name (completing-read (or prompt "Index item: ") | ||
| 674 | prepared-index-alist | ||
| 675 | nil t nil 'imenu--history-list))))) | ||
| 671 | (cond ((not (stringp name)) | 676 | (cond ((not (stringp name)) |
| 672 | nil) | 677 | nil) |
| 673 | ((string= name (car imenu--rescan-item)) | 678 | ((string= name (car imenu--rescan-item)) |