summaryrefslogtreecommitdiff
path: root/lisp/cedet
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2022-10-31 02:51:14 +0200
committerDmitry Gutov <dgutov@yandex.ru>2022-10-31 02:51:49 +0200
commita691e811e23dee48674e9e0716429074fdbe3d7b (patch)
tree709b336fc4b860a36fc6eb2c69e7fd239a8c4d20 /lisp/cedet
parent1712dec0c030c6fb64968a9d937b02e3cfe79e87 (diff)
downloademacs-a691e811e23dee48674e9e0716429074fdbe3d7b.tar.gz
Fix semantic-symref-perform-search when dir contains a space
* lisp/cedet/semantic/symref/grep.el (semantic-symref-grep--local-dir): New variable. (semantic-symref-perform-search): Use it. And use "." when expanding the template to substitute for the current dir. (semantic-symref-parse-tool-output-one-line): Use it (bug#55016)
Diffstat (limited to 'lisp/cedet')
-rw-r--r--lisp/cedet/semantic/symref/grep.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index 27ea80fc327..076775bfecb 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -139,6 +139,8 @@ This shell should support pipe redirect syntax."
(lambda (s) (concat "\\" s))
string nil t))
+(defvar semantic-symref-grep--local-dir nil)
+
(cl-defmethod semantic-symref-perform-search ((tool semantic-symref-tool-grep))
"Perform a search with Grep."
;; Grep doesn't support some types of searches.
@@ -170,11 +172,12 @@ This shell should support pipe redirect syntax."
(erase-buffer)
(setq default-directory rootdir)
(let ((cmd (semantic-symref-grep-use-template
- (directory-file-name (file-local-name rootdir))
+ "."
filepattern grepflags greppat)))
(process-file semantic-symref-grep-shell nil b nil
shell-command-switch cmd)))
- (setq ans (semantic-symref-parse-tool-output tool b))
+ (let ((semantic-symref-grep--local-dir (directory-file-name (file-local-name rootdir))))
+ (setq ans (semantic-symref-parse-tool-output tool b)))
;; Return the answer
ans))
@@ -190,12 +193,12 @@ Moves cursor to end of the match."
((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)
+ (concat semantic-symref-grep--local-dir (substring (match-string file-group) 1))
(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))
+ (concat semantic-symref-grep--local-dir (substring (match-string file-group) 1)))
)))))
(provide 'semantic/symref/grep)