all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 38992@debbugs.gnu.org, "João Távora" <joaotavora@gmail.com>,
	waah@yellowfrog.io
Subject: bug#38992: 27.0.60; when enabled, fido-mode seems to break vc-git-grep
Date: Fri, 24 Jan 2020 01:07:15 +0300	[thread overview]
Message-ID: <9da3ee1b-7315-41d2-192b-9db470d50ba4@yandex.ru> (raw)
In-Reply-To: <jwv4kwmqgt0.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

On 23.01.2020 19:28, Stefan Monnier wrote:
> We could introduce a new `minibuffer-require-match` variable (and mark
> `minibuffer-completion-confirm` obsolete).

Why don't we just co-opt the older variable. A rename can come later. 
See patch 1.

Here's another issue related to the previous proposed fix: why *would* 
M-j exit minibuffer in all cases? It currently doesn't honor 
REQUIRE-MATCH=t (or the confirm- values, but I don't care about that). 
The default completing-read, as well as icomplete-mode, both honor it. 
The patch 2 fixes that.

Please take a look, y'all.

[-- Attachment #2: 0001-Honor-require-match-nil-in-icomplete-fido-ret.patch --]
[-- Type: text/x-patch, Size: 4736 bytes --]

From 73728a7928568c883650cc403194c3b95348a08b Mon Sep 17 00:00:00 2001
From: Dmitry Gutov <dgutov@yandex.ru>
Date: Fri, 24 Jan 2020 00:51:06 +0300
Subject: [PATCH 1/2] Honor require-match=nil in icomplete-fido-ret

---
 doc/lispref/minibuf.texi | 8 +++++---
 lisp/emacs-lisp/crm.el   | 3 +--
 lisp/icomplete.el        | 2 +-
 lisp/minibuffer.el       | 8 +++++---
 src/minibuf.c            | 3 ++-
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index ab806a9055..c881deeaf4 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1127,11 +1127,13 @@ Completion Commands
 @end defvar
 
 @defvar minibuffer-completion-confirm
-This variable determines whether Emacs asks for confirmation before
-exiting the minibuffer; @code{completing-read} binds this variable,
+This variable determines whether Emacs requires matching input or asks
+for confirmation before exiting the minibuffer;
+@code{completing-read} binds this variable,
 and the function @code{minibuffer-complete-and-exit} checks the value
 before exiting.  If the value is @code{nil}, confirmation is not
-required.  If the value is @code{confirm}, the user may exit with an
+required.  If the value is @code{t}, a match is required.
+If the value is @code{confirm}, the user may exit with an
 input that is not a valid completion alternative, but Emacs asks for
 confirmation.  If the value is @code{confirm-after-completion}, the
 user may exit with an input that is not a valid completion
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index 65483d0813..e8ab558a19 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -252,8 +252,7 @@ completing-read-multiple
 	(let* ((minibuffer-completion-table #'crm--collection-fn)
 	       (minibuffer-completion-predicate predicate)
 	       ;; see completing_read in src/minibuf.c
-	       (minibuffer-completion-confirm
-		(unless (eq require-match t) require-match))
+	       (minibuffer-completion-confirm require-match)
 	       (crm-completion-table table)
 	       (map (if require-match
 			crm-local-must-match-map
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index a1a67e2330..52429fdf37 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -541,7 +541,7 @@ icomplete-exhibit
                           (icomplete--completion-table)
                           (icomplete--completion-predicate)
                           (if (window-minibuffer-p)
-                              (not minibuffer-completion-confirm)))))
+                              (eq minibuffer-completion-confirm t)))))
                  (buffer-undo-list t)
                  deactivate-mark)
             ;; Do nothing if while-no-input was aborted.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 0589211877..56d3b259b4 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1386,7 +1386,10 @@ minibuffer-force-complete-and-exit
    (minibuffer-prompt-end) (point-max) #'exit-minibuffer
    ;; If the previous completion completed to an element which fails
    ;; test-completion, then we shouldn't exit, but that should be rare.
