aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorDmitry Gutov2015-05-10 17:27:16 +0300
committerDmitry Gutov2015-05-10 20:45:38 +0300
commitf37d86ed0bd0857cfb5c606e9d5b5611d02783aa (patch)
tree5f4e160223c2edb0998e06fd6922960132bb717d /lisp
parentcc64f157883030c443b24692ca4304e047e2aaf9 (diff)
downloademacs-f37d86ed0bd0857cfb5c606e9d5b5611d02783aa.tar.gz
emacs-f37d86ed0bd0857cfb5c606e9d5b5611d02783aa.zip
semantic/symref/grep: Support regexp search
* lisp/cedet/semantic/symref.el (semantic-symref-hit-to-tag-via-buffer): Don't regexp-quote when the search type is regexp. * lisp/cedet/semantic/symref/grep.el (semantic-symref-perform-search): Support the regexp search type. Pass -E to Grep when it's used.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/cedet/semantic/symref.el8
-rw-r--r--lisp/cedet/semantic/symref/grep.el16
2 files changed, 15 insertions, 9 deletions
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index 10293d9496c..2c5e3ba1805 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -472,8 +472,12 @@ buffers that were opened."
472 (goto-char (point-min)) 472 (goto-char (point-min))
473 (forward-line (1- line)) 473 (forward-line (1- line))
474 474
475 ;; Search forward for the matching text 475 ;; Search forward for the matching text.
476 (when (re-search-forward (regexp-quote searchtxt) 476 ;; FIXME: This still fails if the regexp uses something specific
477 ;; to the extended syntax, like grouping.
478 (when (re-search-forward (if (memq searchtype '(regexp tagregexp))
479 searchtxt
480 (regexp-quote searchtxt))
477 (point-at-eol) 481 (point-at-eol)
478 t) 482 t)
479 (goto-char (match-beginning 0)) 483 (goto-char (match-beginning 0))
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index 3fa1c5ff7d8..3cf841e4f2c 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -141,7 +141,7 @@ This shell should support pipe redirect syntax."
141 "Perform a search with Grep." 141 "Perform a search with Grep."
142 ;; Grep doesn't support some types of searches. 142 ;; Grep doesn't support some types of searches.
143 (let ((st (oref tool :searchtype))) 143 (let ((st (oref tool :searchtype)))
144 (when (not (eq st 'symbol)) 144 (when (not (memq st '(symbol regexp)))
145 (error "Symref impl GREP does not support searchtype of %s" st)) 145 (error "Symref impl GREP does not support searchtype of %s" st))
146 ) 146 )
147 ;; Find the root of the project, and do a find-grep... 147 ;; Find the root of the project, and do a find-grep...
@@ -150,12 +150,14 @@ This shell should support pipe redirect syntax."
150 (filepattern (semantic-symref-derive-find-filepatterns)) 150 (filepattern (semantic-symref-derive-find-filepatterns))
151 ;; Grep based flags. 151 ;; Grep based flags.
152 (grepflags (cond ((eq (oref tool :resulttype) 'file) 152 (grepflags (cond ((eq (oref tool :resulttype) 'file)
153 "-l ") 153 "-l ")
154 (t "-n "))) 154 ((eq (oref tool :searchtype) 'regexp)
155 (greppat (cond ((eq (oref tool :searchtype) 'regexp) 155 "-nE ")
156 (oref tool searchfor)) 156 (t "-n ")))
157 (t 157 (greppat (shell-quote-argument
158 (shell-quote-argument 158 (cond ((eq (oref tool :searchtype) 'regexp)
159 (oref tool searchfor))
160 (t
159 (concat "\\<" (oref tool searchfor) "\\>"))))) 161 (concat "\\<" (oref tool searchfor) "\\>")))))
160 ;; Misc 162 ;; Misc
161 (b (get-buffer-create "*Semantic SymRef*")) 163 (b (get-buffer-create "*Semantic SymRef*"))