summaryrefslogtreecommitdiff
path: root/lisp/cedet/semantic/symref/grep.el
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@raeburn.org>2017-07-31 01:13:53 -0400
committerKen Raeburn <raeburn@raeburn.org>2017-07-31 01:13:53 -0400
commit13f3370400031e2ac1c9be0932f411370fc6984e (patch)
tree06f349b2b0f1cda9e36f7c4390d9d2d9bf49303c /lisp/cedet/semantic/symref/grep.el
parentcd0966b33c1fe975520e85e0e7af82c09e4754dc (diff)
parentdcfcaf40d577808d640016c886d4fae7280a7fd5 (diff)
downloademacs-scratch/raeburn-startup.tar.gz
; Merge from branch 'master'scratch/raeburn-startup
Diffstat (limited to 'lisp/cedet/semantic/symref/grep.el')
-rw-r--r--lisp/cedet/semantic/symref/grep.el33
1 files changed, 16 insertions, 17 deletions
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index 42dc40cce04..df71508da7c 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -189,26 +189,25 @@ This shell should support pipe redirect syntax."
;; Return the answer
ans))
-(defconst semantic-symref-grep--line-re
- "^\\(\\(?:[a-zA-Z]:\\)?[^:\n]+\\):\\([0-9]+\\):")
-
(cl-defmethod semantic-symref-parse-tool-output-one-line ((tool semantic-symref-tool-grep))
"Parse one line of grep output, and return it as a match list.
Moves cursor to end of the match."
- (cond ((eq (oref tool :resulttype) 'file)
- ;; Search for files
- (when (re-search-forward "^\\([^\n]+\\)$" nil t)
- (match-string 1)))
- ((eq (oref tool :resulttype) 'line-and-text)
- (when (re-search-forward semantic-symref-grep--line-re nil t)
- (list (string-to-number (match-string 2))
- (match-string 1)
- (buffer-substring-no-properties (point) (line-end-position)))))
- (t
- (when (re-search-forward semantic-symref-grep--line-re nil t)
- (cons (string-to-number (match-string 2))
- (match-string 1))
- ))))
+ (pcase-let
+ ((`(,grep-re ,file-group ,line-group . ,_) (car (grep-regexp-alist))))
+ (cond ((eq (oref tool :resulttype) 'file)
+ ;; Search for files
+ (when (re-search-forward "^\\([^\n]+\\)$" nil t)
+ (match-string 1)))
+ ((eq (oref tool :resulttype) 'line-and-text)
+ (when (re-search-forward grep-re nil t)
+ (list (string-to-number (match-string line-group))
+ (match-string file-group)
+ (buffer-substring-no-properties (point) (line-end-position)))))
+ (t
+ (when (re-search-forward grep-re nil t)
+ (cons (string-to-number (match-string line-group))
+ (match-string file-group))
+ )))))
(provide 'semantic/symref/grep)