[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Globally apply xref-etags-mode
From: |
Matt |
Subject: |
Globally apply xref-etags-mode |
Date: |
Sat, 11 Nov 2023 12:23:21 +0100 |
User-agent: |
Zoho Mail |
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?
- Globally apply xref-etags-mode,
Matt <=