[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave
From: |
Eli Zaretskii |
Subject: |
bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer |
Date: |
Sat, 22 Apr 2023 13:48:47 +0300 |
> From: sbaugh@catern.com
> Date: Fri, 21 Apr 2023 18:56:35 +0000 (UTC)
> Cc: Spencer Baugh <sbaugh@janestreet.com>, 62700@debbugs.gnu.org,
> juri@linkov.net
>
> >> Ah, I thought Eli still wanted a backport version because this changes
> >> code which has been on Emacs 29 for over a year.
> >
> > Indeed, that's what I would like to see on the release branch. Mainly
> > because even if this is deemed a bug, it happens in a relatively rare
> > situation, so I'd like to avoid risking breakage in code which affects
> > other situations.
>
> Here's the backport for the release branch.
Thanks, but I'd like to make this still safer for the release branch:
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -4464,13 +4464,21 @@ minibuffer-next-completion
> When `minibuffer-completion-auto-choose' is non-nil, then also
> insert the selected completion to the minibuffer."
> (interactive "p")
> - (let ((auto-choose minibuffer-completion-auto-choose))
> + (let* ((auto-choose minibuffer-completion-auto-choose)
> + ;; Backported fix for bug#62700
> + (md (completion--field-metadata
> (minibuffer--completion-prompt-end)))
> + (base-suffix
> + (if (eq (alist-get 'category (cdr md)) 'file)
> + (buffer-substring (save-excursion (search-forward "/" nil t)
> (point))
> + (point-max))
> + "")))
> (with-minibuffer-completions-window
> (when completions-highlight-face
> (setq-local cursor-face-highlight-nonselected-window t))
> (next-completion (or n 1))
> (when auto-choose
> - (let ((completion-use-base-affixes t))
> + (let ((completion-use-base-affixes t)
> + (completion-base-affixes (list (car completion-base-affixes)
> base-suffix)))
> (choose-completion nil t t))))))
Here, the values used only when minibuffer-completion-auto-choose is
non-nil should be computed only when that variable is non-nil,
preferably inside the '(when auto-choose' clause.
> @@ -4489,9 +4497,17 @@ minibuffer-choose-completion
> If NO-QUIT is non-nil, insert the completion at point to the
> minibuffer, but don't quit the completions window."
> (interactive "P")
> - (with-minibuffer-completions-window
> - (let ((completion-use-base-affixes t))
> - (choose-completion nil no-exit no-quit))))
> + ;; Backported fix for bug#62700
> + (let* ((md (completion--field-metadata
> (minibuffer--completion-prompt-end)))
> + (base-suffix
> + (if (eq (alist-get 'category (cdr md)) 'file)
> + (buffer-substring (save-excursion (search-forward "/" nil t)
> (point))
> + (point-max))
> + "")))
> + (with-minibuffer-completions-window
> + (let ((completion-use-base-affixes t)
> + (completion-base-affixes (list (car completion-base-affixes)
> base-suffix)))
> + (choose-completion nil no-exit no-quit)))))
And here we seem to be modifying code that is not only for when
minibuffer-completion-auto-choose is non-nil, or what am I missing?
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, (continued)
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Juri Linkov, 2023/04/08
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Spencer Baugh, 2023/04/10
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Juri Linkov, 2023/04/10
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Spencer Baugh, 2023/04/20
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Juri Linkov, 2023/04/20
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Spencer Baugh, 2023/04/20
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Eli Zaretskii, 2023/04/20
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, sbaugh, 2023/04/21
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer,
Eli Zaretskii <=
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, sbaugh, 2023/04/22
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Eli Zaretskii, 2023/04/22
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, sbaugh, 2023/04/22
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Eli Zaretskii, 2023/04/23
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, sbaugh, 2023/04/23
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Eli Zaretskii, 2023/04/24
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer, Eli Zaretskii, 2023/04/20