[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 4886b2e: Use regexp matching instead of checking ex
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] master 4886b2e: Use regexp matching instead of checking exit status |
Date: |
Mon, 29 May 2017 17:59:31 -0400 (EDT) |
branch: master
commit 4886b2ed52249597d1ea638f20c0ceb689075e72
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Use regexp matching instead of checking exit status
* lisp/progmodes/xref.el (xref-collect-matches):
See if the output buffer contents look like Grep output
instead of checking exit status (bug#23451).
---
lisp/progmodes/xref.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index c43f3a4..b8ec50f 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -935,11 +935,14 @@ IGNORES is a list of glob patterns."
(erase-buffer)
(setq status
(call-process-shell-command command nil t))
- (when (and (not (zerop status))
- ;; Nonzero status can mean "no matches found".
- (/= (point-min) (point-max)))
- (user-error "Search failed with status %d: %s" status (buffer-string)))
(goto-char (point-min))
+ ;; Can't use the exit status: Grep exits with 1 to mean "no
+ ;; matches found". Find exits with 1 if any of the invocations
+ ;; exit with non-zero. "No matches" and "Grep program not found"
+ ;; are all the same to it.
+ (when (and (/= (point-min) (point-max))
+ (not (looking-at grep-re)))
+ (user-error "Search failed with status %d: %s" status (buffer-string)))
(while (re-search-forward grep-re nil t)
(push (list (string-to-number (match-string 2))
(match-string 1)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 4886b2e: Use regexp matching instead of checking exit status,
Dmitry Gutov <=