[cedet-semantic] bug in senator-search-tag-name
Brought to you by:
zappo
|
From: Raul A. <ra...@ca...> - 2006-01-05 20:04:09
|
While using JDEE to develop Java code in Emacs, I found a bug in
senator-search-tag-name. Finding the definition of the following symbol
from another class fails:
FooBar foo;
It fails in senator-search-tag-name, because it neglects to add "\\>" to
the end of the regexp it uses. So instead of finding foo, it finds
FooBar. Adding "\\>" to the regexp fixes it:
(defun senator-search-tag-name (tag)
"Search for TAG name in current buffer.
Limit the search to TAG bounds.
If found, set point to the end of the name, and return point. The
beginning of the name is at (match-beginning 0).
Return nil if not found, that is if TAG name doesn't come from the
source."
(let ((name (semantic-tag-name tag)))
(setq name (if (string-match "\\`\\([^[]+\\)[[]" name)
(match-string 1 name)
name))
(goto-char (semantic-tag-start tag))
(when (re-search-forward (concat
;; the tag name is expected at the
;; beginning of a word or after a
;; whitespace or a punctuation
"\\(\\<\\|\\s-+\\|\\s.\\)"
(regexp-quote name) "\\>")
(semantic-tag-end tag)
t)
(goto-char (match-beginning 0))
(search-forward name))))
Raul
|