aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath1996-07-23 16:17:33 +0000
committerRoland McGrath1996-07-23 16:17:33 +0000
commita0f09378bb2a14477bbeed175f2418eba7784a6c (patch)
tree0ed372d44d6119ef390c22bedca8023a25b26aeb
parentd64c55d87519cf1a07e2e29d48708806eed95cda (diff)
downloademacs-a0f09378bb2a14477bbeed175f2418eba7784a6c.tar.gz
emacs-a0f09378bb2a14477bbeed175f2418eba7784a6c.zip
(etags-goto-tag-location): New local variable LINE; use it.
Fix typo in direct-file-tag case: position -> startpos. (tag-word-match-p, tag-exact-file-name-match-p): Fix off-by-one errors.
-rw-r--r--lisp/progmodes/etags.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 0afff9a9374..30d9dc84723 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1075,11 +1075,12 @@ See documentation of variable `tags-file-name'."
1075;; a search window which expands until it hits the start of file. 1075;; a search window which expands until it hits the start of file.
1076(defun etags-goto-tag-location (tag-info) 1076(defun etags-goto-tag-location (tag-info)
1077 (let ((startpos (cdr (cdr tag-info))) 1077 (let ((startpos (cdr (cdr tag-info)))
1078 (line (car (cdr tag-info)))
1078 offset found pat) 1079 offset found pat)
1079 (if (eq (car tag-info) t) 1080 (if (eq (car tag-info) t)
1080 ;; Direct file tag. 1081 ;; Direct file tag.
1081 (cond (line (goto-line line)) 1082 (cond (line (goto-line line))
1082 (position (goto-char position)) 1083 (startpos (goto-char startpos))
1083 (t (error "etags.el BUG: bogus direct file tag"))) 1084 (t (error "etags.el BUG: bogus direct file tag")))
1084 ;; This constant is 1/2 the initial search window. 1085 ;; This constant is 1/2 the initial search window.
1085 ;; There is no sense in making it too small, 1086 ;; There is no sense in making it too small,
@@ -1095,8 +1096,8 @@ See documentation of variable `tags-file-name'."
1095 (if startpos (setq startpos (1+ startpos))) 1096 (if startpos (setq startpos (1+ startpos)))
1096 ;; If no char pos was given, try the given line number. 1097 ;; If no char pos was given, try the given line number.
1097 (or startpos 1098 (or startpos
1098 (if (car (cdr tag-info)) 1099 (if line
1099 (setq startpos (progn (goto-line (car (cdr tag-info))) 1100 (setq startpos (progn (goto-line line)
1100 (point))))) 1101 (point)))))
1101 (or startpos 1102 (or startpos
1102 (setq startpos (point-min))) 1103 (setq startpos (point-min)))
@@ -1234,12 +1235,12 @@ See documentation of variable `tags-file-name'."
1234;; point should be just after a string that matches TAG. 1235;; point should be just after a string that matches TAG.
1235(defun tag-word-match-p (tag) 1236(defun tag-word-match-p (tag)
1236 (and (looking-at "\\b.*\177") 1237 (and (looking-at "\\b.*\177")
1237 (save-excursion (backward-char (1+ (length tag))) 1238 (save-excursion (backward-char (length tag))
1238 (looking-at "\\b")))) 1239 (looking-at "\\b"))))
1239 1240
1240(defun tag-exact-file-name-match-p (tag) 1241(defun tag-exact-file-name-match-p (tag)
1241 (and (looking-at ",") 1242 (and (looking-at ",")
1242 (save-excursion (backward-char (1+ (length tag))) 1243 (save-excursion (backward-char (length tag)))
1243 (looking-at "\f\n")))) 1244 (looking-at "\f\n"))))
1244 1245
1245;; t if point is in a tag line with a tag containing TAG as a substring. 1246;; t if point is in a tag line with a tag containing TAG as a substring.