unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: finalpatch <fengli@gmail.com>
To: emacs-devel@gnu.org
Subject: Patch to make which-function-mode work better with CEDET/Semantic
Date: Mon, 07 Jan 2013 13:58:28 +1100	[thread overview]
Message-ID: <m21udxem23.fsf@Lis-Mac-Pro.com.au> (raw)

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	other threads:[~2013-01-07  2:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07  2:58 finalpatch [this message]
2013-01-10 15:36 ` Patch to make which-function-mode work better with CEDET/Semantic Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21udxem23.fsf@Lis-Mac-Pro.com.au \
    --to=fengli@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).