]> code.delx.au - gnu-emacs/commitdiff
semantic/symref/grep: Support regexp search
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 10 May 2015 14:27:16 +0000 (17:27 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 10 May 2015 17:45:38 +0000 (20:45 +0300)
* 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.

lisp/cedet/semantic/symref.el
lisp/cedet/semantic/symref/grep.el

index 10293d9496c8af334c78fed89c677eb952ce87d7..2c5e3ba1805e1f0a8d95017cf2b732e5a1880eca 100644 (file)
@@ -472,8 +472,12 @@ buffers that were opened."
     (goto-char (point-min))
     (forward-line (1- line))
 
-    ;; Search forward for the matching text
-    (when (re-search-forward (regexp-quote searchtxt)
+    ;; Search forward for the matching text.
+    ;; FIXME: This still fails if the regexp uses something specific
+    ;; to the extended syntax, like grouping.
+    (when (re-search-forward (if (memq searchtype '(regexp tagregexp))
+                                 searchtxt
+                               (regexp-quote searchtxt))
                             (point-at-eol)
                             t)
       (goto-char (match-beginning 0))
index 3fa1c5ff7d8a89f30bc024962d69c5f1f8d49cfe..3cf841e4f2c74e31697896bd0cf1f7a6deebd2bc 100644 (file)
@@ -141,7 +141,7 @@ This shell should support pipe redirect syntax."
   "Perform a search with Grep."
   ;; Grep doesn't support some types of searches.
   (let ((st (oref tool :searchtype)))
-    (when (not (eq st 'symbol))
+    (when (not (memq st '(symbol regexp)))
       (error "Symref impl GREP does not support searchtype of %s" st))
     )
   ;; Find the root of the project, and do a find-grep...
@@ -150,12 +150,14 @@ This shell should support pipe redirect syntax."
         (filepattern (semantic-symref-derive-find-filepatterns))
         ;; Grep based flags.
         (grepflags (cond ((eq (oref tool :resulttype) 'file)
-                         "-l ")
-                        (t "-n ")))
-        (greppat (cond ((eq (oref tool :searchtype) 'regexp)
-                        (oref tool searchfor))
-                       (t
-                        (shell-quote-argument
+                           "-l ")
+                          ((eq (oref tool :searchtype) 'regexp)
+                           "-nE ")
+                          (t "-n ")))
+        (greppat (shell-quote-argument
+                   (cond ((eq (oref tool :searchtype) 'regexp)
+                          (oref tool searchfor))
+                         (t
                           (concat "\\<" (oref tool searchfor) "\\>")))))
         ;; Misc
         (b (get-buffer-create "*Semantic SymRef*"))