bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60525: 29.0.60; tree-sitter support in semantic-symref


From: Stefan Monnier
Subject: bug#60525: 29.0.60; tree-sitter support in semantic-symref
Date: Wed, 04 Jan 2023 13:20:26 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>>> >> On 03/01/2023 20:06, Juri Linkov wrote:
>>> >> > +    (c-ts-mode "*.[ch]")
>>> >> >       (c++-mode "*.[chCH]" "*.[ch]pp" "*.cc" "*.hh")
>>> >> > +    (c++-ts-mode "*.[chCH]" "*.[ch]pp" "*.cc" "*.hh")
>>> >> >       (html-mode "*.html" "*.shtml" "*.php")
>>> >> >       (mhtml-mode "*.html" "*.shtml" "*.php") ; FIXME: remove
>>> >> >                                               ; duplication of
>>> >> > @@ -53,7 +55,10 @@ semantic-symref-filepattern-alist
>>> >> >                                               ; major mode definition?
>>> >> >       (ruby-mode "*.r[bu]" "*.rake" "*.gemspec" "*.erb" "*.haml"
>>> >> >                  "Rakefile" "Thorfile" "Capfile" "Guardfile" 
>>> >> > "Vagrantfile")
>>> >> > +    (ruby-ts-mode "*.r[bu]" "*.rake" "*.gemspec" "*.erb" "*.haml"
>>> >> > +                  "Rakefile" "Thorfile" "Capfile" "Guardfile" 
>>> >> > "Vagrantfile")
>>> >> >       (python-mode "*.py" "*.pyi" "*.pyw")
>>> >> 
>>> >> Instead of duplicating entries, we could try to look up the remappings 
>>> >> in major-mode-remap-alist.
>>> >
>>> > That doesn't sound to me like the use of major-mode-remap-alist that
>>> > was intended.
>>> >
>>> > I'm okay with duplication at this point.  It is much easier, and we
>>> > can always augment or fix later as needed.  I see no reason to do
>>> > anything fancier at this point.
>>> >
>>> > Stefan, Lars, WDYT?
>>> 
>>> I'll just note that the above alists already duplicate info present in
>>> `auto-mode-alist`.  Admittedly, this redundant info is present in
>>> a different form, so maybe not directly usable as is, but if we care
>>> about redundancy, we should maybe add some layer on top which we can
>>> then use both for `semantic-symref-filepattern-alist` and for
>>> `auto-mode-alist`.
>>
>> I' aware of the redundancy.  But since we decided to go with those
>> separate modes in Emacs 29, I think the redundancy is in general
>> unavoidable.  If we can use the fact that auto-mode-alist already
>> mentions both modes, and we can do that cleanly, it's fine by me.
>> Otherwise we will have to live with this for now.
>
> BTW, other ways to reduce the redundancy (not between
> `semantic-symref-filepattern-alist` and `auto-mode-alist`, but the one
> introduced by the patch above):
>
> - make the various variants of a major mode all inherit from a shared
>   parent mode (and then use that shared parent mode in
>   `semantic-symref-filepattern-alist`).
>
> - Use `set-auto-mode--last` which remembers the mode specified before it
>   was remapped by things like `major-mode-remap-alist` (or by dispatch
>   functions like `tex-mode`).

Oh, and of course:

- move the info from `semantic-symref-filepattern-alist` to
  a buffer-local `semantic-symref-filepattern` which is set by the major
  modes, so the same setting can be shared by the various modes like all
  the other buffer-local settings (`comment-start`, ...).

BTW, I see that the info provided by `semantic-symref-filepattern-alist`
could be (re)used also in `C-u M-x grep`.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]