From d1389042e78ebd76c3bf24712bc8429c4e28b938 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 20 Apr 2003 13:04:58 +0000 Subject: [PATCH] (which-func-modes): Add f90-mode. (which-function): Handle imenu submenus. --- lisp/ChangeLog | 15 +++++++++++++++ lisp/which-func.el | 31 ++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c6db178fe8f..b1b6694d069 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,18 @@ +2003-04-20 Glenn Morris + + * which-func.el (which-func-modes): Add f90-mode. + (which-function): Handle imenu submenus. + + * progmodes/fortran.el (fortran-abbrev-start): Make XEmacs + compatible. + + * progmodes/f90.el (f90-font-lock-keywords-2): Use override for + font-lock-variable-name-face in declarations. Highlight + continuation characters. + (f90-indent-new-line): Remove direct call to f90-indent-line-no, + f90-update-line. + (f90-abbrev-start): Fix XEmacs compatibility. + 2003-04-19 Richard M. Stallman * desktop.el (desktop-buffer-mh): Don't require mh-e; 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 @@ (defcustom which-func-modes '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode makefile-mode - sh-mode fortran-mode) + sh-mode fortran-mode f90-mode) "List of major modes for which Which Function mode should be used. For other modes it is disabled. If this is equal to t, 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." (setq which-function-imenu-failed t))) ;; If we have an index alist, use it. (when (and (boundp 'imenu--index-alist) imenu--index-alist) - (let ((pair (car-safe imenu--index-alist)) - (rest (cdr-safe imenu--index-alist))) - (while (and (or rest pair) - (or (not (number-or-marker-p (cdr pair))) - (> (point) (cdr pair)))) - (setq name (car pair)) - (setq pair (car-safe rest)) - (setq rest (cdr-safe rest))))) + (let ((alist imenu--index-alist) + (minoffset (point-max)) + offset elem pair mark) + (while alist + (setq elem (car-safe alist) + alist (cdr-safe alist)) + ;; Elements of alist are either ("name" . marker), or + ;; ("submenu" ("name" . marker) ... ). + (unless (listp (cdr elem)) + (setq elem (list elem))) + (while elem + (setq pair (car elem) + elem (cdr elem)) + (and (consp pair) + (number-or-marker-p (setq mark (cdr pair))) + (if (>= (setq offset (- (point) mark)) 0) + (if (< offset minoffset) ; find the closest item + (setq minoffset offset + name (car pair))) + ;; Entries in order, so can skip all those after point. + (setq elem nil))))))) ;; Try using add-log support. (when (and (null name) (boundp 'add-log-current-defun-function) add-log-current-defun-function) -- 2.39.2