From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: auto-refresh TAGS file on ChangeLog mod? Date: Fri, 22 Aug 2008 10:30:19 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <86wsi9t6d0.fsf@lifelogs.com> References: <86iqtyxuqc.fsf@lifelogs.com> <86tzde8oc6.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1219418744 5051 80.91.229.12 (22 Aug 2008 15:25:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Aug 2008 15:25:44 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 22 17:26:33 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KWYX1-0000K2-Kz for ged-emacs-devel@m.gmane.org; Fri, 22 Aug 2008 17:26:31 +0200 Original-Received: from localhost ([127.0.0.1]:39659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWYW3-00074h-Pw for ged-emacs-devel@m.gmane.org; Fri, 22 Aug 2008 11:25:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWYVz-00074Z-70 for emacs-devel@gnu.org; Fri, 22 Aug 2008 11:25:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWYVy-00074N-Rc for emacs-devel@gnu.org; Fri, 22 Aug 2008 11:25:26 -0400 Original-Received: from [199.232.76.173] (port=47066 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWYVy-00074K-Ig for emacs-devel@gnu.org; Fri, 22 Aug 2008 11:25:26 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:49893 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KWYVx-0002ml-V6 for emacs-devel@gnu.org; Fri, 22 Aug 2008 11:25:26 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KWYVv-0002Wy-7X for emacs-devel@gnu.org; Fri, 22 Aug 2008 15:25:23 +0000 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Aug 2008 15:25:23 +0000 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Aug 2008 15:25:23 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:ulFGc+EDJu9TAbILMGQUeuE1JEE= X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:102827 Archived-At: On Thu, 21 Aug 2008 10:31:26 -0600 Tom Tromey wrote: Tom> I tried to solve this problem a couple times. Actually, I tried to Tom> solve the more general problem of auto-updating TAGS in response to Tom> any change, not just a change to some sentinel file. Tom> Once I wrote a big patch to put the etags command-line arguments into Tom> the TAGS file, so you could reliably re-run etags when a file was Tom> saved. This never went in; in the end I think it is not the best Tom> approach, since it doesn't handle changes occurring outside of Emacs, Tom> and it doesn't have a way to handle new files. Tom> My next approach was a "retags" script. This uses inotify to watch Tom> for file changes, then re-runs etags. It uses a simple ".retags" file Tom> to decide how to invoke etags -- this solves the "new file" problem. Tom> I can send retags to you if you want. I posted it to emacs-sources Tom> once. It is pretty slow, especially the first time it starts. That Tom> is the main reason I don't use it. Tom> I've wanted to roll the retags idea into etags itself. It could read Tom> a ".retags" file, daemonize, and use inotify to watch for changes in a Tom> directory tree. I never found the time to do it though. I'd like the solution to be implemented in Emacs, not externally. Emacs doesn't have inotify facilities AFAIK, but (like D-BUS) such system support should be possible. The protocol, according to http://lwn.net/Articles/142751/, is not too complicated. Is that a possibility? If so, Emacs could watch for changes anywhere in the directory where the TAGS file was found and, when changes occur, it could redo the indexing. I'm sure other packages could use inotify support as well. Until inotify support, the list of files can be built when TAGS is loaded (it has the file names), and then rescanned when needed. For most cases that will perform OK. New files of interest can probably be inferred by building a list of extensions in TAGS; if you have .c files already then you'll want new.c as well. I think anything more than this should require manual reindexing or some user configuration of "I want to tag all *.c files." Remembering the original list of files is not needed, right? Can you just run "etags --append new_or_updated_files"? I think it's OK to have outdated (deleted) entries in TAGS until a full rescan is done by the user; I can't think of any other problems with this. Ted