* Using xref-find-definitions @ 2023-10-06 18:38 Patrick Mahan 2023-10-07 6:02 ` Eli Zaretskii 0 siblings, 1 reply; 4+ messages in thread From: Patrick Mahan @ 2023-10-06 18:38 UTC (permalink / raw) To: Help Gnu Emacs I am running 25.2.2 on Ubuntu 18.04 release. I am working on a large software project, with lots of subdirectories and lots of files. Originally, TAGS are built using the cascading makefiles (one per directory) so you get a TAGS file in each directory and as you move up the TAGS file also incorporates the ones below it (without the use of the --include command). In my emacs init file I have tags-table-list set to the list of locations for the tag files - (setq tags-table-list (list "./" "../" (concat (getenv "WORK") "/src/lib") (concat (getenv "WORK") "/src/bin") (concat (getenv "WORK") "/src/include") (concat (getenv "WORK") "/src")))) This has worked well for a while now using the older find-tags command. But now that command is no longer supported and I need to use xref-find-definitions. Which works fine, for the most part, but occasionally I run across the following issue - An *xref* buffer appears with the following - /home/pmahan/workspaces/myos/src/bin/mserv/appclass/my_ipserv.c 109: void flow_log( /home/pmahan/workspaces/myos/src/bin/mserv/appclass/my_ipserv.c 109: void flow_log( When I was using find-tag, it would give me the first hit, then I could do CTRL-u M-. to go to the next entry. I would not have this presented. In the new method, this is churning my buffer displays around which is annoying, especially when the entry is in the same code module. My current assumption is that this is due to all of the various TAGS files that have duplicate entries. Is it time to change how we generate TAGS? Or can I configure xref-find-definitions to handle this situation. Thanks, Patrick ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Using xref-find-definitions 2023-10-06 18:38 Using xref-find-definitions Patrick Mahan @ 2023-10-07 6:02 ` Eli Zaretskii 2023-10-07 7:35 ` Patrick Mahan 0 siblings, 1 reply; 4+ messages in thread From: Eli Zaretskii @ 2023-10-07 6:02 UTC (permalink / raw) To: help-gnu-emacs > From: Patrick Mahan <plmahan@gmail.com> > Date: Fri, 6 Oct 2023 11:38:18 -0700 > > An *xref* buffer appears with the following - > /home/pmahan/workspaces/myos/src/bin/mserv/appclass/my_ipserv.c > 109: void flow_log( > /home/pmahan/workspaces/myos/src/bin/mserv/appclass/my_ipserv.c > 109: void flow_log( > > When I was using find-tag, it would give me the first hit, then I could do > CTRL-u M-. to go to the next entry. I would not have this presented. In > the new method, this is churning my buffer displays around which is > annoying, especially when the entry is in the same code module. I don't understand this description. Can you explain in more detail what happens with Xref and why this is annoying? The Emacs user manual says about M-. and similar commands: If any of the above commands finds more than one matching definition, it by default pops up the ‘*xref*’ buffer showing the matching candidates. (‘C-M-.’ _always_ pops up the ‘*xref*’ buffer if it finds at least one match.) The candidates are normally shown in that buffer as the name of a file and the matching identifier(s) in that file. In that buffer, you can select any of the candidates for display, and you have several additional commands, described in *note Xref Commands::. However, if the value of the variable ‘xref-auto-jump-to-first-definition’ is ‘move’, the first of these candidates is automatically selected in the ‘*xref*’ buffer, and if it’s ‘t’ or ‘show’, the first candidate is automatically shown in its own window; ‘t’ also selects the window showing the first candidate. The default value is ‘nil’, which just shows the candidates in the ‘*xref*’ buffer, but doesn’t select any of them. You are supposed to use these facilities instead of "C-u M-.". Did you try that? > My current assumption is that this is due to all of the various TAGS files > that have duplicate entries. Is it time to change how we generate TAGS? What is the problem with the way you generate TAGS? You could, of course, generate just one TAGS file instead of having a TAGS file in each directory, but duplicate entries can happen anyway. > Or can I configure xref-find-definitions to handle this situation. See above. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Using xref-find-definitions 2023-10-07 6:02 ` Eli Zaretskii @ 2023-10-07 7:35 ` Patrick Mahan 2023-10-07 19:05 ` Patrick Mahan 0 siblings, 1 reply; 4+ messages in thread From: Patrick Mahan @ 2023-10-07 7:35 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs On Fri, Oct 6, 2023 at 11:02 PM Eli Zaretskii <eliz@gnu.org> wrote: > > From: Patrick Mahan <plmahan@gmail.com> > > Date: Fri, 6 Oct 2023 11:38:18 -0700 > > > > An *xref* buffer appears with the following - > > /home/pmahan/workspaces/myos/src/bin/mserv/appclass/my_ipserv.c > > 109: void flow_log( > > /home/pmahan/workspaces/myos/src/bin/mserv/appclass/my_ipserv.c > > 109: void flow_log( > > > > When I was using find-tag, it would give me the first hit, then I could > do > > CTRL-u M-. to go to the next entry. I would not have this presented. In > > the new method, this is churning my buffer displays around which is > > annoying, especially when the entry is in the same code module. > > I don't understand this description. Can you explain in more detail > what happens with Xref and why this is annoying? > > The Emacs user manual says about M-. and similar commands: > > If any of the above commands finds more than one matching definition, > it by default pops up the ‘*xref*’ buffer showing the matching > candidates. (‘C-M-.’ _always_ pops up the ‘*xref*’ buffer if it finds > at least one match.) The candidates are normally shown in that buffer > as the name of a file and the matching identifier(s) in that file. In > that buffer, you can select any of the candidates for display, and you > have several additional commands, described in *note Xref Commands::. > However, if the value of the variable > ‘xref-auto-jump-to-first-definition’ is ‘move’, the first of these > candidates is automatically selected in the ‘*xref*’ buffer, and if it’s > ‘t’ or ‘show’, the first candidate is automatically shown in its own > window; ‘t’ also selects the window showing the first candidate. The > default value is ‘nil’, which just shows the candidates in the ‘*xref*’ > buffer, but doesn’t select any of them. > > You are supposed to use these facilities instead of "C-u M-.". Did > you try that? > > Not really since I have not updated my last copy of the emacs manual and I tend to find it clumsy to navigate anyways. I tend to fall back to the Emacs Wiki or rely on google-fu to find my answer. I do use the xref-find-definition commands, via the keystrokes described (M-., CTRL-x 4 ., etc). What I was wanting to stop seeing was the multiple entries because my TAGS tables would have not only the local directory but any identifiers from the sub-directories. That tends to consistently pop-up the other *xref* buffer when I would rather just jump to the first entry found, most of the time. I will miss the option to jump to the next entry, but I suppose then I can always switch to the *xref* buffer and select another definition. But now that `xref-auto-jump-to-first-definition` has been pointed out, I can at least eliminate this annoyance. > My current assumption is that this is due to all of the various TAGS files > > that have duplicate entries. Is it time to change how we generate TAGS? > > What is the problem with the way you generate TAGS? > > I am waffling on creating hierarchical series of TAGS files as I do currently or to just create one large one at the top of the source tree in an effort to avoid having an identifier seen via multiple TAGS files. Thanks for the feedback, Patrick ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Using xref-find-definitions 2023-10-07 7:35 ` Patrick Mahan @ 2023-10-07 19:05 ` Patrick Mahan 0 siblings, 0 replies; 4+ messages in thread From: Patrick Mahan @ 2023-10-07 19:05 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs On Sat, Oct 7, 2023 at 12:35 AM Patrick Mahan <plmahan@gmail.com> wrote: > On Fri, Oct 6, 2023 at 11:02 PM Eli Zaretskii <eliz@gnu.org> wrote: > >> > From: Patrick Mahan <plmahan@gmail.com> >> > Date: Fri, 6 Oct 2023 11:38:18 -0700 >> > >> > An *xref* buffer appears with the following - >> > /home/pmahan/workspaces/myos/src/bin/mserv/appclass/my_ipserv.c >> > 109: void flow_log( >> > /home/pmahan/workspaces/myos/src/bin/mserv/appclass/my_ipserv.c >> > 109: void flow_log( >> > >> > When I was using find-tag, it would give me the first hit, then I could >> do >> > CTRL-u M-. to go to the next entry. I would not have this presented. >> In >> > the new method, this is churning my buffer displays around which is >> > annoying, especially when the entry is in the same code module. >> >> I don't understand this description. Can you explain in more detail >> what happens with Xref and why this is annoying? >> >> The Emacs user manual says about M-. and similar commands: >> >> If any of the above commands finds more than one matching definition, >> it by default pops up the ‘*xref*’ buffer showing the matching >> candidates. (‘C-M-.’ _always_ pops up the ‘*xref*’ buffer if it finds >> at least one match.) The candidates are normally shown in that buffer >> as the name of a file and the matching identifier(s) in that file. In >> that buffer, you can select any of the candidates for display, and you >> have several additional commands, described in *note Xref Commands::. >> However, if the value of the variable >> ‘xref-auto-jump-to-first-definition’ is ‘move’, the first of these >> candidates is automatically selected in the ‘*xref*’ buffer, and if it’s >> ‘t’ or ‘show’, the first candidate is automatically shown in its own >> window; ‘t’ also selects the window showing the first candidate. The >> default value is ‘nil’, which just shows the candidates in the ‘*xref*’ >> buffer, but doesn’t select any of them. >> >> You are supposed to use these facilities instead of "C-u M-.". Did >> you try that? >> >> > Not really since I have not updated my last copy of the emacs manual and I > tend to find it clumsy to navigate anyways. I tend to fall back to the > Emacs Wiki or rely on google-fu to find my answer. I do use the > xref-find-definition commands, via the keystrokes described (M-., CTRL-x 4 > ., etc). What I was wanting to stop seeing was the multiple entries > because my TAGS tables would have not only the local directory but any > identifiers from the sub-directories. That tends to consistently pop-up > the other *xref* buffer when I would rather just jump to the first entry > found, most of the time. I will miss the option to jump to the next entry, > but I suppose then I can always switch to the *xref* buffer and select > another definition. > > But now that `xref-auto-jump-to-first-definition` has been pointed out, I > can at least eliminate this annoyance. > > Hmmm, obviously I spoke too soon. I did mention in my original post that I was using emacs 25.2. It turns out that `xref-auto-jump-to-first-definition` does not exist in the xref.el shipped with emacs 25.2. It looks like I need to fallback to the solution proposed here - https://emacs.stackexchange.com/questions/61384/how-to-go-to-the-first-definition-with-xref-find-definitions-do-not-show-all-op Just in case somebody else is in my situation. Thanks, Patrick ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-07 19:05 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-10-06 18:38 Using xref-find-definitions Patrick Mahan 2023-10-07 6:02 ` Eli Zaretskii 2023-10-07 7:35 ` Patrick Mahan 2023-10-07 19:05 ` Patrick Mahan
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.