[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#6114: 23.1; grep-read-files does incorrect wildcard match
From: |
S Boucher |
Subject: |
bug#6114: 23.1; grep-read-files does incorrect wildcard match |
Date: |
Fri, 21 May 2010 09:20:15 -0700 (PDT) |
Tried it. Seems to work.
Thanks,
--- On Thu, 5/20/10, Juri Linkov <juri@jurta.org> wrote:
> From: Juri Linkov <juri@jurta.org>
> Subject: Re: 23.1; grep-read-files does incorrect wildcard match
> To: "S Boucher" <stbya@yahoo.com>
> Cc: 6114@debbugs.gnu.org
> Received: Thursday, May 20, 2010, 8:28 PM
> > 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/
>