summaryrefslogtreecommitdiff
path: root/lisp/imenu.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 3a16dcb9ac3..8fdacb0214d 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -765,10 +765,13 @@ Return one of the entries in index-alist or nil."
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: ")))
+ (unless prompt
+ (setq prompt (format-prompt
+ "Index item"
+ (and name
+ (imenu--in-alist name prepared-index-alist)
+ ;; Default to `name' if it's in the alist.
+ name))))
(let ((minibuffer-setup-hook minibuffer-setup-hook))
;; Display the completion buffer.
(if (not imenu-eager-completion-buffer)