bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#55800: using rgrep function interactively with fido-mode or fido-ver


From: Juri Linkov
Subject: bug#55800: using rgrep function interactively with fido-mode or fido-vertical-mode causes errors
Date: Mon, 13 Jun 2022 10:20:44 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> 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:

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))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]