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:
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
(let ((name (semantic-tag-name tag)))
(setq name (if (string-match "\\`\\([^+\\)[" name)
(match-string 1 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
(regexp-quote name) "\\>")
(goto-char (match-beginning 0))