unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: 11084@debbugs.gnu.org
Subject: bug#11084: 24.0.94; [PATCH] Completion on DEF arg in grep-read-files is wrong.
Date: Sat, 24 Mar 2012 13:47:54 +0100	[thread overview]
Message-ID: <87r4wicghx.fsf@gmail.com> (raw)
In-Reply-To: <87vclucwxr.fsf@gmail.com>

Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:

> Hi,
> it seem completion in grep-read-files is wrong for the default arg.
> It use (mapcar 'car grep-files-aliases) where it should use the cdr.
My bad, this is wrong the car should be used.
So here the patch:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -855,16 +855,17 @@
 	       default-extension
 	       (car grep-files-history)
 	       (car (car grep-files-aliases))))
+         (def-lst (delete-dups
+                   (delq nil (append (list default default-alias default-extension)
+                                     (mapcar 'car grep-files-aliases))))) 
 	 (files (completing-read
 		 (concat "Search for \"" regexp
 			 "\" in files"
 			 (if default (concat " (default " default ")"))
 			 ": ")
-		 'read-file-name-internal
+		 (append def-lst (all-completions "" 'read-file-name-internal))
 		 nil nil nil 'grep-files-history
-		 (delete-dups
-		  (delq nil (append (list default default-alias default-extension)
-				    (mapcar 'car grep-files-aliases)))))))
+                 default)))
     (and files
 	 (or (cdr (assoc files grep-files-aliases))
 	     files))))
--8<---------------cut here---------------end--------------->8---

Not using a list as DEF arg for completing-read is better.

-- 
  Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 






  reply	other threads:[~2012-03-24 12:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-24  6:52 bug#11084: 24.0.94; [PATCH] Completion on DEF arg in grep-read-files is wrong Thierry Volpiatto
2012-03-24 12:47 ` Thierry Volpiatto [this message]
2012-03-24 13:47 ` Stefan Monnier
2012-03-24 14:48   ` Thierry Volpiatto
2012-03-24 18:21     ` Stefan Monnier

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=87r4wicghx.fsf@gmail.com \
    --to=thierry.volpiatto@gmail.com \
    --cc=11084@debbugs.gnu.org \
    /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).