From: Eli Zaretskii <eliz@gnu.org>
To: Dmitry Gutov <dgutov@yandex.ru>,
Stefan Monnier <monnier@iro.umontreal.ca>,
Tassilo Horn <tsdh@gnu.org>
Cc: 53749@debbugs.gnu.org, larsi@gnus.org, stefankangas@gmail.com,
dfussner@googlemail.com
Subject: bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers
Date: Thu, 14 Sep 2023 09:10:06 +0300 [thread overview]
Message-ID: <831qf1mgjl.fsf@gnu.org> (raw)
In-Reply-To: <2c5c8afa-b57e-3156-d21c-5523cacb4d87@yandex.ru> (message from Dmitry Gutov on Thu, 14 Sep 2023 02:59:33 +0300)
> Cc: 53749@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>,
> Stefan Kangas <stefankangas@gmail.com>
> Date: Thu, 14 Sep 2023 02:59:33 +0300
> From: Dmitry Gutov <dgutov@yandex.ru>
>
> On 13/09/2023 20:01, David Fussner via Bug reports for GNU Emacs, the
> Swiss army knife of text editors wrote:
>
> >> These won't be affected either way, right? Because project-find-regexp
> >> defaults its input to (thing-at-point 'symbol t), and isearch...
> >> probably also uses "symbol" if you ask it to.
> >>
> >> So... why not just make tex-thingatpt-include-escape a boolean? What
> >> commands need to be distinguished that way? I think 'find-tag' (it's
> >> obsolete but still used sometimes) would need to obey this var as well.
> >
> > xref-find-apropos and xref-find-references don't work well (or at all)
> > with the escape char included in the search string, so I was keeping
> > that char away from them. (The buffer-local variables I manipulate for
> > project-find-regexp and isearch-forward-thing-at-point have to do with
> > ensuring they use the texsymbol thing in the first place -- see
> > tex--symbol-or-texsymbol.) Does that make sense?
>
> Hmm, I suppose I skipped over that part of the patch too quickly.
>
> Here's a potential problem with replacing the notion of "symbol": some
> other existing code (also working with TeX/LaTeX) might disagree, as it
> might have some existing notion of what a "symbol" in those modes is (as
> defined by the syntax table).
>
> In general, we change the notion of a symbol by either changing the
> mode's syntax table, or by augmenting its effect using
> syntax-propertize-function (which, for example, could propertize the
> backslashes inside the buffer as "symbol constituent"). The latter might
> actually be a change that would affect how 'M-x xref-find-references'
> works (it will likely start to consider those \tags as symbol
> occurrences together with the backslash). But like other changes of what
> is considered to be a "symbol" in a major mode, it could conflict with
> existing code.
>
> Anyway, I'm not saying you have to change the approach, but that's
> something to be aware of.
>
> And to look at it from another direction: if the default implementation
> of xref-find-references (and etags uses the very generic one) doesn't
> work for you, perhaps it would be worth it to define a TeX-specific Xref
> backend. That would perhaps take 20-30 lines of code total, most of them
> delegating to the etags backend, or the default impl. But while
> delegating, you can modify the passed argument - e.g. if it included a
> backslash, you could forward it to the default impl for "find
> references" without a backslash. Or - alternatively - call
> (project-find-regexp "...") with a more complex regexp of your choice.
> The first alternative could look like this:
>
> (cl-defmethod xref-backend-references ((_backend (eql 'tex-etags))
> identifier)
> (xref-backend-references 'etags (string-remove-prefix "\\"
> identifier)))
>
> > I'll look at find-tag, too; thanks for pointing that out.
>
> Doing the above choice on the level of Xref backend's methods
> would/should automatically make it work for all commands appropriately.
>
> >> Why not set the variable find-tag-default-function instead? That seems
> >> easier and more appropriate to do inside a major mode function.
> >
> > I settled on putting the symbol on the modes because I thought it was
> > simpler than setting the variable buffer-locally in all the in-tree
> > and AUCTeX modes, but I'll revisit this and see whether I can come up
> > with something better.
>
> Do AUCTeX modes inherit from tex-mode? Or all call
> tex-common-initialization? Then you could set that variable locally
> inside that function once.
>
> All in all, it might not be wise to modify the behavior of third-party
> packages from inside Emacs this way (they might have other expectations,
> or there's going to appear a new major mode that needs the same
> treatment anyway).
>
> Setting a variable to be used through mode inheritance or delegation is
> fine, but if that doesn't help, I would probably stop at defining a
> helper function or two and documenting how it should be used. And then
> maybe work with AUCTeX people to get the remaining necessary changes in
> from their side (or just leaving that up to the user, depending on how
> functional the default config ends up being).
I think we should add Stefan and Tassilo (CCed) to this discussion, as
they might have valuable comments about this.
next prev parent reply other threads:[~2023-09-14 6:10 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 15:09 bug#53749: 29.0.50; [PATCH] Xref backend for TeX buffers David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21 2:11 ` Dmitry Gutov
2022-02-21 9:48 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21 17:28 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21 23:56 ` Dmitry Gutov
2022-02-22 15:19 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-23 2:21 ` Dmitry Gutov
2022-02-23 10:45 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-24 2:23 ` Dmitry Gutov
2022-02-24 13:15 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21 23:55 ` Dmitry Gutov
2022-09-08 13:25 ` Lars Ingebrigtsen
2022-09-08 13:34 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-08 13:39 ` Lars Ingebrigtsen
2022-09-08 15:50 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03 9:08 ` Stefan Kangas
2023-09-03 10:03 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03 10:46 ` Stefan Kangas
2023-09-13 11:10 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 13:42 ` Stefan Kangas
2023-09-13 15:23 ` Dmitry Gutov
2023-09-13 17:01 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 23:59 ` Dmitry Gutov
2023-09-14 6:10 ` Eli Zaretskii [this message]
2023-09-15 18:45 ` Tassilo Horn
2023-09-16 5:53 ` Ikumi Keita
2023-09-17 8:49 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 13:06 ` Arash Esbati
2024-04-22 14:56 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 16:15 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 16:37 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 17:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-22 17:25 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-24 0:09 ` Dmitry Gutov
2024-04-24 9:02 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-23 12:04 ` Arash Esbati
2024-04-23 13:21 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29 14:15 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-02 0:43 ` Dmitry Gutov
2024-05-02 13:32 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-03 13:42 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-07 2:27 ` Dmitry Gutov
2024-05-09 3:00 ` Dmitry Gutov
2024-05-09 6:38 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-09 10:49 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-13 20:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-14 21:24 ` Dmitry Gutov
2024-05-16 18:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-20 0:21 ` Dmitry Gutov
2024-05-20 2:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25 7:57 ` Eli Zaretskii
2024-05-25 23:01 ` Dmitry Gutov
2024-05-07 2:06 ` Dmitry Gutov
2024-05-02 6:47 ` Arash Esbati
2024-05-02 13:34 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-03 14:10 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-04 8:26 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-04 14:32 ` Arash Esbati
2024-05-04 14:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-04 21:15 ` Arash Esbati
2024-05-07 13:15 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-15 15:47 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-16 7:53 ` Arash Esbati
2024-05-16 12:56 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-14 16:11 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-14 23:55 ` Dmitry Gutov
2023-09-15 6:47 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 19:16 ` Eli Zaretskii
2023-09-13 20:25 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-14 5:14 ` Eli Zaretskii
2022-02-21 12:35 ` Arash Esbati
2022-02-21 14:03 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-25 20:16 ` Augusto Stoffel
2022-02-26 9:29 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-26 10:56 ` Augusto Stoffel
2022-02-27 18:42 ` Arash Esbati
2022-02-28 9:09 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-28 11:54 ` Arash Esbati
2022-02-28 13:11 ` Augusto Stoffel
2022-02-28 19:04 ` Arash Esbati
2022-03-01 8:46 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-28 13:05 ` Augusto Stoffel
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=831qf1mgjl.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=53749@debbugs.gnu.org \
--cc=dfussner@googlemail.com \
--cc=dgutov@yandex.ru \
--cc=larsi@gnus.org \
--cc=monnier@iro.umontreal.ca \
--cc=stefankangas@gmail.com \
--cc=tsdh@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 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.