unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* which-function-mode and imenu submenus
@ 2003-04-13 17:49 Glenn Morris
  0 siblings, 0 replies; only message in thread
From: Glenn Morris @ 2003-04-13 17:49 UTC (permalink / raw)



imenu--index-alist may be defined so as to contain submenus. For
example, the value for emacs-lisp mode has submenus for "Types" and
"Variables". which-function doesn't understand imenu submenus, so
that, for example, if one activates which-function-mode in
which-function.el and places the cursor inside the definition of the
variable which-func-current, one just sees "Variables" in the
mode-line rather than the actual name of the variable.

Does this patch look OK?

===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/which-func.el,v
retrieving revision 1.29
diff -c -r1.29 which-func.el
*** which-func.el	4 Feb 2003 12:14:20 -0000	1.29
--- which-func.el	13 Apr 2003 17:47:05 -0000
***************
*** 76,82 ****
  
  (defcustom which-func-modes
    '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode makefile-mode
! 		    sh-mode fortran-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)
    "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,229 ****
  	(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)))))
      ;; Try using add-log support.
      (when (and (null name) (boundp 'add-log-current-defun-function)
  	       add-log-current-defun-function)
--- 216,239 ----
  	(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)
!         (while alist
!           (setq elem  (car-safe alist)
!                 alist (cdr-safe alist))
!           (and (number-or-marker-p (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)
!                      (and (< offset minoffset)
!                           (setq minoffset offset
!                                 name (car pair)))
!                    (setq elem nil)))))))
      ;; Try using add-log support.
      (when (and (null name) (boundp 'add-log-current-defun-function)
  	       add-log-current-defun-function)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-04-13 17:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-13 17:49 which-function-mode and imenu submenus Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).