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

From: Juri Linkov <[email-masked]>
Date: Wed, 04 Jan 2023 09:43:12 +0200

>>       (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