aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2004-10-10 03:17:52 +0000
committerStefan Monnier2004-10-10 03:17:52 +0000
commitbfbc9ea9e083a9d8f72d00595f92e1074c14e86f (patch)
tree536ce20fac280e7103adacda46d62b59b3b1751e
parent6b7f34912cd54750971e410dd596fb8b4df7953c (diff)
downloademacs-bfbc9ea9e083a9d8f72d00595f92e1074c14e86f.tar.gz
emacs-bfbc9ea9e083a9d8f72d00595f92e1074c14e86f.zip
(imenu--completion-buffer): Don't return t for rescan.
(imenu-choose-buffer-index): Check here for rescan instead.
-rw-r--r--lisp/imenu.el39
1 files changed, 19 insertions, 20 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 1c82fcacf34..6859c0c74c7 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -317,9 +317,12 @@ The function in this variable is called when selecting a normal index-item.")
317;;;; 317;;;;
318;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 318;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
319 319
320;; Return the current/previous sexp and the location of the sexp (its 320;; FIXME: This is the only imenu-example-* definition that's actually used,
321;; beginning) without moving the point. 321;; and it seems to only be used by cperl-mode.el. We should just move it to
322;; cperl-mode.el and remove the rest.
322(defun imenu-example--name-and-position () 323(defun imenu-example--name-and-position ()
324 "Return the current/previous sexp and its (beginning) location.
325Don't move point."
323 (save-excursion 326 (save-excursion
324 (forward-sexp -1) 327 (forward-sexp -1)
325 ;; [ydi] modified for imenu-use-markers 328 ;; [ydi] modified for imenu-use-markers
@@ -549,12 +552,10 @@ A nested sub-alist element looks like (INDEX-NAME SUB-ALIST).")
549 (cond 552 (cond
550 ((consp (cdr item)) 553 ((consp (cdr item))
551 (imenu--truncate-items (cdr item))) 554 (imenu--truncate-items (cdr item)))
552 (t 555 ;; truncate if necessary
553 ;; truncate if necessary 556 ((and (numberp imenu-max-item-length)
554 (if (and (numberp imenu-max-item-length) 557 (> (length (car item)) imenu-max-item-length))
555 (> (length (car item)) imenu-max-item-length)) 558 (setcar item (substring (car item) 0 imenu-max-item-length))))))
556 (setcar item (substring (car item) 0
557 imenu-max-item-length)))))))
558 menulist)) 559 menulist))
559 560
560 561
@@ -854,7 +855,7 @@ depending on PATTERNS."
854(defun imenu--completion-buffer (index-alist &optional prompt) 855(defun imenu--completion-buffer (index-alist &optional prompt)
855 "Let the user select from INDEX-ALIST in a completion buffer with PROMPT. 856 "Let the user select from INDEX-ALIST in a completion buffer with PROMPT.
856 857
857Returns t for rescan and otherwise a position number." 858Return one of the entries in index-alist or nil."
858 ;; Create a list for this buffer only when needed. 859 ;; Create a list for this buffer only when needed.
859 (let ((name (thing-at-point 'symbol)) 860 (let ((name (thing-at-point 'symbol))
860 choice 861 choice
@@ -880,13 +881,11 @@ Returns t for rescan and otherwise a position number."
880 prepared-index-alist 881 prepared-index-alist
881 nil t nil 'imenu--history-list name))) 882 nil t nil 'imenu--history-list name)))
882 883
883 (cond ((not (stringp name)) nil) 884 (when (stringp name)
884 ((string= name (car imenu--rescan-item)) t) 885 (setq choice (assoc name prepared-index-alist))
885 (t 886 (if (imenu--subalist-p choice)
886 (setq choice (assoc name prepared-index-alist)) 887 (imenu--completion-buffer (cdr choice) prompt)
887 (if (imenu--subalist-p choice) 888 choice))))
888 (imenu--completion-buffer (cdr choice) prompt)
889 choice)))))
890 889
891(defun imenu--mouse-menu (index-alist event &optional title) 890(defun imenu--mouse-menu (index-alist event &optional title)
892 "Let the user select from a buffer index from a mouse menu. 891 "Let the user select from a buffer index from a mouse menu.
@@ -937,9 +936,9 @@ The returned value is of the form (INDEX-NAME . INDEX-POSITION)."
937 (or (eq imenu-use-popup-menu t) mouse-triggered)) 936 (or (eq imenu-use-popup-menu t) mouse-triggered))
938 (imenu--mouse-menu index-alist last-nonmenu-event) 937 (imenu--mouse-menu index-alist last-nonmenu-event)
939 (imenu--completion-buffer index-alist prompt))) 938 (imenu--completion-buffer index-alist prompt)))
940 (and (eq result t) 939 (and (equal result imenu--rescan-item)
941 (imenu--cleanup) 940 (imenu--cleanup)
942 (setq imenu--index-alist nil))) 941 (setq result t imenu--index-alist nil)))
943 result)) 942 result))
944 943
945;;;###autoload 944;;;###autoload
@@ -1014,7 +1013,7 @@ A trivial interface to `imenu-add-to-menubar' suitable for use in a hook."
1014 nil)) 1013 nil))
1015 1014
1016(defun imenu-default-goto-function (name position &optional rest) 1015(defun imenu-default-goto-function (name position &optional rest)
1017 "Move the point to the given position. 1016 "Move to the given position.
1018 1017
1019NAME is ignored. POSITION is where to move. REST is also ignored. 1018NAME is ignored. POSITION is where to move. REST is also ignored.
1020The ignored args just make this function have the same interface as a 1019The ignored args just make this function have the same interface as a
@@ -1054,5 +1053,5 @@ for more information."
1054 1053
1055(provide 'imenu) 1054(provide 'imenu)
1056 1055
1057;;; arch-tag: 98a2f5f5-4b91-4704-b18c-3aacf77d77a7 1056;; arch-tag: 98a2f5f5-4b91-4704-b18c-3aacf77d77a7
1058;;; imenu.el ends here 1057;;; imenu.el ends here