[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 bd07cec8442: Fix regression in Fido mode (bug#62015)
From: |
João Távora |
Subject: |
emacs-29 bd07cec8442: Fix regression in Fido mode (bug#62015) |
Date: |
Mon, 6 Mar 2023 18:05:24 -0500 (EST) |
branch: emacs-29
commit bd07cec844257ba8ae95b2ab2e66982360576c9d
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Fix regression in Fido mode (bug#62015)
To understand the regression consider this recipe where the 'fo'
pattern is typed by the user in the last step.
emacs -Q
C-x b foo RET
C-x b afoo RET
C-x b *scratch* RET
M-x fido-mode RET
C-x b fo
This used to offer both 'foo' and 'afoo' as candidates but now only
offered 'foo'. This is because the pattern 'fo' matches 'foo', but
not 'afoo' with 'basic' completion style.
Fido mode, however, prioritizes 'flex' completion style, and that is
not happening here as it used to.
This was introduced in this commit
commit bf81df86e52fdc995bec8d9646f84d114cb896d1
Author: João Távora <joaotavora@gmail.com>
Date: Wed Dec 7 10:43:59 2022 +0000
Don't override completion-category-defaults in fido-mode
I took away the nil setting of 'completion-category-defaults; in Fido
mode's minibuffer. It seemed generally the correct thing to do, and
was done mainly because Eglot added its style preferences to that
variable instead of completion-category-overrides directly, which is a
nono. So, to be able use the Fido UI with Eglot successfully,
'completion-category-defaults' should stay untouched. Or so I
thought.
However, I failed to notice that, for most categories, the default
value of 'completion-category-defaults' prioritizes the 'basic'
completion style.
For example, in the 'buffer' category, the default value has the
styles list '(basic substring)'. This means that if a pattern matches
accoring to the 'basic' style, 'substring' will not be tried. And
neither will 'completion-styles' which in Fido mode's case happens to
be 'flex'.
The solution in this commit is to craft a value for completion
category defaults that is just like the default one, but prioritizes
'flex' completion for every category.
* lisp/icomplete.el (icomplete--fido-ccd): New helper.
(icomplete--fido-mode-setup): Use it.
---
lisp/icomplete.el | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 0adb0e5afeb..f46127a20e0 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -419,6 +419,16 @@ if that doesn't produce a completion match."
"C-." #'icomplete-forward-completions
"C-," #'icomplete-backward-completions)
+(defun icomplete--fido-ccd ()
+ "Make value for `completion-category-defaults' prioritizing `flex'."
+ (cl-loop
+ for (cat . alist) in completion-category-defaults collect
+ `(,cat . ,(cl-loop
+ for entry in alist for (prop . val) = entry
+ if (eq prop 'styles)
+ collect `(,prop . (flex ,@(delq 'flex val)))
+ else collect entry))))
+
(defun icomplete--fido-mode-setup ()
"Setup `fido-mode''s minibuffer."
(when (and icomplete-mode (icomplete-simple-completing-p))
@@ -430,6 +440,7 @@ if that doesn't produce a completion match."
icomplete-scroll (not (null icomplete-vertical-mode))
completion-styles '(flex)
completion-flex-nospace nil
+ completion-category-defaults (icomplete--fido-ccd)
completion-ignore-case t
read-buffer-completion-ignore-case t
read-file-name-completion-ignore-case t)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 bd07cec8442: Fix regression in Fido mode (bug#62015),
João Távora <=