GNU bug report logs -
#19468
25.0.50; UI inconveniences with M-.
Previous Next
Reported by: Eli Zaretskii <eliz <at> gnu.org>
Date: Mon, 29 Dec 2014 20:27:02 UTC
Severity: normal
Found in version 25.0.50
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Date: Sat, 02 May 2015 14:16:22 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 19468 <at> debbugs.gnu.org
>
> And the saga is not yet over, but now I need help. The method
> semantic-symref-parse-tool-output-one-line returns nil, but I cannot
> seem to figure out why. The buffer which contains Grep hits look fine
> to me (except that it includes SGR escape sequences, due to
> "--color=always" switch to Grep -- why is that a good idea?), but
> where's the code of this method? I couldn't step into it with Edebug,
> for some reason.
Found it: that --color=always _is_ the problem, since the SGR escapes
interfere with the search. How does this work on Posix platforms?
Should we filter out that switch unconditionally?
The patch below incorporates the additional fix for this problem, and
now, finally, I have my references using Grep as well:
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index 981dab8..da1803f 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -105,7 +105,11 @@ (defun semantic-symref-grep-use-template (rootdir filepattern grepflags greppatt
;; We have grep-compute-defaults. Let's use it.
(grep-compute-defaults)
(let* ((grep-expand-keywords semantic-symref-grep-expand-keywords)
- (cmd (grep-expand-template grep-find-template
+ (cmd (grep-expand-template (if (memq system-type '(windows-nt ms-dos))
+ (replace-regexp-in-string
+ "--color=always" "--color=auto"
+ grep-find-template t t)
+ grep-find-template)
greppattern
filepattern
rootdir)))
@@ -115,7 +119,7 @@ (defun semantic-symref-grep-use-template (rootdir filepattern grepflags greppatt
;;(message "New command: %s" cmd)
cmd))
-(defcustom semantic-symref-grep-shell "sh"
+(defcustom semantic-symref-grep-shell shell-file-name
"The shell command to use for executing find/grep.
This shell should support pipe redirect syntax."
:group 'semantic
@@ -140,7 +144,8 @@ (cl-defmethod semantic-symref-perform-search ((tool semantic-symref-tool-grep))
(greppat (cond ((eq (oref tool :searchtype) 'regexp)
(oref tool searchfor))
(t
- (concat "'\\<" (oref tool searchfor) "\\>'"))))
+ (shell-quote-argument
+ (concat "\\<" (oref tool searchfor) "\\>")))))
;; Misc
(b (get-buffer-create "*Semantic SymRef*"))
(ans nil)
@@ -158,10 +163,12 @@ (cl-defmethod semantic-symref-perform-search ((tool semantic-symref-tool-grep))
(let ((cmd (concat "find " default-directory " -type f " filepattern " -print0 "
"| xargs -0 grep -H " grepflags "-e " greppat)))
;;(message "Old command: %s" cmd)
- (call-process semantic-symref-grep-shell nil b nil "-c" cmd)
+ (call-process semantic-symref-grep-shell nil b nil
+ shell-command-switch cmd)
)
(let ((cmd (semantic-symref-grep-use-template rootdir filepattern grepflags greppat)))
- (call-process semantic-symref-grep-shell nil b nil "-c" cmd))
+ (call-process semantic-symref-grep-shell nil b nil
+ shell-command-switch cmd))
))
(setq ans (semantic-symref-parse-tool-output tool b))
;; Return the answer
This bug report was last modified 9 years and 149 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.