Subject: bug#43086: [PATCH] Allow tags backend to not query for TAGS file

From: Dmitry Gutov <[email-masked]>
Date: Sat, 7 Sep 2024 01:16:46 +0300

On 03/09/2024 19:39, Philip Kaludercic wrote:
>>> I could imagine this might be extended to allow an auto-generate option,
>>> but that feature seems out of scope of this patch, and probably would
>>> require some interoperation with project.el.
>> Indeed. Actually, I have an old, WIP patch for tag file
>> auto-generation which, yes, uses project.el. I can post it again if
>> you're curious.
> Hasn't this issue been resolved by `etags-regen-mode'?

The part quoted above was, I think.

What might still be missing, is functioning better without having a tags 
table generated - after all etags-regen-mode is off by default, and it 
might not work for certain projects anyway.

Maybe just like this? This makes Xref identifier completion not query 
for TAGS unless already loaded. In many cases that would be TRT, 
although `C-u M-.` seems to regress (seems like we *would* want to query 
eagerly there).

Adding a user option is still... an option.

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index d3eb0d46e9b..a4e9abe9b7a 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -2102,7 +2102,9 @@ xref-backend-identifier-at-point

  (cl-defmethod xref-backend-identifier-completion-table ((_backend
                                                           (eql 'etags)))
-  (tags-lazy-completion-table))
+  (and (or tags-file-name
+           tags-table-list)
+       (tags-lazy-completion-table)))

  (cl-defmethod xref-backend-identifier-completion-ignore-case ((_backend
                                                                 (eql 
'etags)))