diff options
| author | Glenn Morris | 2003-04-20 13:04:58 +0000 |
|---|---|---|
| committer | Glenn Morris | 2003-04-20 13:04:58 +0000 |
| commit | d1389042e78ebd76c3bf24712bc8429c4e28b938 (patch) | |
| tree | 3663620d5bee80c8a843e14078f8f6e71ce50ca2 /lisp/which-func.el | |
| parent | be35ca9f5ee2e215506f7a9c729ef59978c0036c (diff) | |
| download | emacs-d1389042e78ebd76c3bf24712bc8429c4e28b938.tar.gz emacs-d1389042e78ebd76c3bf24712bc8429c4e28b938.zip | |
(which-func-modes): Add f90-mode.
(which-function): Handle imenu submenus.
Diffstat (limited to 'lisp/which-func.el')
| -rw-r--r-- | lisp/which-func.el | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/lisp/which-func.el b/lisp/which-func.el index 1d31b3d304a..7b178ab25ea 100644 --- a/lisp/which-func.el +++ b/lisp/which-func.el | |||
| @@ -76,7 +76,7 @@ | |||
| 76 | 76 | ||
| 77 | (defcustom which-func-modes | 77 | (defcustom which-func-modes |
| 78 | '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode makefile-mode | 78 | '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode makefile-mode |
| 79 | sh-mode fortran-mode) | 79 | sh-mode fortran-mode f90-mode) |
| 80 | "List of major modes for which Which Function mode should be used. | 80 | "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, | 81 | 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." | 82 | then Which Function mode is enabled in any major mode that supports it." |
| @@ -216,14 +216,27 @@ If no function name is found, return nil." | |||
| 216 | (setq which-function-imenu-failed t))) | 216 | (setq which-function-imenu-failed t))) |
| 217 | ;; If we have an index alist, use it. | 217 | ;; If we have an index alist, use it. |
| 218 | (when (and (boundp 'imenu--index-alist) imenu--index-alist) | 218 | (when (and (boundp 'imenu--index-alist) imenu--index-alist) |
| 219 | (let ((pair (car-safe imenu--index-alist)) | 219 | (let ((alist imenu--index-alist) |
| 220 | (rest (cdr-safe imenu--index-alist))) | 220 | (minoffset (point-max)) |
| 221 | (while (and (or rest pair) | 221 | offset elem pair mark) |
| 222 | (or (not (number-or-marker-p (cdr pair))) | 222 | (while alist |
| 223 | (> (point) (cdr pair)))) | 223 | (setq elem (car-safe alist) |
| 224 | (setq name (car pair)) | 224 | alist (cdr-safe alist)) |
| 225 | (setq pair (car-safe rest)) | 225 | ;; Elements of alist are either ("name" . marker), or |
| 226 | (setq rest (cdr-safe rest))))) | 226 | ;; ("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))))))) | ||
| 227 | ;; Try using add-log support. | 240 | ;; Try using add-log support. |
| 228 | (when (and (null name) (boundp 'add-log-current-defun-function) | 241 | (when (and (null name) (boundp 'add-log-current-defun-function) |
| 229 | add-log-current-defun-function) | 242 | add-log-current-defun-function) |