aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2017-01-29 10:41:32 +0200
committerDmitry Gutov2017-01-29 23:01:42 +0200
commit8ba236e772b64d0bb021aa691bd7eacf4b7f3ae4 (patch)
tree9c6a6389da74bdb5cffe5b4c6ae56fe646bc5c67
parent52feecd3c71716ca5dbade0e8e6ae2f8ebf46e54 (diff)
downloademacs-8ba236e772b64d0bb021aa691bd7eacf4b7f3ae4.tar.gz
emacs-8ba236e772b64d0bb021aa691bd7eacf4b7f3ae4.zip
Escape dash in xref rgrep regexp
* lisp/progmodes/xref.el (xref-collect-matches): Escape dash in REGEXP if it's the first character.
-rw-r--r--lisp/progmodes/xref.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index d8098c5a54a..a507755d42e 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -918,6 +918,10 @@ IGNORES is a list of glob patterns."
918 (grep-compute-defaults) 918 (grep-compute-defaults)
919 (defvar grep-find-template) 919 (defvar grep-find-template)
920 (defvar grep-highlight-matches) 920 (defvar grep-highlight-matches)
921 ;; 'grep -E -foo' results in 'grep: oo: No such file or directory'.
922 ;; while 'grep -e -foo' inexplicably doesn't.
923 (when (eq (aref regexp 0) ?-)
924 (setq regexp (concat "\\" regexp)))
921 (let* ((grep-find-template (replace-regexp-in-string "-e " "-E " 925 (let* ((grep-find-template (replace-regexp-in-string "-e " "-E "
922 grep-find-template t t)) 926 grep-find-template t t))
923 (grep-highlight-matches nil) 927 (grep-highlight-matches nil)