diff options
| author | David Fussner | 2024-06-10 14:16:04 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2024-09-14 17:05:33 +0200 |
| commit | b44c00669ace7b9e6a90aecb5f4e9f4edf6ed25a (patch) | |
| tree | 7119d2ff1695271877a27a1a0cf0b0d648983d1c /doc | |
| parent | 98e582e74a2bbc2c7fdef02b8cd90036fa217712 (diff) | |
| download | emacs-b44c00669ace7b9e6a90aecb5f4e9f4edf6ed25a.tar.gz emacs-b44c00669ace7b9e6a90aecb5f4e9f4edf6ed25a.zip | |
Provide a modified xref backend for TeX buffers
In addition to providing a new `xref' backend, the patch also improves
the general handling of expl3 syntax. Expl3 is the next-generation
LaTeX specification, and has for some time been available by default in
the LaTeX kernel. The new syntax co-exists in many files with the
standard LaTeX2e syntax, so we try at least minimally to separate the
way modes handle the two specifications, both to reduce
visually-disturbing interference between them and also to improve the
`xref' backend. (Bug#53749)
* lib-src/etags.c (TeX_commands): Improve parsing of commands in TeX
buffers.
(TEX_defenv): Expand list of commands to tag by default in TeX buffers.
(TeX_help):
* doc/emacs/maintaining.texi (Tag Syntax): Document new tagged commands.
(Identifier Search): Add note about semantic-symref-filepattern-alist,
auto-mode-alist, and xref-find-references.
* lisp/textmodes/tex-mode.el (tex-font-lock-suscript): Test for
underscore in expl3 files and regions, disable subscript face there.
(tex-common-initialization): Set up xref backend for in-tree TeX modes.
Detect expl3 files, and in others set up a list of expl3 regions.
(tex-expl-buffer-parse): New function called in previous.
(tex-expl-buffer-p): New variable to hold the result of previous.
(tex-expl-region-set): New function added to
'syntax-propertize-extend-region-functions' hook.
(tex-expl-region-list): New variable to hold the result of previous.
(tex--xref-backend): New function to identify the xref backend.
(tex--thing-at-point, tex-thingatpt--beginning-of-symbol)
(tex-thingatpt--end-of-symbol, tex--bounds-of-symbol-at-point):
New functions to return 'thing-at-point' for xref backend.
(tex-thingatpt-exclude-chars): New variable to do the same.
(xref-backend-identifier-at-point): New TeX backend method to provide
symbols for processing by xref.
(xref-backend-identifier-completion-table)
(xref-backend-identifier-completion-ignore-case)
(xref-backend-definitions, xref-backend-apropos): Placeholders to
call the standard 'etags' xref backend methods.
(xref-backend-references): Wrapper to call the default xref backend
method, finding as many relevant files as possible and using a bespoke
syntax-propertize-function when required.
(tex--collect-file-extensions, tex-xref-syntax-function): Helper
functions for previous.
(tex-find-references-syntax-table, tex--buffers-list)
(tex--xref-syntax-fun, tex--old-syntax-function): New variables for
the same.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/maintaining.texi | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 3c34afbaa20..0ec2385860b 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -2549,6 +2549,15 @@ identifier, showing the file name and the line where the identifier is | |||
| 2549 | referenced. The XREF mode commands are available in this buffer, see | 2549 | referenced. The XREF mode commands are available in this buffer, see |
| 2550 | @ref{Xref Commands}. | 2550 | @ref{Xref Commands}. |
| 2551 | 2551 | ||
| 2552 | When invoked in a buffer whose major mode uses the @code{etags} backend, | ||
| 2553 | @kbd{M-?} searches files and buffers whose major mode matches that of | ||
| 2554 | the original buffer. It guesses that mode from file extensions, so if | ||
| 2555 | @kbd{M-?} seems to be skipping relevant buffers or files, try | ||
| 2556 | customizing either the variable @code{semantic-symref-filepattern-alist} | ||
| 2557 | (if your buffer's major mode already has an entry in it), or | ||
| 2558 | @code{auto-mode-alist} (if not), thereby informing @code{xref} of the | ||
| 2559 | missing extensions (@pxref{Choosing Modes}). | ||
| 2560 | |||
| 2552 | @vindex xref-auto-jump-to-first-xref | 2561 | @vindex xref-auto-jump-to-first-xref |
| 2553 | If the value of the variable @code{xref-auto-jump-to-first-xref} is | 2562 | If the value of the variable @code{xref-auto-jump-to-first-xref} is |
| 2554 | @code{t}, @code{xref-find-references} automatically jumps to the first | 2563 | @code{t}, @code{xref-find-references} automatically jumps to the first |
| @@ -2767,10 +2776,32 @@ Tags for variables and functions in classes are named | |||
| 2767 | @item | 2776 | @item |
| 2768 | In @LaTeX{} documents, the arguments for @code{\chapter}, | 2777 | In @LaTeX{} documents, the arguments for @code{\chapter}, |
| 2769 | @code{\section}, @code{\subsection}, @code{\subsubsection}, | 2778 | @code{\section}, @code{\subsection}, @code{\subsubsection}, |
| 2770 | @code{\eqno}, @code{\label}, @code{\ref}, @code{\cite}, | 2779 | @code{\eqno}, @code{\label}, @code{\ref}, @code{\Ref}, @code{\footref}, |
| 2771 | @code{\bibitem}, @code{\part}, @code{\appendix}, @code{\entry}, | 2780 | @code{\cite}, @code{\bibitem}, @code{\part}, @code{\appendix}, |
| 2772 | @code{\index}, @code{\def}, @code{\newcommand}, @code{\renewcommand}, | 2781 | @code{\entry}, @code{\index}, @code{\def}, @code{\edef}, @code{\gdef}, |
| 2773 | @code{\newenvironment} and @code{\renewenvironment} are tags. | 2782 | @code{\xdef}, @code{\newcommand}, @code{\renewcommand}, |
| 2783 | @code{\newenvironment}, @code{\renewenvironment}, | ||
| 2784 | @code{\DeclareRobustCommand}, @code{\newrobustcmd}, | ||
| 2785 | @code{\renewrobustcmd}, @code{\providecommand}, | ||
| 2786 | @code{\providerobustcmd}, @code{\NewDocumentCommand}, | ||
| 2787 | @code{\RenewDocumentCommand}, @code{\ProvideDocumentCommand}, | ||
| 2788 | @code{\DeclareDocumentCommand}, @code{\NewExpandableDocumentCommand}, | ||
| 2789 | @code{\RenewExpandableDocumentCommand}, | ||
| 2790 | @code{\ProvideExpandableDocumentCommand}, | ||
| 2791 | @code{\DeclareExpandableDocumentCommand}, | ||
| 2792 | @code{\NewDocumentEnvironment}, @code{\RenewDocumentEnvironment}, | ||
| 2793 | @code{\ProvideDocumentEnvironment}, @code{\DeclareDocumentEnvironment}, | ||
| 2794 | @code{\csdef}, @code{\csedef}, @code{\csgdef}, @code{\csxdef}, | ||
| 2795 | @code{\csletcs}, @code{\cslet}, @code{\letcs}, @code{\let}, | ||
| 2796 | @code{\cs_new_protected_nopar}, @code{\cs_new_protected}, | ||
| 2797 | @code{\cs_new_nopar}, @code{\cs_new_eq}, @code{\cs_new}, | ||
| 2798 | @code{\cs_set_protected_nopar}, @code{\cs_set_protected}, | ||
| 2799 | @code{\cs_set_nopar}, @code{\cs_set_eq}, @code{\cs_set}, | ||
| 2800 | @code{\cs_gset_protected_nopar}, @code{\cs_gset_protected}, | ||
| 2801 | @code{\cs_gset_nopar}, @code{\cs_gset_eq}, @code{\cs_gset}, | ||
| 2802 | @code{\cs_generate_from_arg_count}, and @code{\cs_generate_variant} are | ||
| 2803 | tags. So too are the arguments of any starred variants of these | ||
| 2804 | commands. | ||
| 2774 | 2805 | ||
| 2775 | Other commands can make tags as well, if you specify them in the | 2806 | Other commands can make tags as well, if you specify them in the |
| 2776 | environment variable @env{TEXTAGS} before invoking @command{etags}. The | 2807 | environment variable @env{TEXTAGS} before invoking @command{etags}. The |