unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Matt <matt@excalamus.com>
To: "emacs-devel" <emacs-devel@gnu.org>
Subject: Globally apply xref-etags-mode
Date: Sat, 11 Nov 2023 12:23:21 +0100	[thread overview]
Message-ID: <18bbe1f43e9.106a5ff881578336.7928824467523752873@excalamus.com> (raw)

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?




             reply	other threads:[~2023-11-11 11:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-11 11:23 Matt [this message]
2023-11-11 13:58 ` Globally apply xref-etags-mode 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18bbe1f43e9.106a5ff881578336.7928824467523752873@excalamus.com \
    --to=matt@excalamus.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).