317 |
;;;; |
;;;; |
318 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
319 |
|
|
320 |
;; Return the current/previous sexp and the location of the sexp (its |
;; FIXME: This is the only imenu-example-* definition that's actually used, |
321 |
;; beginning) without moving the point. |
;; 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. |
323 |
(defun imenu-example--name-and-position () |
(defun imenu-example--name-and-position () |
324 |
|
"Return the current/previous sexp and its (beginning) location. |
325 |
|
Don't move point." |
326 |
(save-excursion |
(save-excursion |
327 |
(forward-sexp -1) |
(forward-sexp -1) |
328 |
;; [ydi] modified for imenu-use-markers |
;; [ydi] modified for imenu-use-markers |
552 |
(cond |
(cond |
553 |
((consp (cdr item)) |
((consp (cdr item)) |
554 |
(imenu--truncate-items (cdr item))) |
(imenu--truncate-items (cdr item))) |
555 |
(t |
;; truncate if necessary |
556 |
;; truncate if necessary |
((and (numberp imenu-max-item-length) |
557 |
(if (and (numberp imenu-max-item-length) |
(> (length (car item)) imenu-max-item-length)) |
558 |
(> (length (car item)) imenu-max-item-length)) |
(setcar item (substring (car item) 0 imenu-max-item-length)))))) |
|
(setcar item (substring (car item) 0 |
|
|
imenu-max-item-length))))))) |
|
559 |
menulist)) |
menulist)) |
560 |
|
|
561 |
|
|
855 |
(defun imenu--completion-buffer (index-alist &optional prompt) |
(defun imenu--completion-buffer (index-alist &optional prompt) |
856 |
"Let the user select from INDEX-ALIST in a completion buffer with PROMPT. |
"Let the user select from INDEX-ALIST in a completion buffer with PROMPT. |
857 |
|
|
858 |
Returns t for rescan and otherwise a position number." |
Return one of the entries in index-alist or nil." |
859 |
;; Create a list for this buffer only when needed. |
;; Create a list for this buffer only when needed. |
860 |
(let ((name (thing-at-point 'symbol)) |
(let ((name (thing-at-point 'symbol)) |
861 |
choice |
choice |
881 |
prepared-index-alist |
prepared-index-alist |
882 |
nil t nil 'imenu--history-list name))) |
nil t nil 'imenu--history-list name))) |
883 |
|
|
884 |
(cond ((not (stringp name)) nil) |
(when (stringp name) |
885 |
((string= name (car imenu--rescan-item)) t) |
(setq choice (assoc name prepared-index-alist)) |
886 |
(t |
(if (imenu--subalist-p choice) |
887 |
(setq choice (assoc name prepared-index-alist)) |
(imenu--completion-buffer (cdr choice) prompt) |
888 |
(if (imenu--subalist-p choice) |
choice)))) |
|
(imenu--completion-buffer (cdr choice) prompt) |
|
|
choice))))) |
|
889 |
|
|
890 |
(defun imenu--mouse-menu (index-alist event &optional title) |
(defun imenu--mouse-menu (index-alist event &optional title) |
891 |
"Let the user select from a buffer index from a mouse menu. |
"Let the user select from a buffer index from a mouse menu. |
936 |
(or (eq imenu-use-popup-menu t) mouse-triggered)) |
(or (eq imenu-use-popup-menu t) mouse-triggered)) |
937 |
(imenu--mouse-menu index-alist last-nonmenu-event) |
(imenu--mouse-menu index-alist last-nonmenu-event) |
938 |
(imenu--completion-buffer index-alist prompt))) |
(imenu--completion-buffer index-alist prompt))) |
939 |
(and (eq result t) |
(and (equal result imenu--rescan-item) |
940 |
(imenu--cleanup) |
(imenu--cleanup) |
941 |
(setq imenu--index-alist nil))) |
(setq result t imenu--index-alist nil))) |
942 |
result)) |
result)) |
943 |
|
|
944 |
;;;###autoload |
;;;###autoload |
1013 |
nil)) |
nil)) |
1014 |
|
|
1015 |
(defun imenu-default-goto-function (name position &optional rest) |
(defun imenu-default-goto-function (name position &optional rest) |
1016 |
"Move the point to the given position. |
"Move to the given position. |
1017 |
|
|
1018 |
NAME is ignored. POSITION is where to move. REST is also ignored. |
NAME is ignored. POSITION is where to move. REST is also ignored. |
1019 |
The ignored args just make this function have the same interface as a |
The ignored args just make this function have the same interface as a |
1053 |
|
|
1054 |
(provide 'imenu) |
(provide 'imenu) |
1055 |
|
|
1056 |
;;; arch-tag: 98a2f5f5-4b91-4704-b18c-3aacf77d77a7 |
;; arch-tag: 98a2f5f5-4b91-4704-b18c-3aacf77d77a7 |
1057 |
;;; imenu.el ends here |
;;; imenu.el ends here |