GNU bug report logs -
#67687
Feature request: automatic tags management
Previous Next
Reported by: Jon Eskin <eskinjp <at> gmail.com>
Date: Thu, 7 Dec 2023 11:45:02 UTC
Severity: wishlist
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 01/01/2024 19:39, Eli Zaretskii wrote:
>> Date: Mon, 1 Jan 2024 19:23:28 +0200
>> Cc: stefankangas <at> gmail.com, eskinjp <at> gmail.com, 67687 <at> debbugs.gnu.org,
>> michael.albinus <at> gmx.de
>> From: Dmitry Gutov <dmitry <at> gutov.dev>
>>
>> On 01/01/2024 18:50, Eli Zaretskii wrote:
>>>> +The exception is made when the user has already selected a tags
>>>> +table manually (for example, using \\[visit-tags-table]). Then
>>>> +this mode doesn't do anything. Reset the visited tags tables
>>>> +using \\[tags-reset-tags-tables]."
>>>
>>> The above is only true for the project whose TAGS was manually
>>> visited, right? IOW, it's not that once the use invokes
>>> visit-tags-table once, this mode will be effectively disabled for the
>>> entire session, right?
>>
>> No, it's the latter. It's off for the whole session, just like a visited
>> TAGS file is active for the whole session (not limited to any specific
>> project).
>
> OK, then please tweak my suggested text to explain the situation
> correctly instead.
How about this?
If you select a tags table manually (for example, using
\\[visit-tags-table]), then this mode will be effectively
disabled for the entire session. Use \\[tags-reset-tags-tables]
to countermand the effect of a previous \\[visit-tags-table].
>> a tags file, in general, can't always be attributed to a specific
>> project.
>
> That's too bad, IMO, but it's a separate issue. One of the annoyances
> I had with tags was that it was difficult to have several independent
> tags tables loaded, each one for a different set of sources. I hoped
> that project.el has solved this already, but I guess we are not there
> yet.
etags-regen-mode kind of solves that, by checking and resynchronizing
tags tables when you switch between projects. That works when a tags
file already exists with the recognized name in that other project (e.g.
because you worked on it just recently).
Projectile has a different solution using local tags tables, which is
easy to adapt to project.el:
(defun project-visit-tags ()
(let* ((pr (project-current))
(tags-file (and pr
(expand-file-name "TAGS" (project-root pr)))))
(and tags-file
(file-exists-p tags-file)
(visit-tags-table tags-file t))))
(add-hook 'find-file-hook #'project-visit-tags)
And if you limit the above to only certain projects (by e.g. checking
for some additional file in the directory), then etags-regen-mode should
stay active in the other projects, because it won't see the buffer-local
bindings for tags-file-name and tags-table-list (the above snippet keeps
the global value nil).
The buffer-local tag tables are not that well-tested overall (e.g. even
tags-reset-tags-tables resets the local binding, if available, rather
than the global one), but this combination should work in a personal config.
This bug report was last modified 1 year and 142 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.