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: Dmitry Gutov
Subject: bug#60525: 29.0.60; tree-sitter support in semantic-symref
Date: Wed, 4 Jan 2023 03:51:28 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

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)






reply via email to

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