Closed CGenie closed 3 years ago
This cannot be fixed by hotfuzz
, I am afraid. Presuming you would have the same problem with the flex
completion style, the issue lies in the flex
sorting hack, which hotfuzz
piggybacks on.
Completion UIs such as Vertico sort based on MRU only when the collection does not specify a display-sort-function
metadata entry. However flex
must always adjust the sort function metadata, even though flex
sorting only makes sense when the search string is nonempty.
I guess completion UIs could compare display-sort-function
before and after completion-all-completions
to know if the sort function stemmed only from the completion style and in that case ignore it initially. Otherwise, I think this is something @minad's deferred-highlighting branch would fix.
hotfuzz-selectrum-mode
does not have this problem.
Vertico has very flexible sorting, see the vertico-sort-function variable. By advising the function vertico--sort-function you can also remix the completion style sorting with the mru sorting and other sorting functions.
It seems that flex
now allows to get most recent entries. Would it be possible to add a similar hack to hotfuzz
?
(defvar +hotfuzz--is-empty nil)
(defun +hotfuzz-all-completions--enable-history-a (orig content &rest args)
"Set a variable needed for showing most recent entries."
(setq +hotfuzz--is-empty (string-empty-p content))
(apply orig content args))
(advice-add #'hotfuzz-all-completions
:around #'+hotfuzz-all-completions--enable-history-a)
(defun +hotfuzz--adjust-metadata--enable-history-a (orig metadata)
"Enable showing most recent entries for empty input."
(if +hotfuzz--is-empty
metadata
(funcall orig metadata)))
(advice-add #'hotfuzz--adjust-metadata
:around #'+hotfuzz--adjust-metadata--enable-history-a)
This workaround allows to get the most recently called commands.
Hello, When using
orderless
(or in fact any other completion style I know of), when typing, sayM-x
, I get the most recently called commands first. This is not the case withhotfuzz
however. This is a major usability issue for me. Best and thank you for this code.