help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ancient TAGS references to deleted files remain in memory


From: Benjamin Rutt
Subject: Re: ancient TAGS references to deleted files remain in memory
Date: Fri, 30 Apr 2004 15:21:27 -0400
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Benjamin Rutt <rutt.4+news@osu.edu> writes:

> I rebuild my TAGS files often (like 3 times per hour) via
>
>     find /some/projectdir -name "*.c" -o "*.cpp" -o "*.h"
>
> I have two of these files in tags-table-list.  By updating TAGS files
> often, new methods, variables, etc. that I add in my code are
> frequently picked up automatically by the time I want to visit them
> with M-. or M-x tags-search.
>
> However, sometimes, I delete files from my project directories, yet
> the TAGS file must still somehow contain some entries in memory that
> reference these deleted files.  I get errors like the following during
> M-x tags-search:
>
> Opening input file: no such file or directory, 
> /some/projectdir/STORM/quality/system/stormtestbinaryds.cpp
>
> where the mentioned filename is one I had deleted.

FYI, I'm fixing this for now by killing all TAGS buffers before M-x
tags-search is called:

;; for now, fix bug of files disappearing from TAGS files messing up
;; M-x tags-search.  in the future, fix the logic in
;; `tags-verify-table' to detect files being removed.  The problem is
;; that in the TAGS buffers, the buffer-local variable
;; `tags-table-files' is out of date.
(defadvice tags-search (before kill-TAGS-buffers activate)
  (let ((active-TAGS-bufs
         (delq nil
               (mapcar
                (lambda (x)
                  (if (string-match "TAGS$" (buffer-name x)) x nil))
                (buffer-list)))))
    (mapc
     (lambda (x)
       (kill-buffer x))
     active-TAGS-bufs)))

When I have more time, I'll look at a better solution, maybe a patch
to etags.el is needed.
-- 
Benjamin Rutt


reply via email to

[Prev in Thread] Current Thread [Next in Thread]