unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Globally apply xref-etags-mode
@ 2023-11-11 11:23 Matt
  2023-11-11 13:58 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Matt @ 2023-11-11 11:23 UTC (permalink / raw)
  To: emacs-devel

I'm working from a local copy of a specific org-mode checkout and want xref to navigate within the checkout directory, not within the currently loaded Org mode (which is not /tmp/org-mode).

It seems like xref-etags-mode is what I need.  However, it only appears to apply locally.  I cannot get it to function globally; I must call it on every buffer.

For example, I've built and visited TAGS for /tmp/org-mode.  

cd /tmp
git clone https://git.savannah.gnu.org/git/emacs/org-mode.git
cd org-mode
git -c advice.detachedHead=false checkout 9183e3c723b812360d1042196416d521db590e9f
ctags -eR .

(find-file "/tmp/org-mode/lisp/ob-shell.el")
(visit-tags-table "/tmp/org-mode/TAGS")

I call M-x xref-etags-mode in the buffer visiting ob-shell.el.  I search for "babel-eval" and call xref-find-definitions.  This takes me to /tmp/org-mode/lisp/ob-eval.el as expected.  However, if I check C-h v xref-etags-mode, I see that it's nil in the ob-eval.el buffer.  Calling xref-find-definitions on "org-assert-version", it fails to take me anywhere.  (When I run it with my full init, it takes me to the Emacs system directory lisp/org/org-macs.el.gz.)  Calling M-x xref-etags-mode within the buffer visiting ob-eval.el allows me to call xref-find-definitions and takes me to the expected file, /tmp/org-mode/lisp/org-macs.el.

I can set a hook that calls xref-etags-mode after every jump:

   (add-hook 'xref-after-jump-hook (lambda () (xref-etags-mode 1)))

However, I find all this behavior unexpected.  I would expect xref-etags-mode to apply globally.  It's not clear to me why it's only buffer local.  If there's some reason I'm missing, then I would expect to see a global-xref-etags-mode function.  This don't seem to exist.

Is this expected behavior?  If not, should I put in a PR that adds :global t to the define-minor-mode xref-etags-mode?




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-11-12  9:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-11 11:23 Globally apply xref-etags-mode Matt
2023-11-11 13:58 ` Eli Zaretskii
2023-11-11 14:15   ` Matt
2023-11-12  1:35     ` Dmitry Gutov
2023-11-12  6:22       ` Eli Zaretskii
2023-11-12  9:47       ` Matt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).