[Top][All Lists]

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

Re: Emacs should provide more modern item completion out of the box

From: Juri Linkov
Subject: Re: Emacs should provide more modern item completion out of the box
Date: Tue, 28 Jan 2020 23:54:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)

>> There are several. For M-x, the easiest one to try out is 'M-x 
>> icomplete-mode'.
>> Turn it on and see how you like the new 'M-x' experience.
> I tried it. It has the immediate feedback, but it still requires
> pressing TABs, lacks flex matching and has no recency bias.

Indeed, flex matching should be customized separately for icomplete-mode
(tho fido-mode uses it by default), but actually none of them requires
pressing TABs, and both have recency bias.

> Also, the horizontal format makes it only suitable for selecting from
> short items. When you have long items in your candidate list
> (e.g. different long paths from all over the file sytem) then it
> doesn't work. That's why modern systems use a vertical display,
> or support it also, besides the horizontal format.

Using a vertical display while keeping instant feedback of icomplete-mode
that doesn't require pressing TABs should be easy to do as well:

#+BEGIN_SRC emacs-lisp

(define-minor-mode minibuffer-quick-mode
  "Toggle minibuffer quick completion mode."
  :global t
  :group 'minibuffer
  (if minibuffer-quick-mode
      (add-hook 'minibuffer-setup-hook 'minibuffer-quick-setup)
    (remove-hook 'minibuffer-setup-hook 'minibuffer-quick-setup)))

(defun minibuffer-quick-setup ()
  (add-hook 'post-command-hook #'minibuffer-quick-update nil t))

(defvar minibuffer-quick-min 1
  "Minimal length of minibuffer contents to show completion.")

(defun minibuffer-quick-update ()
  (when (>= (length (minibuffer-contents)) minibuffer-quick-min)
    (let ((completion-styles '(flex))
          (last-command nil))



reply via email to

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