* How to define xref-find-definitions for a new mode? @ 2018-06-09 6:46 Marcin Borkowski 2018-06-09 8:47 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Marcin Borkowski @ 2018-06-09 6:46 UTC (permalink / raw) To: Help Gnu Emacs mailing list Hi all, I'd like to define xref-find-definitions for LaTeX (in AUCTeX). Where should I start? Is there any documentation on how to add a new mode support to xref? TIA, -- Marcin Borkowski http://mbork.pl ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to define xref-find-definitions for a new mode? 2018-06-09 6:46 How to define xref-find-definitions for a new mode? Marcin Borkowski @ 2018-06-09 8:47 ` Eli Zaretskii 2018-06-09 9:10 ` Marcin Borkowski 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2018-06-09 8:47 UTC (permalink / raw) To: help-gnu-emacs > From: Marcin Borkowski <mbork@mbork.pl> > Date: Sat, 09 Jun 2018 08:46:07 +0200 > > I'd like to define xref-find-definitions for LaTeX (in AUCTeX). Where > should I start? Is there any documentation on how to add a new mode > support to xref? The only documentation is in xref.el itself. In a nutshell, you need to implement a couple of methods in a way that is specific to LaTeX. (Btw, doesn't it already work? Etags is an existing back-end for Xref, and 'etags' the program already supports TeX and its derivatives, so it is able to create TAGS tables for LaTeX files.) ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to define xref-find-definitions for a new mode? 2018-06-09 8:47 ` Eli Zaretskii @ 2018-06-09 9:10 ` Marcin Borkowski 2018-06-09 9:48 ` Eli Zaretskii 2018-06-12 13:30 ` Dmitry Gutov 0 siblings, 2 replies; 10+ messages in thread From: Marcin Borkowski @ 2018-06-09 9:10 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs On 2018-06-09, at 10:47, Eli Zaretskii <eliz@gnu.org> wrote: >> From: Marcin Borkowski <mbork@mbork.pl> >> Date: Sat, 09 Jun 2018 08:46:07 +0200 >> >> I'd like to define xref-find-definitions for LaTeX (in AUCTeX). Where >> should I start? Is there any documentation on how to add a new mode >> support to xref? > > The only documentation is in xref.el itself. In a nutshell, you need > to implement a couple of methods in a way that is specific to LaTeX. Thanks. Are there other places I could look into, like xref implementation for a concrete language? > (Btw, doesn't it already work? Etags is an existing back-end for > Xref, and 'etags' the program already supports TeX and its > derivatives, so it is able to create TAGS tables for LaTeX files.) Well, possibly, but I'd like it to work like for Elisp or JavaScript, without a TAGS table. Also, I want it to go to \label when on \ref, to \bib / \bibitem when on \cite etc. Thanks, -- Marcin Borkowski http://mbork.pl ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to define xref-find-definitions for a new mode? 2018-06-09 9:10 ` Marcin Borkowski @ 2018-06-09 9:48 ` Eli Zaretskii 2018-06-11 3:22 ` Marcin Borkowski 2018-06-12 13:30 ` Dmitry Gutov 1 sibling, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2018-06-09 9:48 UTC (permalink / raw) To: help-gnu-emacs > From: Marcin Borkowski <mbork@mbork.pl> > Cc: help-gnu-emacs@gnu.org > Date: Sat, 09 Jun 2018 11:10:22 +0200 > > Thanks. Are there other places I could look into, like xref > implementation for a concrete language? In the sources for the respective languages, notably Lisp. Search for "xref-". > > (Btw, doesn't it already work? Etags is an existing back-end for > > Xref, and 'etags' the program already supports TeX and its > > derivatives, so it is able to create TAGS tables for LaTeX files.) > > Well, possibly, but I'd like it to work like for Elisp or JavaScript, > without a TAGS table. Is this likely to happen? Lisp and JavaScript know where to find functions and variables because they keep that information as part of defining them. I don't think TeX does anything similar, does it? > Also, I want it to go to \label when on \ref, to \bib / \bibitem > when on \cite etc. Are you sure it doesn't work already? E.g., if \label is tagged, then "M-." on the tag's name at \ref should go to the label's definition. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to define xref-find-definitions for a new mode? 2018-06-09 9:48 ` Eli Zaretskii @ 2018-06-11 3:22 ` Marcin Borkowski 2018-06-11 15:13 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Marcin Borkowski @ 2018-06-11 3:22 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs On 2018-06-09, at 11:48, Eli Zaretskii <eliz@gnu.org> wrote: >> From: Marcin Borkowski <mbork@mbork.pl> >> Cc: help-gnu-emacs@gnu.org >> Date: Sat, 09 Jun 2018 11:10:22 +0200 >> >> Thanks. Are there other places I could look into, like xref >> implementation for a concrete language? > > In the sources for the respective languages, notably Lisp. Search for > "xref-". > >> > (Btw, doesn't it already work? Etags is an existing back-end for >> > Xref, and 'etags' the program already supports TeX and its >> > derivatives, so it is able to create TAGS tables for LaTeX files.) >> >> Well, possibly, but I'd like it to work like for Elisp or JavaScript, >> without a TAGS table. > > Is this likely to happen? Lisp and JavaScript know where to find > functions and variables because they keep that information as part of > defining them. I don't think TeX does anything similar, does it? Why couldn't it (at least in theory)? If etags can do it, why not Emacs? Also, I'm not sure JS does that. >> Also, I want it to go to \label when on \ref, to \bib / \bibitem >> when on \cite etc. > > Are you sure it doesn't work already? E.g., if \label is tagged, then > "M-." on the tag's name at \ref should go to the label's definition. Well, apparently it doesn't without the TAGS file. And even with it, I couldn't make it to work. Also, amsrefs is not suppported. Best, -- Marcin Borkowski http://mbork.pl ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to define xref-find-definitions for a new mode? 2018-06-11 3:22 ` Marcin Borkowski @ 2018-06-11 15:13 ` Eli Zaretskii 2018-06-15 4:49 ` Marcin Borkowski 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2018-06-11 15:13 UTC (permalink / raw) To: help-gnu-emacs > From: Marcin Borkowski <mbork@mbork.pl> > Cc: help-gnu-emacs@gnu.org > Date: Mon, 11 Jun 2018 05:22:26 +0200 > > >> > (Btw, doesn't it already work? Etags is an existing back-end for > >> > Xref, and 'etags' the program already supports TeX and its > >> > derivatives, so it is able to create TAGS tables for LaTeX files.) > >> > >> Well, possibly, but I'd like it to work like for Elisp or JavaScript, > >> without a TAGS table. > > > > Is this likely to happen? Lisp and JavaScript know where to find > > functions and variables because they keep that information as part of > > defining them. I don't think TeX does anything similar, does it? > > Why couldn't it (at least in theory)? If etags can do it, why not > Emacs? You said "no TAGS", so do you mean you want to rewrite the TeX part of etags in Lisp, and make that run in real-time, when the user types "M-."? Won't this be too slow. > Also, I'm not sure JS does that. Me neither, but it was you who mentioned JS, not me ;-) > >> Also, I want it to go to \label when on \ref, to \bib / \bibitem > >> when on \cite etc. > > > > Are you sure it doesn't work already? E.g., if \label is tagged, then > > "M-." on the tag's name at \ref should go to the label's definition. > > Well, apparently it doesn't without the TAGS file. And even with it, > I couldn't make it to work. Also, amsrefs is not suppported. Then my suggestion would be to extend etags to support that. That way you won't be starting from scratch. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to define xref-find-definitions for a new mode? 2018-06-11 15:13 ` Eli Zaretskii @ 2018-06-15 4:49 ` Marcin Borkowski 2018-06-15 7:41 ` Eli Zaretskii 0 siblings, 1 reply; 10+ messages in thread From: Marcin Borkowski @ 2018-06-15 4:49 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs On 2018-06-11, at 17:13, Eli Zaretskii <eliz@gnu.org> wrote: >> From: Marcin Borkowski <mbork@mbork.pl> >> Cc: help-gnu-emacs@gnu.org >> Date: Mon, 11 Jun 2018 05:22:26 +0200 >> >> >> > (Btw, doesn't it already work? Etags is an existing back-end for >> >> > Xref, and 'etags' the program already supports TeX and its >> >> > derivatives, so it is able to create TAGS tables for LaTeX files.) >> >> >> >> Well, possibly, but I'd like it to work like for Elisp or JavaScript, >> >> without a TAGS table. >> > >> > Is this likely to happen? Lisp and JavaScript know where to find >> > functions and variables because they keep that information as part of >> > defining them. I don't think TeX does anything similar, does it? >> >> Why couldn't it (at least in theory)? If etags can do it, why not >> Emacs? > > You said "no TAGS", so do you mean you want to rewrite the TeX part of > etags in Lisp, and make that run in real-time, when the user types > "M-."? Won't this be too slow. Well, it works with JS pretty well (I don't know how it's implemented, though). >> >> Also, I want it to go to \label when on \ref, to \bib / \bibitem >> >> when on \cite etc. >> > >> > Are you sure it doesn't work already? E.g., if \label is tagged, then >> > "M-." on the tag's name at \ref should go to the label's definition. >> >> Well, apparently it doesn't without the TAGS file. And even with it, >> I couldn't make it to work. Also, amsrefs is not suppported. > > Then my suggestion would be to extend etags to support that. That way > you won't be starting from scratch. Well, in that case I'll pass for now. Etags is written in C, which I don't speak very well. (Learning it better would be great, but I don't have enough time for that now.) Thanks, -- Marcin Borkowski http://mbork.pl ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to define xref-find-definitions for a new mode? 2018-06-15 4:49 ` Marcin Borkowski @ 2018-06-15 7:41 ` Eli Zaretskii 2018-06-15 8:59 ` Marcin Borkowski 0 siblings, 1 reply; 10+ messages in thread From: Eli Zaretskii @ 2018-06-15 7:41 UTC (permalink / raw) To: help-gnu-emacs > From: Marcin Borkowski <mbork@mbork.pl> > Cc: help-gnu-emacs@gnu.org > Date: Fri, 15 Jun 2018 06:49:43 +0200 > > >> > Are you sure it doesn't work already? E.g., if \label is tagged, then > >> > "M-." on the tag's name at \ref should go to the label's definition. > >> > >> Well, apparently it doesn't without the TAGS file. And even with it, > >> I couldn't make it to work. Also, amsrefs is not suppported. > > > > Then my suggestion would be to extend etags to support that. That way > > you won't be starting from scratch. > > Well, in that case I'll pass for now. Etags is written in C, which > I don't speak very well. (Learning it better would be great, but > I don't have enough time for that now.) You could instead file bug reports with reproducible recipes and with requests for what should 'etags' the program add to TAGS to support your features. Then someone else could implement these changes in 'etags'. It's known to have happened, including fairly recently. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to define xref-find-definitions for a new mode? 2018-06-15 7:41 ` Eli Zaretskii @ 2018-06-15 8:59 ` Marcin Borkowski 0 siblings, 0 replies; 10+ messages in thread From: Marcin Borkowski @ 2018-06-15 8:59 UTC (permalink / raw) To: Eli Zaretskii; +Cc: help-gnu-emacs On 2018-06-15, at 09:41, Eli Zaretskii <eliz@gnu.org> wrote: >> From: Marcin Borkowski <mbork@mbork.pl> >> Cc: help-gnu-emacs@gnu.org >> Date: Fri, 15 Jun 2018 06:49:43 +0200 >> >> >> > Are you sure it doesn't work already? E.g., if \label is tagged, then >> >> > "M-." on the tag's name at \ref should go to the label's definition. >> >> >> >> Well, apparently it doesn't without the TAGS file. And even with it, >> >> I couldn't make it to work. Also, amsrefs is not suppported. >> > >> > Then my suggestion would be to extend etags to support that. That way >> > you won't be starting from scratch. >> >> Well, in that case I'll pass for now. Etags is written in C, which >> I don't speak very well. (Learning it better would be great, but >> I don't have enough time for that now.) > > You could instead file bug reports with reproducible recipes and with > requests for what should 'etags' the program add to TAGS to support > your features. Then someone else could implement these changes in > 'etags'. It's known to have happened, including fairly recently. Thanks, this gives some hope! -- Marcin Borkowski http://mbork.pl ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to define xref-find-definitions for a new mode? 2018-06-09 9:10 ` Marcin Borkowski 2018-06-09 9:48 ` Eli Zaretskii @ 2018-06-12 13:30 ` Dmitry Gutov 1 sibling, 0 replies; 10+ messages in thread From: Dmitry Gutov @ 2018-06-12 13:30 UTC (permalink / raw) To: Marcin Borkowski, Eli Zaretskii; +Cc: help-gnu-emacs On 6/9/18 12:10 PM, Marcin Borkowski wrote: > Thanks. Are there other places I could look into, like xref > implementation for a concrete language? etags and elisp-mode implenentations are built-in. They're a bit non-trivial though, so I'd look into reusing etags first, like Eli suggests. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-06-15 8:59 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-06-09 6:46 How to define xref-find-definitions for a new mode? Marcin Borkowski 2018-06-09 8:47 ` Eli Zaretskii 2018-06-09 9:10 ` Marcin Borkowski 2018-06-09 9:48 ` Eli Zaretskii 2018-06-11 3:22 ` Marcin Borkowski 2018-06-11 15:13 ` Eli Zaretskii 2018-06-15 4:49 ` Marcin Borkowski 2018-06-15 7:41 ` Eli Zaretskii 2018-06-15 8:59 ` Marcin Borkowski 2018-06-12 13:30 ` Dmitry Gutov
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).