emacs-devel
[Top][All Lists]
Advanced

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

Patch to make which-function-mode work better with CEDET/Semantic


From: finalpatch
Subject: Patch to make which-function-mode work better with CEDET/Semantic
Date: Mon, 07 Jan 2013 13:58:28 +1100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin)

The Imenu structure generated by Semantic has a slightly different
layout which causes which-function-mode to fall back to the less
accurate add-log-current-defun. This is particularly noticeable when
editing c++ code because add-log-current-defun is often incapable of
parsing c++ methods correctly.

diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 721c610..5e11a56 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -314,7 +314,9 @@ If no function name is found, return nil."
                     namestack (cons (car pair) namestack)
                     alist     (cdr pair)))
 
-             ((number-or-marker-p (setq mark (cdr pair)))
+             ((or (number-or-marker-p (setq mark (cdr pair)))
+                 (and (overlayp (cdr pair))
+                      (setq mark (overlay-start (cdr pair)))))
               (when (and (>= (setq offset (- (point) mark)) 0)
                          (< offset minoffset)) ; Find the closest item.
                 (setq minoffset offset

-- 
Feng Li




reply via email to

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