1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-03 11:33:37 +00:00

(imenu-always-use-completion-buffer-p): A value of

`never' now means never display a completion buffer.
(imenu--completion-buffer): implement 'never behaviour.
This commit is contained in:
Richard M. Stallman 1994-12-23 05:05:22 +00:00
parent 906848bd86
commit af447694e7

View File

@ -5,7 +5,7 @@
;; Author: Ake Stenhoff <etxaksf@aom.ericsson.se> ;; Author: Ake Stenhoff <etxaksf@aom.ericsson.se>
;; Lars Lindberg <lli@sypro.cap.se> ;; Lars Lindberg <lli@sypro.cap.se>
;; Created: 8 Feb 1994 ;; Created: 8 Feb 1994
;; Version: 1.14 ;; Version: 1.15
;; Keywords: tools ;; Keywords: tools
;; ;;
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -49,7 +49,7 @@
;; [greg] - Greg Thompson gregt@porsche.visix.COM ;; [greg] - Greg Thompson gregt@porsche.visix.COM
;; [wolfgang] - Wolfgang Bangerth zcg51122@rpool1.rus.uni-stuttgart.de ;; [wolfgang] - Wolfgang Bangerth zcg51122@rpool1.rus.uni-stuttgart.de
;; [kai] - Kai Grossjohann grossjoh@linus.informatik.uni-dortmund.de ;; [kai] - Kai Grossjohann grossjoh@linus.informatik.uni-dortmund.de
;; [david] - David M. Smith dsmith@stats.adelaide.edu.au
;;; Code ;;; Code
(eval-when-compile (require 'cl)) (eval-when-compile (require 'cl))
@ -64,7 +64,8 @@
Non-nil means always display the index in a completion buffer. Non-nil means always display the index in a completion buffer.
Nil means display the index as a mouse menu when the mouse was Nil means display the index as a mouse menu when the mouse was
used to invoke `imenu'.") used to invoke `imenu'.
`never' means never automatically display a listing of any kind.")
(defvar imenu-sort-function nil (defvar imenu-sort-function nil
"*The function to use for sorting the index mouse-menu. "*The function to use for sorting the index mouse-menu.
@ -653,21 +654,25 @@ Returns t for rescan and otherwise a position number."
(cons (imenu--replace-spaces (car item) imenu-space-replacement) (cons (imenu--replace-spaces (car item) imenu-space-replacement)
(cdr item)))) (cdr item))))
index-alist))) index-alist)))
(save-window-excursion (if (eq imenu-always-use-completion-buffer-p 'never)
;; Display the completion buffer (setq name (completing-read (or prompt "Index item: ")
(with-output-to-temp-buffer "*Completions*" prepared-index-alist
(display-completion-list nil t nil 'imenu--history-list))
(all-completions "" prepared-index-alist ))) (save-window-excursion
(let ((minibuffer-setup-hook ;; Display the completion buffer
(function (lambda () (with-output-to-temp-buffer "*Completions*"
(let ((buffer (current-buffer))) (display-completion-list
(save-excursion (all-completions "" prepared-index-alist )))
(set-buffer "*Completions*") (let ((minibuffer-setup-hook
(setq completion-reference-buffer buffer))))))) (function (lambda ()
;; Make a completion question (let ((buffer (current-buffer)))
(setq name (completing-read (or prompt "Index item: ") (save-excursion
prepared-index-alist (set-buffer "*Completions*")
nil t nil 'imenu--history-list)))) (setq completion-reference-buffer buffer)))))))
;; Make a completion question
(setq name (completing-read (or prompt "Index item: ")
prepared-index-alist
nil t nil 'imenu--history-list)))))
(cond ((not (stringp name)) (cond ((not (stringp name))
nil) nil)
((string= name (car imenu--rescan-item)) ((string= name (car imenu--rescan-item))