[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 851452f: Fix semantic-symref-parse-tool-output-one-
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] master 851452f: Fix semantic-symref-parse-tool-output-one-line after 644cdd1aa0 |
Date: |
Wed, 26 Jul 2017 12:35:46 -0400 (EDT) |
branch: master
commit 851452f8f754324bba3374c46d2029c3d23a339f
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Fix semantic-symref-parse-tool-output-one-line after 644cdd1aa0
* lisp/cedet/semantic/symref/grep.el
(semantic-symref-grep--line-re): Delete.
(semantic-symref-parse-tool-output-one-line):
Use regexp and group numbers from (grep-regexp-alist).
---
lisp/cedet/semantic/symref/grep.el | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/lisp/cedet/semantic/symref/grep.el
b/lisp/cedet/semantic/symref/grep.el
index 42dc40c..df71508 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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 851452f: Fix semantic-symref-parse-tool-output-one-line after 644cdd1aa0,
Dmitry Gutov <=