GNU bug report logs - #9278
rgrep fails on grep-find-command

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Wed, 10 Aug 2011 19:59:02 UTC

Severity: normal

Tags: patch

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: bug-gnu-emacs <at> gnu.org
Subject: rgrep fails on grep-find-command
Date: Wed, 10 Aug 2011 22:38:05 +0300
Tags: patch

With some grep default values, typing `C-u C-u M-x rgrep RET M-p RET'
fails with:

(wrong-type-argument stringp ("find . -type f -exec grep -inH -e  {} +" . 35))

because `grep-compute-defaults' computes the default value of
`grep-find-command' to ("find . -type f -exec grep -inH -e {} +" . 35)
i.e. a cons of (STRING . POSITION) for INITIAL-CONTENTS
of `read-from-minibuffer' in `rgrep' and `grep-find'.

I don't know why `grep-find-command' has such a format (that also
is not documented in its docstring), but currently I don't see
a better solution.

So unless someone can propose a better fix, I'd like to install:

=== modified file 'lisp/progmodes/grep.el'
--- lisp/progmodes/grep.el	2011-08-10 18:15:32 +0000
+++ lisp/progmodes/grep.el	2011-08-10 19:30:02 +0000
@@ -965,7 +965,9 @@ (defun rgrep (regexp &optional files dir
     (unless (and dir (file-directory-p dir) (file-readable-p dir))
       (setq dir default-directory))
     (if (null files)
-	(if (not (string= regexp grep-find-command))
+	(if (not (string= regexp (if (consp grep-find-command)
+				     (car grep-find-command)
+				   grep-find-command)))
 	    (compilation-start regexp 'grep-mode))
       (setq dir (file-name-as-directory (expand-file-name dir)))
       (require 'find-dired)		; for `find-name-arg'





This bug report was last modified 14 years ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.