GNU bug report logs -
#71727
Deleting TAGS buffer will cause `etags-regen--update-file` doesn't work
Previous Next
Reported by: Siyuan Chen <chansey97 <at> gmail.com>
Date: Sat, 22 Jun 2024 23:57:02 UTC
Severity: normal
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Thu, 11 Jul 2024 03:50:15 +0300
with message-id <d7b163cc-0183-4d60-b468-dd95adeb0b35 <at> gutov.dev>
and subject line Re: bug#71727: Deleting TAGS buffer will cause `etags-regen--update-file` doesn't work
has caused the debbugs.gnu.org bug report #71727,
regarding Deleting TAGS buffer will cause `etags-regen--update-file` doesn't work
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
71727: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71727
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Reproduce steps:
1. init.el
```
(setq etags-regen-program "C:/green/emacs/emacs-29.3/bin/etags.exe")
(require 'etags-regen)
```
2. Open test.c with the following code
```
#define APPLICATION_WINDOW_WIDTH 320
```
3. M-x etags-regen-mode
4. Move the cursor to APPLICATION_WINDOW_WIDTH and M-x
xref-find-definitions. Then the TAGS file is created and the
APPLICATION_WINDOW_WIDTH line is highlighted (good).
5. M-x kill-buffer TAGS
6. Add `#define APPLICATION_WINDOW_HEIGHT 320` to test.c and M-x save-buffer
7. Move the cursor to APPLICATION_WINDOW_HEIGHT and M-x
xref-find-definitions.
The expected behavior: The TAGS file is updated and the
APPLICATION_WINDOW_HEIGHT line is highlighted.
The actual behavior: The echo area reports: "No definition found for:
APPLICATION_WINDOW_HEIGHT"
Note that if I don't do step-5 then everything is OK.
Emacs 29.3 has no this feature, I make it available via copy & paste
etags-regen.el to load-path. I think this issue has nothing to do with the
Emacs version though.
Thanks.
Best regards,
Siyuan Chen
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
Now pushed to emacs-30, please report any further problems.
On 09/07/2024 05:50, Dmitry Gutov wrote:
> On 29/06/2024 14:49, Siyuan Chen wrote:
>> > Is there are particular reason you killed the TAGS buffer?
>>
>> No. I found this bug is just because I tried to view the TAGS content
>> while editing a .c file and then closed it (I am using tab-line-mode
>> with tab-line-close-tab-function set to kill-buffer). Since then, I
>> have stopped closing the TAGS buffer.
>
> Thanks for the clarification.
>
>> Another option is to temporarily add documentation advising users not
>> to close the TAGS buffer, because closing it accidentally can result
>> in the odd behavior.
>
> I think actually a simpler approach can suffice: using kill-buffer-hook
> in the TAGS buffer. Like this:
>
> diff --git a/lisp/progmodes/etags-regen.el b/lisp/progmodes/etags-regen.el
> index dc778b14061..21ea9bfb8b3 100644
> --- a/lisp/progmodes/etags-regen.el
> +++ b/lisp/progmodes/etags-regen.el
> @@ -294,7 +294,9 @@ etags-regen--visit-table
> (add-hook 'before-save-hook #'etags-regen--mark-as-new)
> (setq etags-regen--tags-file tags-file
> etags-regen--tags-root root)
> - (visit-tags-table etags-regen--tags-file))
> + (visit-tags-table etags-regen--tags-file)
> + (with-current-buffer (get-file-buffer tags-file)
> + (add-hook 'kill-buffer-hook #'etags-regen--tags-cleanup nil t)))
>
> (defun etags-regen--ctags-p ()
> (string-search "Ctags"
> @@ -390,7 +392,8 @@ etags-regen--mark-as-new
>
> (defun etags-regen--tags-cleanup ()
> (when etags-regen--tags-file
> - (let ((buffer (get-file-buffer etags-regen--tags-file)))
> + (let ((buffer (get-file-buffer etags-regen--tags-file))
> + kill-buffer-hook)
> (and buffer
> (kill-buffer buffer)))
> (tags-reset-tags-tables)
This bug report was last modified 317 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.