* bug#60525: 29.0.60; tree-sitter support in semantic-symref
@ 2023-01-03 18:06 Juri Linkov
2023-01-03 20:19 ` Eli Zaretskii
2023-01-04 1:51 ` Dmitry Gutov
0 siblings, 2 replies; 20+ messages in thread
From: Juri Linkov @ 2023-01-03 18:06 UTC (permalink / raw)
To: 60525
[-- Attachment #1: Type: text/plain, Size: 81 bytes --]
This duplication is needed to support 'M-?' (xref-find-references) in ts-modes:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ts-semantic-symref.patch --]
[-- Type: text/x-diff, Size: 1236 bytes --]
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index c698c2ef5a2..cebeac3adca 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -44,7 +44,9 @@ semantic-symref-tool-grep
(defvar semantic-symref-filepattern-alist
'((c-mode "*.[ch]")
+ (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")
+ (python-ts-mode "*.py" "*.pyi" "*.pyw")
(perl-mode "*.pl" "*.PL")
(cperl-mode "*.pl" "*.PL")
(lisp-interaction-mode "*.el" "*.ede" ".emacs" "_emacs")
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-03 18:06 bug#60525: 29.0.60; tree-sitter support in semantic-symref Juri Linkov
@ 2023-01-03 20:19 ` Eli Zaretskii
2023-01-04 1:51 ` Dmitry Gutov
1 sibling, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2023-01-03 20:19 UTC (permalink / raw)
To: Juri Linkov; +Cc: 60525
> From: Juri Linkov <juri@linkov.net>
> Date: Tue, 03 Jan 2023 20:06:25 +0200
>
> This duplication is needed to support 'M-?' (xref-find-references) in ts-modes:
Thanks, this is okay for the emacs-29 branch.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-03 18:06 bug#60525: 29.0.60; tree-sitter support in semantic-symref Juri Linkov
2023-01-03 20:19 ` Eli Zaretskii
@ 2023-01-04 1:51 ` Dmitry Gutov
2023-01-04 7:43 ` Juri Linkov
2023-01-04 14:26 ` Eli Zaretskii
1 sibling, 2 replies; 20+ messages in thread
From: Dmitry Gutov @ 2023-01-04 1:51 UTC (permalink / raw)
To: Juri Linkov, 60525
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.
Or (more effort) change the structure of the "alist" to also contain
lists of modes in the keys. Like in eglot-server-programs.
diff --git a/lisp/cedet/semantic/symref/grep.el
b/lisp/cedet/semantic/symref/grep.el
index c698c2ef5a2..ecfeaae220c 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -71,7 +71,10 @@ semantic-symref-derive-find-filepatterns
Optional argument MODE specifies the `major-mode' to test."
;; First, try the filepattern alist.
(let* ((mode (or mode major-mode))
- (pat (cdr (assoc mode semantic-symref-filepattern-alist))))
+ (pat
+ (or (assoc-default mode semantic-symref-filepattern-alist)
+ (assoc-default (car (rassoc mode major-mode-remap-alist))
+ semantic-symref-filepattern-alist))))
(when (not pat)
;; No hit, try auto-mode-alist.
(dolist (X auto-mode-alist)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 1:51 ` Dmitry Gutov
@ 2023-01-04 7:43 ` Juri Linkov
2023-01-04 12:06 ` Dmitry Gutov
2023-01-04 14:34 ` Eli Zaretskii
2023-01-04 14:26 ` Eli Zaretskii
1 sibling, 2 replies; 20+ messages in thread
From: Juri Linkov @ 2023-01-04 7:43 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: 60525
>> (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")
>
> Instead of duplicating entries, we could try to look up the remappings in
> major-mode-remap-alist.
>
> Or (more effort) change the structure of the "alist" to also contain lists
> of modes in the keys. Like in eglot-server-programs.
>
> diff --git a/lisp/cedet/semantic/symref/grep.el
> ...
> - (pat (cdr (assoc mode semantic-symref-filepattern-alist))))
> + (pat
> + (or (assoc-default mode semantic-symref-filepattern-alist)
> + (assoc-default (car (rassoc mode major-mode-remap-alist))
> + semantic-symref-filepattern-alist))))
I'm fine with this change if Eli agrees to install it
on the emacs-29 branch.
But also note that such duplication is unavoidable in many other places.
For example, to support abbreviations there is the need to manually
rename
(define-abbrev-table 'ruby-mode-abbrev-table
to
(define-abbrev-table 'ruby-base-mode-abbrev-table
in ~/.emacs.d/abbrev_defs. But on exiting Emacs it insists
on saving duplicate abbrevs to
(define-abbrev-table 'ruby-ts-mode-abbrev-table
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 7:43 ` Juri Linkov
@ 2023-01-04 12:06 ` Dmitry Gutov
2023-01-04 14:34 ` Eli Zaretskii
1 sibling, 0 replies; 20+ messages in thread
From: Dmitry Gutov @ 2023-01-04 12:06 UTC (permalink / raw)
To: Juri Linkov; +Cc: 60525
On 04/01/2023 09:43, Juri Linkov wrote:
> But also note that such duplication is unavoidable in many other places.
> For example, to support abbreviations there is the need to manually
> rename
>
> (define-abbrev-table 'ruby-mode-abbrev-table
>
> to
>
> (define-abbrev-table 'ruby-base-mode-abbrev-table
>
> in ~/.emacs.d/abbrev_defs. But on exiting Emacs it insists
> on saving duplicate abbrevs to
>
> (define-abbrev-table 'ruby-ts-mode-abbrev-table
Perhaps something could be done inside abbrev (e.g. save which major
mode it was enabled in). Not sure.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 1:51 ` Dmitry Gutov
2023-01-04 7:43 ` Juri Linkov
@ 2023-01-04 14:26 ` Eli Zaretskii
2023-01-04 15:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-05 18:18 ` Juri Linkov
1 sibling, 2 replies; 20+ messages in thread
From: Eli Zaretskii @ 2023-01-04 14:26 UTC (permalink / raw)
To: Dmitry Gutov, Stefan Monnier, Lars Ingebrigtsen; +Cc: 60525, juri
> Date: Wed, 4 Jan 2023 03:51:28 +0200
> From: Dmitry Gutov <dgutov@yandex.ru>
>
> 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?
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 7:43 ` Juri Linkov
2023-01-04 12:06 ` Dmitry Gutov
@ 2023-01-04 14:34 ` Eli Zaretskii
1 sibling, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2023-01-04 14:34 UTC (permalink / raw)
To: Juri Linkov; +Cc: 60525, dgutov
> Cc: 60525@debbugs.gnu.org
> From: Juri Linkov <juri@linkov.net>
> Date: Wed, 04 Jan 2023 09:43:12 +0200
>
> > diff --git a/lisp/cedet/semantic/symref/grep.el
> > ...
> > - (pat (cdr (assoc mode semantic-symref-filepattern-alist))))
> > + (pat
> > + (or (assoc-default mode semantic-symref-filepattern-alist)
> > + (assoc-default (car (rassoc mode major-mode-remap-alist))
> > + semantic-symref-filepattern-alist))))
>
> I'm fine with this change if Eli agrees to install it
> on the emacs-29 branch.
No, it's too much for the release branch, and as I wrote elsewhere,
doesn't sound justified to me.
> But also note that such duplication is unavoidable in many other places.
> For example, to support abbreviations there is the need to manually
> rename
>
> (define-abbrev-table 'ruby-mode-abbrev-table
>
> to
>
> (define-abbrev-table 'ruby-base-mode-abbrev-table
>
> in ~/.emacs.d/abbrev_defs. But on exiting Emacs it insists
> on saving duplicate abbrevs to
>
> (define-abbrev-table 'ruby-ts-mode-abbrev-table
There's no way around that: people who want use both modes will have
to live with duplication for now. There's a limit to what we can do
so close to the release. Sorry.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 14:26 ` Eli Zaretskii
@ 2023-01-04 15:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 16:57 ` Eli Zaretskii
2023-01-05 18:18 ` Juri Linkov
1 sibling, 1 reply; 20+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-04 15:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, juri, 60525, Dmitry Gutov
>> 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`.
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 15:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-04 16:57 ` Eli Zaretskii
2023-01-04 17:03 ` Dmitry Gutov
2023-01-04 18:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 20+ messages in thread
From: Eli Zaretskii @ 2023-01-04 16:57 UTC (permalink / raw)
To: Stefan Monnier; +Cc: larsi, juri, 60525, dgutov
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Dmitry Gutov <dgutov@yandex.ru>, Lars Ingebrigtsen <larsi@gnus.org>,
> juri@linkov.net, 60525@debbugs.gnu.org
> Date: Wed, 04 Jan 2023 10:47:54 -0500
>
> >> 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.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 16:57 ` Eli Zaretskii
@ 2023-01-04 17:03 ` Dmitry Gutov
2023-01-04 17:17 ` Eli Zaretskii
2023-01-04 18:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 20+ messages in thread
From: Dmitry Gutov @ 2023-01-04 17:03 UTC (permalink / raw)
To: Eli Zaretskii, Stefan Monnier; +Cc: larsi, 60525, juri
On 04/01/2023 18:57, Eli Zaretskii wrote:
> 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.
I believe Stefan is referring to redundancy between auto-mode-alist and
semantic-symref-filepattern-alist. Which seems unavoidable so far as the
former requires just one element in the car position, and the latter
works with lists of filename globs.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 17:03 ` Dmitry Gutov
@ 2023-01-04 17:17 ` Eli Zaretskii
0 siblings, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2023-01-04 17:17 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: larsi, 60525, monnier, juri
> Date: Wed, 4 Jan 2023 19:03:28 +0200
> Cc: larsi@gnus.org, juri@linkov.net, 60525@debbugs.gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
>
> On 04/01/2023 18:57, Eli Zaretskii wrote:
> > 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.
>
> I believe Stefan is referring to redundancy between auto-mode-alist and
> semantic-symref-filepattern-alist.
Yes, I understood that, and my response was to that aspect.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 16:57 ` Eli Zaretskii
2023-01-04 17:03 ` Dmitry Gutov
@ 2023-01-04 18:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 18:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 18:39 ` Eli Zaretskii
1 sibling, 2 replies; 20+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-04 18:07 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: larsi, juri, 60525, dgutov
>> >> 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`).
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 18:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-04 18:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 18:43 ` Eli Zaretskii
2023-01-05 17:29 ` Juri Linkov
2023-01-04 18:39 ` Eli Zaretskii
1 sibling, 2 replies; 20+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-04 18:20 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: larsi, juri, 60525, dgutov
>>> >> 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
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 18:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 18:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-04 18:39 ` Eli Zaretskii
2023-01-04 19:04 ` Dmitry Gutov
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2023-01-04 18:39 UTC (permalink / raw)
To: Stefan Monnier; +Cc: larsi, juri, 60525, dgutov
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: dgutov@yandex.ru, larsi@gnus.org, juri@linkov.net, 60525@debbugs.gnu.org
> Date: Wed, 04 Jan 2023 13:07:47 -0500
>
> - 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`).
This idea was tried, but it doesn't work well enough, at least not for
all such mode pairs.
> - 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`).
I'd need to see the code to reason about it (though I understand the
general idea).
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 18:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-04 18:43 ` Eli Zaretskii
2023-01-04 19:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-05 17:29 ` Juri Linkov
1 sibling, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2023-01-04 18:43 UTC (permalink / raw)
To: Stefan Monnier; +Cc: larsi, juri, 60525, dgutov
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: dgutov@yandex.ru, larsi@gnus.org, juri@linkov.net, 60525@debbugs.gnu.org
> Date: Wed, 04 Jan 2023 13:20:26 -0500
>
> - 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`.
Fine with me, but that is hardly for the release branch.
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 18:39 ` Eli Zaretskii
@ 2023-01-04 19:04 ` Dmitry Gutov
2023-01-04 19:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 20+ messages in thread
From: Dmitry Gutov @ 2023-01-04 19:04 UTC (permalink / raw)
To: Eli Zaretskii, Stefan Monnier; +Cc: larsi, 60525, juri
On 04/01/2023 20:39, Eli Zaretskii wrote:
>> From: Stefan Monnier<monnier@iro.umontreal.ca>
>> Cc:dgutov@yandex.ru,larsi@gnus.org,juri@linkov.net,60525@debbugs.gnu.org
>> Date: Wed, 04 Jan 2023 13:07:47 -0500
>>
>> - 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`).
> This idea was tried, but it doesn't work well enough, at least not for
> all such mode pairs.
>
2 out of 3 modes added by this patch do have "base" modes that can be
used: python-base-mode and ruby-base-mode.
The search will have to become a little more complex, though, to account
for parent modes. Not just (cdr (assoc mode
semantic-symref-filepattern-alist)).
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 19:04 ` Dmitry Gutov
@ 2023-01-04 19:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 20+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-04 19:36 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: Eli Zaretskii, 60525, larsi, juri
> The search will have to become a little more complex, though, to account for
> parent modes. Not just (cdr (assoc mode semantic-symref-filepattern-alist)).
If it doesn't account for mode inheritance, then I'd argue that it's
already broken.
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 18:43 ` Eli Zaretskii
@ 2023-01-04 19:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 20+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-04 19:38 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: larsi, juri, 60525, dgutov
>> - 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`.
>
> Fine with me, but that is hardly for the release branch.
None of the my "alternatives" were meant for `emacs-29`, indeed (tho
apparently there's a `ruby-base-mode` so it could have been an option,
if it weren't for the fact that `semantic-symref-filepattern-alist` is
too simplistic for that).
Stefan
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 18:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 18:43 ` Eli Zaretskii
@ 2023-01-05 17:29 ` Juri Linkov
1 sibling, 0 replies; 20+ messages in thread
From: Juri Linkov @ 2023-01-05 17:29 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Eli Zaretskii, 60525, larsi, dgutov
>>>> >> 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")
>
> BTW, I see that the info provided by `semantic-symref-filepattern-alist`
> could be (re)used also in `C-u M-x grep`.
Indeed, another duplication with:
(defcustom grep-files-aliases
'(("all" . "* .*")
("el" . "*.el")
("ch" . "*.[ch]")
("c" . "*.c")
("cc" . "*.cc *.cxx *.cpp *.C *.CC *.c++")
("cchh" . "*.cc *.[ch]xx *.[ch]pp *.[CHh] *.CC *.HH *.[ch]++")
("hh" . "*.hxx *.hpp *.[Hh] *.HH *.h++")
("h" . "*.h")
("l" . "[Cc]hange[Ll]og*")
("am" . "Makefile.am GNUmakefile *.mk")
("m" . "[Mm]akefile*")
("tex" . "*.tex")
("texi" . "*.texi")
("asm" . "*.[sS]"))
^ permalink raw reply [flat|nested] 20+ messages in thread
* bug#60525: 29.0.60; tree-sitter support in semantic-symref
2023-01-04 14:26 ` Eli Zaretskii
2023-01-04 15:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-05 18:18 ` Juri Linkov
1 sibling, 0 replies; 20+ messages in thread
From: Juri Linkov @ 2023-01-05 18:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, 60525, Stefan Monnier, Dmitry Gutov
>> > + (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")
>
> 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.
So I pushed this to emacs-29, and leave this bug report open
for more generalization in master.
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2023-01-05 18:18 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-03 18:06 bug#60525: 29.0.60; tree-sitter support in semantic-symref Juri Linkov
2023-01-03 20:19 ` Eli Zaretskii
2023-01-04 1:51 ` Dmitry Gutov
2023-01-04 7:43 ` Juri Linkov
2023-01-04 12:06 ` Dmitry Gutov
2023-01-04 14:34 ` Eli Zaretskii
2023-01-04 14:26 ` Eli Zaretskii
2023-01-04 15:47 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 16:57 ` Eli Zaretskii
2023-01-04 17:03 ` Dmitry Gutov
2023-01-04 17:17 ` Eli Zaretskii
2023-01-04 18:07 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 18:20 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-04 18:43 ` Eli Zaretskii
2023-01-04 19:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-05 17:29 ` Juri Linkov
2023-01-04 18:39 ` Eli Zaretskii
2023-01-04 19:04 ` Dmitry Gutov
2023-01-04 19:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-05 18:18 ` Juri Linkov
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.