From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19468: 25.0.50; UI inconveniences with M-. Date: Sat, 02 May 2015 14:45:00 +0300 Message-ID: <83lhh7p5j7.fsf@gnu.org> References: <83zja6b3tc.fsf@gnu.org> <54A24079.4020902@yandex.ru> <54A2FF47.6010207@yandex.ru> <54A86135.7080004@yandex.ru> <54A90002.7080009@gmx.at> <54A9C3FB.7000602@yandex.ru> <54AA3881.3080304@gmx.at> <54ABBB47.7010603@yandex.ru> <837fszx7iy.fsf@gnu.org> <83pp6pwqnw.fsf@gnu.org> <553EB74A.4030208@yandex.ru> <83bni8wbin.fsf@gnu.org> <554009A5.5020001@yandex.ru> <83wq0vszof.fsf@gnu.org> <55411842.1020102@yandex.ru> <83a8xqu80z.fsf@gnu.org> <55441587.6050004@yandex.ru> <837fsrqwsh.fsf@gnu.org> <5544A2EE.1010507@yandex.ru> <83oam3p6ux.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1430567191 27977 80.91.229.3 (2 May 2015 11:46:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 May 2015 11:46:31 +0000 (UTC) Cc: 19468@debbugs.gnu.org To: dgutov@yandex.ru Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 02 13:46:16 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YoVs3-0006xE-Qv for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 May 2015 13:46:12 +0200 Original-Received: from localhost ([::1]:56663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoVs3-00043e-4Y for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 May 2015 07:46:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoVrz-00043L-DL for bug-gnu-emacs@gnu.org; Sat, 02 May 2015 07:46:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YoVrv-00039H-99 for bug-gnu-emacs@gnu.org; Sat, 02 May 2015 07:46:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoVrv-00039A-5Z for bug-gnu-emacs@gnu.org; Sat, 02 May 2015 07:46:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YoVru-0002C9-R0 for bug-gnu-emacs@gnu.org; Sat, 02 May 2015 07:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 May 2015 11:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19468 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19468-submit@debbugs.gnu.org id=B19468.14305671278382 (code B ref 19468); Sat, 02 May 2015 11:46:02 +0000 Original-Received: (at 19468) by debbugs.gnu.org; 2 May 2015 11:45:27 +0000 Original-Received: from localhost ([127.0.0.1]:59158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YoVrK-0002B7-Lp for submit@debbugs.gnu.org; Sat, 02 May 2015 07:45:27 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:41292) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YoVrH-0002Aj-IU for 19468@debbugs.gnu.org; Sat, 02 May 2015 07:45:25 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NNQ00D000K37M00@a-mtaout23.012.net.il> for 19468@debbugs.gnu.org; Sat, 02 May 2015 14:45:17 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NNQ00DZU0NG4P30@a-mtaout23.012.net.il>; Sat, 02 May 2015 14:45:17 +0300 (IDT) In-reply-to: <83oam3p6ux.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:102369 Archived-At: > Date: Sat, 02 May 2015 14:16:22 +0300 > From: Eli Zaretskii > 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