GNU bug report logs - #55800
using rgrep function interactively with fido-mode or fido-vertical-mode causes errors

Previous Next

Package: emacs;

Reported by: Yilkal Argaw <yilkalargawworkneh <at> gmail.com>

Date: Sun, 5 Jun 2022 01:12:02 UTC

Severity: normal

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


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

From: Juri Linkov <juri <at> linkov.net>
To: Yilkal Argaw <yilkalargawworkneh <at> gmail.com>
Cc: 55800 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#55800: using rgrep function interactively with fido-mode or
 fido-vertical-mode causes errors
Date: Mon, 13 Jun 2022 10:20:44 +0300
[Message part 1 (text/plain, inline)]
>> So maybe fido-mode could be fixed to always provide the default value
>> as the first highlighted candidate?  Then RET will select it.
>
> Another part of the problem is still unsolved and the question still is:
> shouldn't fido-mode bubble the default value to the top of the list
> even when the default value doesn't exist in the list of completion
> candidates?  This is the same question as was asked in
> https://debbugs.gnu.org/38992#76

It seems there is no way to change the behaviour of fido-mode,
so what remains to do is to add the default values to the completion list
only in rgrep, then fido-mode will highlight the default at the top:

[grep-read-files.patch (text/x-diff, inline)]
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index e0c9e6c76b..5d45a7d88f 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -1072,15 +1072,18 @@ grep-read-files
 	       default-extension
 	       (car grep-files-history)
 	       (car (car grep-files-aliases))))
+	 (defaults
+	   (delete-dups
+	    (delq nil
+		  (append (list default default-alias default-extension)
+			  (mapcar #'car grep-files-aliases)))))
          (files (completing-read
                  (format-prompt "Search for \"%s\" in files matching wildcard"
                                 default regexp)
-		 #'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)))))))
+                 (completion-table-merge
+                  (lambda (_string _pred _action) defaults)
+                  #'read-file-name-internal)
+		 nil nil nil 'grep-files-history defaults)))
     (and files
 	 (or (cdr (assoc files grep-files-aliases))
 	     files))))

This bug report was last modified 3 years and 36 days ago.

Previous Next


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