-   (lambda () (minibuffer-message "Incomplete"))))
+   (lambda ()
+     (if minibuffer-completion-predicate
+         (minibuffer-message "Incomplete")
+       (exit-minibuffer)))))
 
 (defun minibuffer-force-complete (&optional start end dont-cycle)
   "Complete the minibuffer to an exact match.
@@ -3734,8 +3737,7 @@ completing-read-default
 
   (let* ((minibuffer-completion-table collection)
          (minibuffer-completion-predicate predicate)
-         (minibuffer-completion-confirm (unless (eq require-match t)
-                                          require-match))
+         (minibuffer-completion-confirm require-match)
          (base-keymap (if require-match
                          minibuffer-local-must-match-map
                         minibuffer-local-completion-map))
diff --git a/src/minibuf.c b/src/minibuf.c
index c5f6145690..84e94c0627 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -2028,8 +2028,9 @@ syms_of_minibuf (void)
   Vminibuffer_completion_predicate = Qnil;
 
   DEFVAR_LISP ("minibuffer-completion-confirm", Vminibuffer_completion_confirm,
-	       doc: /* Whether to demand confirmation of completion before exiting minibuffer.
+	       doc: /* Whether matching completion or confirmation is required.
 If nil, confirmation is not required.
+If t, match is strictly required, can't finish input otherwise.
 If the value is `confirm', the user may exit with an input that is not
  a valid completion alternative, but Emacs asks for confirmation.
 If the value is `confirm-after-completion', the user may exit with an
-- 
2.20.1


[-- Attachment #3: 0002-Make-M-j-in-fido-mode-honor-REQUIRE-MATCH-t.patch --]
[-- Type: text/x-patch, Size: 1418 bytes --]

From c4130a620f913422c520c2ccf648eb409035e1d9 Mon Sep 17 00:00:00 2001
From: Dmitry Gutov <dgutov@yandex.ru>
Date: Fri, 24 Jan 2020 01:06:17 +0300
Subject: [PATCH 2/2] Make M-j in fido-mode honor REQUIRE-MATCH=t

---
 lisp/icomplete.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 52429fdf37..5e674b769d 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -284,6 +284,13 @@ icomplete-fido-ret
           (t
            (icomplete-force-complete-and-exit)))))
 
+(defun icomplete-fido-exit ()
+  "Exit minibuffer properly honoring `minibuffer-completion-confirm'."
+  (interactive)
+  (if minibuffer-completion-confirm
+      (minibuffer-complete-and-exit)
+    (exit-minibuffer)))
+
 (defun icomplete-fido-backward-updir ()
   "Delete char before or go up directory, like `ido-mode'."
   (interactive)
@@ -299,7 +306,7 @@ icomplete-fido-mode-map
     (define-key map (kbd "RET") 'icomplete-fido-ret)
     (define-key map (kbd "C-m") 'icomplete-fido-ret)
     (define-key map (kbd "DEL") 'icomplete-fido-backward-updir)
-    (define-key map (kbd "M-j") 'exit-minibuffer)
+    (define-key map (kbd "M-j") 'icomplete-fido-exit)
     (define-key map (kbd "C-s") 'icomplete-forward-completions)
     (define-key map (kbd "C-r") 'icomplete-backward-completions)
     (define-key map (kbd "<right>") 'icomplete-forward-completions)
-- 
2.20.1


  parent reply	other threads:[~2020-01-23 22:07 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 17:09 bug#38992: 27.0.60; when enabled, fido-mode seems to break vc-git-grep waah
2020-01-09  3:25 ` Dmitry Gutov
2020-01-09  7:42   ` João Távora
2020-01-09  7:49     ` waah
2020-01-09  9:54       ` João Távora
2020-01-09 10:10         ` João Távora
     [not found]           ` <944631362.128066.1578605073103@office.mailbox.org>
2020-01-09 22:27             ` Dmitry Gutov
2020-01-10 10:10               ` João Távora
2020-01-10 11:22                 ` waah
     [not found]                 ` <fd9ede8f-50dc-3bb4-d3b7-850e38a146ec@yandex.ru>
2020-01-11 18:59                   ` João Távora
2020-01-18  1:38                     ` Dmitry Gutov
2020-01-19 13:00                       ` João Távora
2020-01-20 14:54                         ` Dmitry Gutov
2020-01-20 14:58                           ` João Távora
2020-01-20 21:42                             ` Dmitry Gutov
2020-01-20 23:04                             ` Stefan Monnier
2020-01-20 23:56                               ` Dmitry Gutov
2020-01-21  8:12                                 ` João Távora
2020-01-23 22:22                                   ` Dmitry Gutov
2020-01-24 14:35                                     ` João Távora
2020-01-21 16:32                                 ` Stefan Monnier
2020-01-21 16:41                                   ` João Távora
2020-01-21 17:02                                     ` waah
2020-01-21 17:24                                       ` João Távora
2020-01-21 18:54                                     ` Stefan Monnier
2020-01-21 22:58                                       ` Dmitry Gutov
2020-01-22  0:29                                         ` João Távora
2020-01-22  0:32                                           ` Stefan Monnier
2020-01-22 12:34                                   ` Dmitry Gutov
2020-01-23 16:28                                     ` Stefan Monnier
2020-01-23 16:51                                       ` João Távora
2020-01-23 22:07                                       ` Dmitry Gutov [this message]
2020-01-24 14:11                                         ` Stefan Monnier
2020-01-24 14:31                                           ` Dmitry Gutov
2020-01-29 21:23                                             ` Stefan Monnier
2020-01-31  1:48                                               ` Dmitry Gutov
2020-01-31 13:17                                                 ` Stefan Monnier
2020-01-31 23:18                                           ` Dmitry Gutov
2020-02-01  8:07                                             ` Eli Zaretskii
2020-02-04 23:57                                               ` Dmitry Gutov
2020-02-05 14:20                                                 ` Eli Zaretskii
2020-02-05 14:27                                                   ` João Távora
2020-02-05 17:55                                                     ` Dmitry Gutov
2020-02-05 18:12                                                       ` João Távora
2020-03-04 22:07                                                         ` Dmitry Gutov
2020-03-04 22:44                                                           ` João Távora
2020-03-05  0:01                                                             ` Dmitry Gutov
2020-03-05  8:01                                                               ` João Távora
2020-03-05  8:36                                                                 ` Dmitry Gutov
2020-03-05  8:46                                                                   ` João Távora
2020-03-05  9:59                                                                     ` Dmitry Gutov
2020-03-05 11:51                                                                       ` João Távora
2020-03-05 12:14                                                                         ` Dmitry Gutov
2020-03-05 12:30                                                                           ` João Távora
2020-03-05 13:40                                                                             ` Dmitry Gutov
2020-03-05 13:54                                                                               ` João Távora
2020-03-05 14:03                                                                                 ` Dmitry Gutov
     [not found]                                                                                   ` <CALDnm52HzQym7RosF3AdTNwprqXs7Kk4GBi+3UGjkJt6ZDUJWQ@mail.gmail.com>
2020-03-05 14:17                                                                                     ` Dmitry Gutov
2020-03-05 14:26                                                                                       ` João Távora
2020-03-05 14:40                                                                                         ` João Távora
2020-03-05 14:53                                                                                         ` Dmitry Gutov
2020-03-05 14:58                                                                                           ` João Távora
2020-03-08 16:22                                                                       ` Stefan Monnier
2020-02-05 14:46                                                   ` Stefan Monnier
2020-03-05  0:15                                                   ` Dmitry Gutov
2020-03-05  6:08                                                     ` Eli Zaretskii
2020-03-07 14:10                                                       ` João Távora
2020-03-07 14:46                                                         ` Eli Zaretskii
2020-03-07 16:42                                                           ` João Távora
2020-03-07 16:47                                                             ` Drew Adams
2020-03-07 17:42                                                             ` Eli Zaretskii
2020-03-07 19:28                                                               ` João Távora
2020-03-08 16:28                                                       ` Stefan Monnier
2020-03-08 16:59                                                         ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9da3ee1b-7315-41d2-192b-9db470d50ba4@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=38992@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=waah@yellowfrog.io \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.