aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2017-05-30 00:58:39 +0300
committerDmitry Gutov2017-05-30 00:59:03 +0300
commit4886b2ed52249597d1ea638f20c0ceb689075e72 (patch)
treef610ad281501730cd6421a3ba6b5079fe1886a28
parent299a96c7f6f8dbba210c373130cd9f2d4eec77a5 (diff)
downloademacs-4886b2ed52249597d1ea638f20c0ceb689075e72.tar.gz
emacs-4886b2ed52249597d1ea638f20c0ceb689075e72.zip
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).
-rw-r--r--lisp/progmodes/xref.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index c43f3a4ca83..b8ec50f14ae 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -935,11 +935,14 @@ IGNORES is a list of glob patterns."
935 (erase-buffer) 935 (erase-buffer)
936 (setq status 936 (setq status
937 (call-process-shell-command command nil t)) 937 (call-process-shell-command command nil t))
938 (when (and (not (zerop status))
939 ;; Nonzero status can mean "no matches found".
940 (/= (point-min) (point-max)))
941 (user-error "Search failed with status %d: %s" status (buffer-string)))
942 (goto-char (point-min)) 938 (goto-char (point-min))
939 ;; Can't use the exit status: Grep exits with 1 to mean "no
940 ;; matches found". Find exits with 1 if any of the invocations
941 ;; exit with non-zero. "No matches" and "Grep program not found"
942 ;; are all the same to it.
943 (when (and (/= (point-min) (point-max))
944 (not (looking-at grep-re)))
945 (user-error "Search failed with status %d: %s" status (buffer-string)))
943 (while (re-search-forward grep-re nil t) 946 (while (re-search-forward grep-re nil t)
944 (push (list (string-to-number (match-string 2)) 947 (push (list (string-to-number (match-string 2))
945 (match-string 1) 948 (match-string 1)