From: Eli Zaretskii <eliz@gnu.org>
To: dgutov@yandex.ru
Cc: 19468@debbugs.gnu.org
Subject: bug#19468: 25.0.50; UI inconveniences with M-.
Date: Sat, 02 May 2015 14:45:00 +0300 [thread overview]
Message-ID: <83lhh7p5j7.fsf@gnu.org> (raw)
In-Reply-To: <83oam3p6ux.fsf@gnu.org>
> Date: Sat, 02 May 2015 14:16:22 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 19468@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
next prev parent reply other threads:[~2015-05-02 11:45 UTC|newest]
Thread overview: 161+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-29 20:26 bug#19468: 25.0.50; UI inconveniences with M- Eli Zaretskii
2014-12-30 6:04 ` Dmitry Gutov
2014-12-30 8:19 ` Helmut Eller
2014-12-30 16:00 ` Eli Zaretskii
2014-12-30 17:02 ` Helmut Eller
2014-12-30 17:39 ` Eli Zaretskii
2014-12-30 19:56 ` Dmitry Gutov
2014-12-30 19:38 ` Dmitry Gutov
2014-12-30 22:58 ` Helmut Eller
2015-01-03 21:37 ` Dmitry Gutov
2015-01-04 8:55 ` martin rudalics
2015-01-04 22:51 ` Dmitry Gutov
2015-01-05 7:08 ` martin rudalics
2015-01-06 10:39 ` Dmitry Gutov
2015-04-26 14:56 ` Eli Zaretskii
2015-04-27 4:30 ` Stefan Monnier
2015-04-27 15:07 ` Eli Zaretskii
2015-04-27 17:35 ` Stefan Monnier
2015-04-27 19:26 ` Eli Zaretskii
2015-04-27 21:54 ` Stefan Monnier
2015-04-27 22:45 ` Dmitry Gutov
2015-04-28 14:56 ` Eli Zaretskii
2015-04-28 14:48 ` Eli Zaretskii
2015-04-28 21:00 ` Dmitry Gutov
2015-04-29 15:41 ` Eli Zaretskii
2015-04-29 17:22 ` Dmitry Gutov
2015-04-29 17:58 ` Eli Zaretskii
2015-04-27 22:36 ` Dmitry Gutov
2015-04-27 23:15 ` Stefan Monnier
2015-04-27 23:25 ` Dmitry Gutov
2015-04-28 1:26 ` Stefan Monnier
2015-04-28 1:37 ` Dmitry Gutov
2015-04-28 13:30 ` Stefan Monnier
2015-04-28 21:04 ` Dmitry Gutov
2015-04-27 22:44 ` Dmitry Gutov
2015-04-27 23:19 ` Stefan Monnier
2015-04-28 0:24 ` Dmitry Gutov
2015-04-28 1:34 ` Stefan Monnier
2015-04-28 15:01 ` Eli Zaretskii
2015-04-28 18:47 ` Dmitry Gutov
2015-04-28 14:59 ` Eli Zaretskii
2015-04-28 14:55 ` Eli Zaretskii
2015-04-28 21:33 ` Dmitry Gutov
2015-04-29 15:46 ` Eli Zaretskii
2015-04-29 22:56 ` Dmitry Gutov
2015-04-30 13:48 ` Eli Zaretskii
2015-05-01 2:27 ` Dmitry Gutov
2015-05-01 6:45 ` Eli Zaretskii
2015-05-01 11:27 ` Dmitry Gutov
2015-05-01 12:57 ` Eli Zaretskii
2015-05-01 14:51 ` Dmitry Gutov
2015-05-01 18:38 ` Eli Zaretskii
2015-05-01 18:44 ` Dmitry Gutov
2015-05-01 19:22 ` Eli Zaretskii
2015-05-01 20:36 ` Dmitry Gutov
2015-05-02 7:39 ` Eli Zaretskii
2015-05-01 18:13 ` Stefan Monnier
2015-04-27 22:09 ` Dmitry Gutov
2015-04-28 14:49 ` Eli Zaretskii
2015-04-28 21:59 ` Dmitry Gutov
2015-04-29 15:46 ` Eli Zaretskii
2015-04-29 22:32 ` Dmitry Gutov
2015-04-27 15:13 ` Eli Zaretskii
2015-04-27 17:21 ` Stefan Monnier
2015-04-27 19:15 ` Eli Zaretskii
2015-04-27 21:42 ` Stefan Monnier
2015-04-27 22:32 ` Dmitry Gutov
2015-04-28 14:55 ` Eli Zaretskii
2015-04-28 22:04 ` Dmitry Gutov
2015-04-29 15:47 ` Eli Zaretskii
2015-04-27 22:25 ` Dmitry Gutov
2015-04-27 22:54 ` Stefan Monnier
2015-04-27 23:15 ` Dmitry Gutov
2015-04-28 1:25 ` Stefan Monnier
2015-04-28 2:15 ` Dmitry Gutov
2015-04-28 13:36 ` Stefan Monnier
2015-04-29 0:24 ` Dmitry Gutov
2015-04-28 15:03 ` Eli Zaretskii
2015-04-28 22:07 ` Dmitry Gutov
2015-04-29 15:47 ` Eli Zaretskii
2015-04-28 14:58 ` Eli Zaretskii
2015-04-28 22:08 ` Dmitry Gutov
2015-04-28 0:01 ` Drew Adams
2015-04-28 14:57 ` Eli Zaretskii
2015-04-29 15:00 ` Vitalie Spinu
2015-04-29 15:25 ` Dmitry Gutov
2015-04-29 16:01 ` Vitalie Spinu
2015-04-29 22:02 ` Stefan Monnier
2015-04-29 16:11 ` Eli Zaretskii
2015-04-28 14:52 ` Eli Zaretskii
2015-04-28 22:28 ` Dmitry Gutov
2015-04-29 15:48 ` Eli Zaretskii
2015-04-29 17:43 ` Dmitry Gutov
2015-04-29 18:03 ` Eli Zaretskii
2015-05-02 0:08 ` Dmitry Gutov
2015-05-02 6:42 ` Eli Zaretskii
2015-05-02 10:23 ` Dmitry Gutov
2015-05-02 11:24 ` Eli Zaretskii
2015-05-02 12:07 ` Dmitry Gutov
2015-05-02 12:46 ` Eli Zaretskii
2015-05-02 7:10 ` Eli Zaretskii
2015-05-02 10:11 ` Dmitry Gutov
2015-05-02 11:16 ` Eli Zaretskii
2015-05-02 11:45 ` Eli Zaretskii [this message]
2015-05-02 12:16 ` Dmitry Gutov
2015-05-02 12:49 ` Eli Zaretskii
2015-05-02 13:04 ` Dmitry Gutov
2015-05-03 14:44 ` Eli Zaretskii
2015-05-02 12:01 ` Dmitry Gutov
2015-05-02 12:45 ` Eli Zaretskii
2015-05-02 13:42 ` Dmitry Gutov
2015-05-02 14:13 ` Eli Zaretskii
2015-05-02 17:41 ` Dmitry Gutov
2015-05-02 18:45 ` Eli Zaretskii
2015-05-02 19:17 ` Dmitry Gutov
2015-05-02 19:45 ` Eli Zaretskii
2015-05-02 20:06 ` Dmitry Gutov
2015-05-02 13:41 ` Eli Zaretskii
2015-05-02 17:35 ` Dmitry Gutov
2015-05-04 14:48 ` Eli Zaretskii
2015-04-27 22:15 ` Dmitry Gutov
2015-04-28 14:50 ` Eli Zaretskii
2015-04-28 22:15 ` Dmitry Gutov
2015-04-29 15:48 ` Eli Zaretskii
2015-04-29 17:42 ` Dmitry Gutov
2015-04-27 22:02 ` Dmitry Gutov
2015-04-27 23:47 ` Dmitry Gutov
2015-04-28 15:00 ` Eli Zaretskii
2015-04-28 23:24 ` Dmitry Gutov
2015-04-29 15:49 ` Eli Zaretskii
2015-04-29 23:03 ` Dmitry Gutov
2015-04-30 13:49 ` Eli Zaretskii
2014-12-30 15:41 ` Eli Zaretskii
2014-12-30 20:26 ` Dmitry Gutov
2015-01-04 23:52 ` Dmitry Gutov
2015-01-05 19:43 ` Eli Zaretskii
2014-12-30 17:03 ` Stefan Monnier
2014-12-30 17:11 ` Dmitry Gutov
2014-12-30 17:43 ` Eli Zaretskii
2014-12-30 17:49 ` Dmitry Gutov
2014-12-30 18:01 ` Eli Zaretskii
2014-12-30 17:25 ` Helmut Eller
2014-12-30 18:08 ` Stefan Monnier
2014-12-30 17:41 ` Eli Zaretskii
2014-12-30 17:50 ` Helmut Eller
2014-12-30 17:58 ` Eli Zaretskii
2014-12-30 18:08 ` Dmitry Gutov
2014-12-30 17:53 ` Dmitry Gutov
2014-12-30 18:00 ` Eli Zaretskii
2014-12-30 18:01 ` Helmut Eller
2014-12-30 18:13 ` Eli Zaretskii
2014-12-30 18:20 ` Helmut Eller
2014-12-30 18:27 ` Eli Zaretskii
2014-12-30 18:33 ` Helmut Eller
2014-12-30 18:38 ` Eli Zaretskii
2014-12-30 18:53 ` Helmut Eller
2014-12-30 19:33 ` Eli Zaretskii
2014-12-30 18:33 ` Dmitry Gutov
2016-02-21 23:00 ` Dmitry Gutov
2016-02-22 17:18 ` Eli Zaretskii
2016-02-22 21:15 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83lhh7p5j7.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=19468@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).