mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-31 11:13:50 +00:00
(imenu-always-use-completion-buffer-p): Make obsolete.
(imenu-use-popup-menu, imenu-eager-completion-buffer): New vars. (imenu-space-replacement): Allow nil value. (imenu--completion-buffer): Use new vars and simplify. Fix handling of minibuffer-setup-hook. Use minibuffer-completion-help instead of rolling our own. (imenu-choose-buffer-index): Use the new var.
This commit is contained in:
parent
b88b46f269
commit
5988bd2708
@ -1,3 +1,18 @@
|
||||
2002-08-14 Stefan Monnier <monnier@cs.yale.edu>
|
||||
|
||||
* emacs-lisp/find-func.el (find-function-search-for-symbol):
|
||||
Use find-file-hook instead of find-file-hooks.
|
||||
|
||||
* imenu.el (imenu-always-use-completion-buffer-p): Make obsolete.
|
||||
(imenu-use-popup-menu, imenu-eager-completion-buffer): New vars.
|
||||
(imenu-space-replacement): Allow nil value.
|
||||
(imenu--completion-buffer): Use new vars and simplify.
|
||||
Fix handling of minibuffer-setup-hook.
|
||||
Use minibuffer-completion-help instead of rolling our own.
|
||||
(imenu-choose-buffer-index): Use the new var.
|
||||
|
||||
* startup.el (command-line): Load custom-file if not done yet.
|
||||
|
||||
2002-08-15 David Kastrup <David.Kastrup@t-online.de>
|
||||
|
||||
* net/ange-ftp.el (ange-ftp-wipe-file-entries): Fix type mismatch;
|
||||
@ -5,9 +20,8 @@
|
||||
|
||||
2002-08-14 Kenichi Handa <handa@etl.go.jp>
|
||||
|
||||
* select.el (xselect-convert-to-string): If TYPE is non-nil,
|
||||
encode the selection data string. Always return cons of type and
|
||||
string.
|
||||
* select.el (xselect-convert-to-string): If TYPE is non-nil, encode
|
||||
the selection data string. Always return cons of type and string.
|
||||
(selection-converter-alist): Add (UTF8_STRING .
|
||||
xselect-convert-to-string).
|
||||
|
||||
|
@ -104,17 +104,26 @@ This variable is buffer-local."
|
||||
:type 'integer
|
||||
:group 'imenu)
|
||||
|
||||
(defcustom imenu-always-use-completion-buffer-p nil
|
||||
"*Set this to non-nil for displaying the index in a completion buffer.
|
||||
(defvar imenu-always-use-completion-buffer-p nil)
|
||||
(make-obsolete-variable 'imenu-always-use-completion-buffer-p
|
||||
'imenu-use-popup-menu "21.4")
|
||||
|
||||
`never' means never automatically display a listing of any kind.
|
||||
A value of nil (the default) means display the index as a mouse menu
|
||||
if the mouse was used to invoke `imenu'.
|
||||
Another non-nil value means always display the index in a completion buffer."
|
||||
:type '(choice (const :tag "On Mouse" nil)
|
||||
(const :tag "Never" never)
|
||||
(other :tag "Always" t))
|
||||
:group 'imenu)
|
||||
(defcustom imenu-use-popup-menu
|
||||
(if imenu-always-use-completion-buffer-p
|
||||
(not (eq imenu-always-use-completion-buffer-p 'never))
|
||||
'on-mouse)
|
||||
"Use a popup menu rather than a minibuffer prompt.
|
||||
If nil, always use a minibuffer prompt.
|
||||
If t, always use a popup menu,
|
||||
If `on-mouse' use a popup menu when `imenu' was invoked with the mouse."
|
||||
:type '(choice (const :tag "On Mouse" on-mouse)
|
||||
(const :tag "Never" nil)
|
||||
(other :tag "Always" t)))
|
||||
|
||||
(defcustom imenu-eager-completion-buffer
|
||||
(not (eq imenu-always-use-completion-buffer-p 'never))
|
||||
"If non-nil, eagerly popup the completion buffer."
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom imenu-after-jump-hook nil
|
||||
"*Hooks called after jumping to a place in the buffer.
|
||||
@ -164,7 +173,7 @@ which case you might as well set this to nil."
|
||||
"*The replacement string for spaces in index names.
|
||||
Used when presenting the index in a completion buffer to make the
|
||||
names work as tokens."
|
||||
:type 'string
|
||||
:type '(choice string (const nil))
|
||||
:group 'imenu)
|
||||
|
||||
(defcustom imenu-level-separator ":"
|
||||
@ -857,37 +866,26 @@ Returns t for rescan and otherwise a position number."
|
||||
(let ((name (thing-at-point 'symbol))
|
||||
choice
|
||||
(prepared-index-alist
|
||||
(mapcar
|
||||
(lambda (item)
|
||||
(cons (subst-char-in-string ?\ (aref imenu-space-replacement 0)
|
||||
(car item))
|
||||
(cdr item)))
|
||||
index-alist)))
|
||||
(if (not imenu-space-replacement) index-alist
|
||||
(mapcar
|
||||
(lambda (item)
|
||||
(cons (subst-char-in-string ?\ (aref imenu-space-replacement 0)
|
||||
(car item))
|
||||
(cdr item)))
|
||||
index-alist))))
|
||||
(when (stringp name)
|
||||
(setq name (or (imenu-find-default name prepared-index-alist) name)))
|
||||
(cond (prompt)
|
||||
((and name (imenu--in-alist name prepared-index-alist))
|
||||
(setq prompt (format "Index item (default %s): " name)))
|
||||
(t (setq prompt "Index item: ")))
|
||||
(if (eq imenu-always-use-completion-buffer-p 'never)
|
||||
(setq name (completing-read prompt
|
||||
prepared-index-alist
|
||||
nil t nil 'imenu--history-list name))
|
||||
(save-window-excursion
|
||||
;; Display the completion buffer
|
||||
(with-output-to-temp-buffer "*Completions*"
|
||||
(display-completion-list
|
||||
(all-completions "" prepared-index-alist )))
|
||||
(let ((minibuffer-setup-hook
|
||||
(function
|
||||
(lambda ()
|
||||
(let ((buffer (current-buffer)))
|
||||
(with-current-buffer "*Completions*"
|
||||
(setq completion-reference-buffer buffer)))))))
|
||||
;; Make a completion question
|
||||
(setq name (completing-read prompt
|
||||
prepared-index-alist
|
||||
nil t nil 'imenu--history-list name)))))
|
||||
(let ((minibuffer-setup-hook minibuffer-setup-hook))
|
||||
;; Display the completion buffer.
|
||||
(if (not imenu-eager-completion-buffer)
|
||||
(add-hook 'minibuffer-setup-hook 'minibuffer-completion-help))
|
||||
(setq name (completing-read prompt
|
||||
prepared-index-alist
|
||||
nil t nil 'imenu--history-list name)))
|
||||
(cond ((not (stringp name)) nil)
|
||||
((string= name (car imenu--rescan-item)) t)
|
||||
(t
|
||||
@ -923,7 +921,7 @@ select from ALIST.
|
||||
With no index alist ALIST, it calls `imenu--make-index-alist' to
|
||||
create the index alist.
|
||||
|
||||
If `imenu-always-use-completion-buffer-p' is non-nil, then the
|
||||
If `imenu-use-popup-menu' is non-nil, then the
|
||||
completion buffer is always used, no matter if the mouse was used or
|
||||
not.
|
||||
|
||||
@ -941,8 +939,8 @@ The returned value is of the form (INDEX-NAME . INDEX-POSITION)."
|
||||
(while (eq result t)
|
||||
(setq index-alist (if alist alist (imenu--make-index-alist)))
|
||||
(setq result
|
||||
(if (and mouse-triggered
|
||||
(not imenu-always-use-completion-buffer-p))
|
||||
(if (and imenu-use-popup-menu
|
||||
(or (eq imenu-use-popup-menu t) mouse-triggered))
|
||||
(imenu--mouse-menu index-alist last-nonmenu-event)
|
||||
(imenu--completion-buffer index-alist prompt)))
|
||||
(and (eq result t)
|
||||
|
Loading…
Reference in New Issue
Block a user