[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AUCTeX and "builtin latex mode" integration
From: |
Stefan Monnier |
Subject: |
Re: AUCTeX and "builtin latex mode" integration |
Date: |
Fri, 22 Sep 2023 20:29:52 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> (defun semantic-symref-derive-find-filepatterns (&optional mode)
> ...(snip)...
> (let* ((mode (or mode major-mode)) <-- mode = LaTeX-mode
> ...(snip)...
> ;; No hit, try auto-mode-alist.
> (dolist (X auto-mode-alist) <-- Looking at `auto-mode-alist'
> (when (and (eq (cdr X) mode)
> ;; Only take in simple patterns, so try to convert this
> one.
> (string-match "\\\\\\.\\([^\\'>]+\\)\\\\'" (car X)))
> (push (concat "*." (match-string 1 (car X))) pat))))
Eww.
Right, this code clearly needs to be beefed up if we want it to work
more reliably. E.g. it needs to check not just (eq (cdr X) mode)
but maybe something like (provided-mode-derived-p (cdr X) mode), so as
to account for derived modes of `mode`, and it needs to use
`major-mode-remap-alist` "in reverse" as well.
And maybe pay attention to function aliases while at it.
IOW it's an ugly heuristic function.
> I suppose that we can work around this issue if
> `semantic-symref-derive-find-filepatterns' is modified to look into
> `major-mode-remap-alist' in emacs 29 and later. However, I don't see
> clean solution for emacs<29.
Advise `semantic-symref-derive-find-filepatterns` so that if major mode
is `LaTeX-mode` is looks for both `LaTeX-mode` and `latex-mode`?
Stefan