unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: S Boucher <stbya@yahoo.com>
Cc: 6114@debbugs.gnu.org
Subject: bug#6114: 23.1; grep-read-files does incorrect wildcard match
Date: Fri, 21 May 2010 03:28:50 +0300	[thread overview]
Message-ID: <87pr0qxev1.fsf@mail.jurta.org> (raw)
In-Reply-To: <741057.58002.qm@web56807.mail.re3.yahoo.com> (S. Boucher's message of "Wed, 5 May 2010 12:22:23 -0700 (PDT)")

> This bug is for (defun grep-read-files (regexp) in file grep.el.
>
> In grep-read-files, there's a call to (wildcard-to-regexp (cdr alias))
> with the assumption that (cdr alias) is a single pattern.  However,
> the variable grep-files-aliases actually can have multiple patterns
> for each alias.  So, the multi-pattern aliases, such as for "cc",
> cannot correctly match:
>
> (defcustom grep-files-aliases
>   '(("asm" .    "*.[sS]")
>     ("c" .     "*.c")
>     ("cc" .    "*.cc *.cxx *.cpp *.C *.CC *.c++")
>     ... etc...

Does this patch do what you want?  (Please note that we have to remove
"*" ("all") because it matches everything.)

=== modified file 'lisp/progmodes/grep.el'
--- lisp/progmodes/grep.el	2010-04-20 00:49:46 +0000
+++ lisp/progmodes/grep.el	2010-05-21 00:27:18 +0000
@@ -781,12 +781,17 @@ (defun grep-read-files (regexp)
 		  (file-name-nondirectory bn)))
 	 (default-alias
 	   (and fn
-		(let ((aliases grep-files-aliases)
+		(let ((aliases (remove (assoc "all" grep-files-aliases)
+				       grep-files-aliases))
 		      alias)
 		  (while aliases
 		    (setq alias (car aliases)
 			  aliases (cdr aliases))
-		    (if (string-match (wildcard-to-regexp (cdr alias)) fn)
+		    (if (string-match (mapconcat
+				       'wildcard-to-regexp
+				       (split-string (cdr alias) nil t)
+				       "\\|")
+				      fn)
 			(setq aliases nil)
 		      (setq alias nil)))
 		  (cdr alias))))

-- 
Juri Linkov
http://www.jurta.org/emacs/





  parent reply	other threads:[~2010-05-21  0:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-05 19:22 bug#6114: 23.1; grep-read-files does incorrect wildcard match S Boucher
2010-05-06 20:50 ` Juri Linkov
2010-05-21  0:28 ` Juri Linkov [this message]
2010-05-21 16:20   ` S Boucher
2010-05-21 20:46     ` Juri Linkov
2011-12-05  3:05 ` bug#6114: this bug is still present in Emacs version 23.3.1! Mark Lillibridge
2011-12-05  5:57   ` Glenn Morris
2011-12-08  4:07     ` Mark Lillibridge

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=87pr0qxev1.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=6114@debbugs.gnu.org \
    --cc=stbya@yahoo.com \
    /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).