Re: [CEDET-devel] possible bugs in senator.el and wisent-java.wy
Brought to you by:
zappo
From: David P. <dav...@wa...> - 2005-05-13 08:10:01
|
Hi, > 2) wisent-java.wy create tags for java initializer code regions of > the semantic class 'block with tag name "block". This confuses > senator-search-tag-name because it cannot find the string "block" > in the tag. For example, if you have the following in a java > file: > > static { > System.out.println ("test"); > } > > (senator-re-search-forward "print") will display the message > let: Search failed: "\\(\\<\\|\\s-+\\|\\s.\\)block" > but will move point to the first print statement. I committed the following patch to make senator-search-tag-name more robust about such cases. So `senator-search' no more fails when the TAG name doesn't exist (that is, doesn't come from source). David 2005-05-13 David Ponce <da...@dp...> * cedet/semantic/senator.el (senator-search-tag-name): Don't fail if TAG name doesn't come from source. Doc fix. (senator-search): Likewise. Index: senator.el =================================================================== RCS file: /cvsroot/cedet/cedet/semantic/senator.el,v retrieving revision 1.104 diff -c -r1.104 senator.el *** senator.el 30 Apr 2005 18:05:17 -0000 1.104 --- senator.el 13 May 2005 07:58:18 -0000 *************** *** 449,470 **** ;;;; (defun senator-search-tag-name (tag) ! "Search the TAG name in TAG bounds. ! Set point to the end of the name, and return point. To get the ! beginning of the name use (match-beginning 0)." (let ((name (semantic-tag-name tag))) (setq name (if (string-match "\\`\\([^[]+\\)[[]" name) (match-string 1 name) name)) (goto-char (semantic-tag-start tag)) ! (re-search-forward (concat ! ;; the tag name is at the beginning of a ! ;; word or after a whitespace or a punctuation ! "\\(\\<\\|\\s-+\\|\\s.\\)" ! (regexp-quote name)) ! (semantic-tag-end tag)) ! (goto-char (match-beginning 0)) ! (search-forward name))) (defcustom senator-search-tag-filter nil "*Function that filter searched tags. --- 449,475 ---- ;;;; (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)))) (defcustom senator-search-tag-filter nil "*Function that filter searched tags. *************** *** 494,501 **** (and (setq tag (semantic-current-tag)) (or (null senator-search-tag-filter) (funcall senator-search-tag-filter tag)) ! (setq tend (senator-search-tag-name tag) ! tstart (match-beginning 0) found (and (>= sstart tstart) (<= send tend) (zerop (setq count (1- count)))))) --- 499,506 ---- (and (setq tag (semantic-current-tag)) (or (null senator-search-tag-filter) (funcall senator-search-tag-filter tag)) ! (setq tend (senator-search-tag-name tag)) ! (setq tstart (match-beginning 0) found (and (>= sstart tstart) (<= send tend) (zerop (setq count (1- count)))))) |