emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/which-func.el


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/which-func.el
Date: Tue, 30 Sep 2003 08:53:26 -0400

Index: emacs/lisp/progmodes/which-func.el
diff -c emacs/lisp/progmodes/which-func.el:1.2 
emacs/lisp/progmodes/which-func.el:1.3
*** emacs/lisp/progmodes/which-func.el:1.2      Mon Sep  1 11:45:36 2003
--- emacs/lisp/progmodes/which-func.el  Tue Sep 30 08:53:26 2003
***************
*** 76,82 ****
  
  (defcustom which-func-modes
    '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode makefile-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."
--- 76,82 ----
  
  (defcustom which-func-modes
    '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode makefile-mode
!                   sh-mode fortran-mode f90-mode ada-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."
***************
*** 206,225 ****
  (defvar which-function-imenu-failed nil
    "Locally t in a buffer if `imenu--make-index-alist' found nothing there.")
  
  (defun which-function ()
    "Return current function name based on point.
! Uses `imenu--index-alist' or `add-log-current-defun-function'.
  If no function name is found, return nil."
    (let (name)
      ;; If Imenu is loaded, try to make an index alist with it.
!     (when (and (boundp 'imenu--index-alist) (null imenu--index-alist)
               (null which-function-imenu-failed))
        (imenu--make-index-alist)
        (unless imenu--index-alist
        (make-local-variable 'which-function-imenu-failed)
        (setq which-function-imenu-failed t)))
      ;; If we have an index alist, use it.
!     (when (and (boundp 'imenu--index-alist) imenu--index-alist)
        (let ((alist imenu--index-alist)
              (minoffset (point-max))
              offset elem pair mark)
--- 206,242 ----
  (defvar which-function-imenu-failed nil
    "Locally t in a buffer if `imenu--make-index-alist' found nothing there.")
  
+ (defvar which-func-functions nil
+   "List of functions for `which-function' to call with no arguments.
+ It calls them sequentially, and if any returns non-nil,
+ `which-function' uses that name and stops looking for the name.")
+ 
  (defun which-function ()
    "Return current function name based on point.
! Uses `which-function-functions', `imenu--index-alist'
! or `add-log-current-defun-function'.
  If no function name is found, return nil."
    (let (name)
+     ;; Try the which-function-functions functions first.
+     (let ((hooks which-func-functions))
+       (while hooks
+       (let ((value (funcall (car hooks))))
+         (when value
+           (setq name value
+                 hooks nil)))
+       (setq hooks (cdr hooks))))
+ 
      ;; If Imenu is loaded, try to make an index alist with it.
!     (when (and (null name)
!              (boundp 'imenu--index-alist) (null imenu--index-alist)
               (null which-function-imenu-failed))
        (imenu--make-index-alist)
        (unless imenu--index-alist
        (make-local-variable 'which-function-imenu-failed)
        (setq which-function-imenu-failed t)))
      ;; If we have an index alist, use it.
!     (when (and (null name)
!              (boundp 'imenu--index-alist) imenu--index-alist)
        (let ((alist imenu--index-alist)
              (minoffset (point-max))
              offset elem pair mark)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]