* lisp/progmodes/etags-regen.el (etags-regen--visit-table):
Use kill-buffer-hook to ensure a refresh if the TAGS buffer is
killed manually (bug#71727).
(etags-regen--tags-cleanup):
Bind the hook var to nil to avoid an infloop.
(cherry picked from commit
9331ab056a426b334d46c38659c9de2053eb45f3)
(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"
(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)