changeset 877:e0dde8b90613

*** empty log message ***
author Roland McGrath <roland@gnu.org>
date Mon, 27 Jul 1992 02:14:20 +0000
parents 6d05b6b123d5
children 5b1c5b4286e7
files lisp/progmodes/etags.el
diffstat 1 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/etags.el	Mon Jul 27 00:59:30 1992 +0000
+++ b/lisp/progmodes/etags.el	Mon Jul 27 02:14:20 1992 +0000
@@ -807,12 +807,29 @@
 
 ;;; Match qualifier functions for tagnames.
 
+(defmacro tags-with-syntax (&rest body)
+  (` (let ((current (current-buffer))
+	   (otable (syntax-table))
+	   (buffer (find-file-noselect (file-of-tag)))
+	   table)
+       (unwind-protect
+	   (progn
+	     (set-buffer buffer)
+	     (setq table (syntax-table))
+	     (set-buffer current)
+	     (set-syntax-table table)
+	     (,@ body))
+	 (set-syntax-table otable)))))
+
 ;; t if point is at a tag line that matches TAG "exactly".
 ;; point should be just after a string that matches TAG.
-(defun tag-exact-match-p (tag)
-  (and (looking-at "[ \t();,]?.*\177")
-       (let ((c (char-after (- (point) (length tag)))))
-	 (or (= c ?\n) (= c ?\ ) (= c ?\t)))))
+(defun tags-exact-match-p (tag)
+  (tags-with-syntax
+   (let ((end (point)))
+     (unwind-protect
+	 (= (match-beginning 0)
+	    (re-search-backward "\\(\\sw\\|\\s_\\)+" end t))
+       (goto-char end)))))
 
 ;; t if point is at a tag line that matches TAG as a word.
 ;; point should be just after a string that matches TAG.