[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f37d86e 4/5: semantic/symref/grep: Support regexp s
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] master f37d86e 4/5: semantic/symref/grep: Support regexp search |
Date: |
Sun, 10 May 2015 17:46:33 +0000 |
branch: master
commit f37d86ed0bd0857cfb5c606e9d5b5611d02783aa
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
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.
---
lisp/cedet/semantic/symref.el | 8 ++++++--
lisp/cedet/semantic/symref/grep.el | 16 +++++++++-------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index 10293d9..2c5e3ba 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -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))
diff --git a/lisp/cedet/semantic/symref/grep.el
b/lisp/cedet/semantic/symref/grep.el
index 3fa1c5f..3cf841e 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."
"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*"))