🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #848

Small bug in harris-tags

#848
From: Dave Weisman
Date: Tue, 10 Nov 1992 23:50
131 lines
4581 bytes
There is a small bug in the Harris tags package.  The symptom is
that when using etags files, the wrong location may sometimes be
found.
 
In the function find-tag there are several places where the
buffer-local variable traditional-tags-table is (incorrectly)
examined outside of its buffer.  The fix is to make a copy while
in the correct buffer and subsequently examine the copy.  Context
diff follows.
 
Dave
 
======================================================================
 
*** c:/demacs/lisp2/harris-ta.el	Sat Aug 22 19:41:28 1992
--- c:/demacs/lispdw/harris-ta.el	Mon Nov  9 14:10:48 1992
***************
*** 320,326
    (interactive (if current-prefix-arg
  		   '(nil t)
  		 (find-tag-tag "Find tag: ")))
!   (let (buffer file linebeg startpos startline)
      (save-excursion
        (visit-tags-table-buffer)
        (if next (setq tagname last-tag)
 
--- 320,326 -----
    (interactive (if current-prefix-arg
  		   '(nil t)
  		 (find-tag-tag "Find tag: ")))
!   (let (buffer file linebeg startpos startline traditional-tags-table-copy)
      (save-excursion
        (visit-tags-table-buffer)
  
***************
*** 323,328
    (let (buffer file linebeg startpos startline)
      (save-excursion
        (visit-tags-table-buffer)
        (if next (setq tagname last-tag)
  	(goto-char (point-min))
  	(setq last-tag tagname))
 
--- 323,332 -----
    (let (buffer file linebeg startpos startline traditional-tags-table-copy)
      (save-excursion
        (visit-tags-table-buffer)
+ 
+       ;; We need a local copy for when we're out of the tags buffer. 
+       (setq traditional-tags-table-copy traditional-tags-table)
+ 
        (if next (setq tagname last-tag)
  	(goto-char (point-min))
  	(setq last-tag tagname))
***************
*** 367,373
        (setq tags-file-name tags-file))
      (widen)
      (push-mark)
!     (let ((offset (if traditional-tags-table 1000 20))
  	  found
  	  (pat (concat (if traditional-tags-table "^" "^[ \t]*")
  		       (regexp-quote linebeg))))
 
--- 371,377 -----
        (setq tags-file-name tags-file))
      (widen)
      (push-mark)
!     (let ((offset (if traditional-tags-table-copy 1000 20))
  	  found
  	  (pat (concat (if traditional-tags-table-copy "^" "^[ \t]*")
  		       (regexp-quote linebeg))))
***************
*** 369,375
      (push-mark)
      (let ((offset (if traditional-tags-table 1000 20))
  	  found
! 	  (pat (concat (if traditional-tags-table "^" "^[ \t]*")
  		       (regexp-quote linebeg))))
        (or traditional-tags-table
  	  (setq startpos (if (null startline)
 
--- 373,379 -----
      (push-mark)
      (let ((offset (if traditional-tags-table-copy 1000 20))
  	  found
! 	  (pat (concat (if traditional-tags-table-copy "^" "^[ \t]*")
  		       (regexp-quote linebeg))))
        (or traditional-tags-table-copy
  	  (setq startpos (if (null startline)
***************
*** 371,377
  	  found
  	  (pat (concat (if traditional-tags-table "^" "^[ \t]*")
  		       (regexp-quote linebeg))))
!       (or traditional-tags-table
  	  (setq startpos (if (null startline)
  			     (point-min)
  			   (goto-char 1)
 
--- 375,381 -----
  	  found
  	  (pat (concat (if traditional-tags-table-copy "^" "^[ \t]*")
  		       (regexp-quote linebeg))))
!       (or traditional-tags-table-copy
  	  (setq startpos (if (null startline)
  			     (point-min)
  			   (goto-char 1)
***************
*** 385,391
  	      (re-search-forward pat (+ startpos offset) t))
  	(setq offset (* 3 offset)))
        (or found
! 	  (if traditional-tags-table
  	      (or (re-search-forward pat nil t)
  		  (error "%s not found in %s" pat file))
  	    (re-search-forward pat))))
 
--- 389,395 -----
  	      (re-search-forward pat (+ startpos offset) t))
  	(setq offset (* 3 offset)))
        (or found
! 	  (if traditional-tags-table-copy
  	      (or (re-search-forward pat nil t)
  		  (error "%s not found in %s" pat file))
  	    (re-search-forward pat))))


--

-- Dave
Technical Details
Message-ID: <WEISMAN.92Nov10185013@macaroni.osf.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!netsys!agate!ames!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!osf.ORG!weisman

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!netsys!agate!ames!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!osf.ORG!weisman
From: weisman@osf.ORG (Dave Weisman)
Subject: Small bug in harris-tags
Message-ID: <WEISMAN.92Nov10185013@macaroni.osf.org>
Sender: gnulists@ai.mit.edu
Organization: Open Software Foundation
Distribution: gnu
Date: Tue, 10 Nov 1992 23:50:13 GMT
Approved: bug-gnu-emacs@prep.ai.mit.edu
Lines: 133