/[emacs]/emacs/lisp/which-func.el
ViewVC logotype

Diff of /emacs/lisp/which-func.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.29 by lektu, Tue Feb 4 12:14:20 2003 UTC revision 1.30 by gm, Sun Apr 20 13:04:14 2003 UTC
# Line 76  Line 76 
76    
77  (defcustom which-func-modes  (defcustom which-func-modes
78    '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode makefile-mode    '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode makefile-mode
79                      sh-mode fortran-mode)                      sh-mode fortran-mode f90-mode)
80    "List of major modes for which Which Function mode should be used.    "List of major modes for which Which Function mode should be used.
81  For other modes it is disabled.  If this is equal to t,  For other modes it is disabled.  If this is equal to t,
82  then Which Function mode is enabled in any major mode that supports it."  then Which Function mode is enabled in any major mode that supports it."
# Line 216  If no function name is found, return nil Line 216  If no function name is found, return nil
216          (setq which-function-imenu-failed t)))          (setq which-function-imenu-failed t)))
217      ;; If we have an index alist, use it.      ;; If we have an index alist, use it.
218      (when (and (boundp 'imenu--index-alist) imenu--index-alist)      (when (and (boundp 'imenu--index-alist) imenu--index-alist)
219        (let ((pair (car-safe imenu--index-alist))        (let ((alist imenu--index-alist)
220              (rest (cdr-safe imenu--index-alist)))              (minoffset (point-max))
221          (while (and (or rest pair)              offset elem pair mark)
222                      (or (not (number-or-marker-p (cdr pair)))          (while alist
223                          (> (point) (cdr pair))))            (setq elem  (car-safe alist)
224            (setq name (car pair))                  alist (cdr-safe alist))
225            (setq pair (car-safe rest))            ;; Elements of alist are either ("name" . marker), or
226            (setq rest (cdr-safe rest)))))            ;; ("submenu" ("name" . marker) ... ).
227              (unless (listp (cdr elem))
228                  (setq elem (list elem)))
229              (while elem
230                (setq pair (car elem)
231                      elem (cdr elem))
232                (and (consp pair)
233                     (number-or-marker-p (setq mark (cdr pair)))
234                     (if (>= (setq offset (- (point) mark)) 0)
235                         (if (< offset minoffset) ; find the closest item
236                             (setq minoffset offset
237                                   name (car pair)))
238                       ;; Entries in order, so can skip all those after point.
239                       (setq elem nil)))))))
240      ;; Try using add-log support.      ;; Try using add-log support.
241      (when (and (null name) (boundp 'add-log-current-defun-function)      (when (and (null name) (boundp 'add-log-current-defun-function)
242                 add-log-current-defun-function)                 add-log-current-defun-function)

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26