aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles A. Roelli2017-11-04 22:19:08 +0100
committerCharles A. Roelli2017-11-04 22:19:08 +0100
commit725ab635d9c4c0ecbd4b28df16d2b97337bbe989 (patch)
treecb20d3d5ddc51632718b72b5adf3f8df5ff034ce
parent369da28702a60543391bf9576eb904d21ca8ea09 (diff)
downloademacs-725ab635d9c4c0ecbd4b28df16d2b97337bbe989.tar.gz
emacs-725ab635d9c4c0ecbd4b28df16d2b97337bbe989.zip
Add html-, mhtml- and python-mode support to semantic symref
* lisp/cedet/semantic/symref/grep.el (semantic-symref-filepattern-alist): Fix the entry for 'html-mode', which used a regexp-like syntax where only glob syntax is permitted. As a result, 'xref-find-references' (M-?) can now find references in HTML files. Also duplicate the same entry for the sake of 'mhtml-mode', and add a new one for 'python-mode'. (semantic-symref-derive-find-filepatterns): In the documentation, clarify that returned patterns must follow the glob syntax. Fix an 'if' test that always evaluates to nil. (semantic-symref-tool-grep): (semantic-symref-perform-search): Fix typos.
-rw-r--r--lisp/cedet/semantic/symref/grep.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index bc19cd30c45..0b263d8cc2d 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -38,16 +38,22 @@
38 ( 38 (
39 ) 39 )
40 "A symref tool implementation using grep. 40 "A symref tool implementation using grep.
41This tool uses EDE to find he root of the project, then executes 41This tool uses EDE to find the root of the project, then executes
42find-grep in the project. The output is parsed for hits 42find-grep in the project. The output is parsed for hits and
43and those hits returned.") 43those hits returned.")
44 44
45(defvar semantic-symref-filepattern-alist 45(defvar semantic-symref-filepattern-alist
46 '((c-mode "*.[ch]") 46 '((c-mode "*.[ch]")
47 (c++-mode "*.[chCH]" "*.[ch]pp" "*.cc" "*.hh") 47 (c++-mode "*.[chCH]" "*.[ch]pp" "*.cc" "*.hh")
48 (html-mode "*.s?html" "*.php") 48 (html-mode "*.html" "*.shtml" "*.php")
49 (mhtml-mode "*.html" "*.shtml" "*.php") ; FIXME: remove
50 ; duplication of
51 ; HTML-related patterns.
52 ; Maybe they belong in the
53 ; major mode definition?
49 (ruby-mode "*.r[bu]" "*.rake" "*.gemspec" "*.erb" "*.haml" 54 (ruby-mode "*.r[bu]" "*.rake" "*.gemspec" "*.erb" "*.haml"
50 "Rakefile" "Thorfile" "Capfile" "Guardfile" "Vagrantfile") 55 "Rakefile" "Thorfile" "Capfile" "Guardfile" "Vagrantfile")
56 (python-mode "*.py" "*.pyi" "*.pyw")
51 (perl-mode "*.pl" "*.PL") 57 (perl-mode "*.pl" "*.PL")
52 (cperl-mode "*.pl" "*.PL") 58 (cperl-mode "*.pl" "*.PL")
53 (lisp-interaction-mode "*.el" "*.ede" ".emacs" "_emacs") 59 (lisp-interaction-mode "*.el" "*.ede" ".emacs" "_emacs")
@@ -58,7 +64,7 @@ See find -name man page for format.")
58(defun semantic-symref-derive-find-filepatterns (&optional mode) 64(defun semantic-symref-derive-find-filepatterns (&optional mode)
59 ;; FIXME: This should be moved to grep.el, where it could be used 65 ;; FIXME: This should be moved to grep.el, where it could be used
60 ;; for "C-u M-x grep" as well. 66 ;; for "C-u M-x grep" as well.
61 "Derive a list of file patterns for the current buffer. 67 "Derive a list of file (glob) patterns for the current buffer.
62Looks first in `semantic-symref-filepattern-alist'. If it is not 68Looks first in `semantic-symref-filepattern-alist'. If it is not
63there, it then looks in `auto-mode-alist', and attempts to derive something 69there, it then looks in `auto-mode-alist', and attempts to derive something
64from that. 70from that.
@@ -78,7 +84,7 @@ Optional argument MODE specifies the `major-mode' to test."
78 (error "Customize `semantic-symref-filepattern-alist' for %S" 84 (error "Customize `semantic-symref-filepattern-alist' for %S"
79 major-mode) 85 major-mode)
80 (let ((args `("-name" ,(car pat)))) 86 (let ((args `("-name" ,(car pat))))
81 (if (null (cdr args)) 87 (if (null (cdr pat))
82 args 88 args
83 `("(" ,@args 89 `("(" ,@args
84 ,@(mapcan (lambda (s) `("-o" "-name" ,s)) pat) 90 ,@(mapcan (lambda (s) `("-o" "-name" ,s)) pat)
@@ -149,7 +155,7 @@ This shell should support pipe redirect syntax."
149 (oref tool searchfor)) 155 (oref tool searchfor))
150 (t 156 (t
151 ;; Can't use the word boundaries: Grep 157 ;; Can't use the word boundaries: Grep
152 ;; doesn't always agrees with the language 158 ;; doesn't always agree with the language
153 ;; syntax on those. 159 ;; syntax on those.
154 (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" 160 (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)"
155 (oref tool searchfor))))) 161 (oref tool searchfor)))))