emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] `completing-read`: Add `group-function` support to completio


From: Protesilaos Stavrou
Subject: Re: [PATCH] `completing-read`: Add `group-function` support to completion metadata
Date: Mon, 26 Apr 2021 07:51:21 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On 2021-04-26, 00:58 +0200, Daniel Mendler <mail@daniel-mendler.de> wrote:

> Note that there are also users who implemented small extensions for the
> default completion UI, e.g., such that the *Completions* buffers appears
> after a delay and a few characters of input. I believe Protesilaos
> Stavrou is doing that. For such UIs the *Completions* buffer is as fully
> capable as one of the aforementioned vertical minibuffer UIs.

Hello!  Just to comment on this point: yes, I am using the standard
Completions' buffer and the default minibuffer in a way that looks like
other vertical completion UIs.  I do it mostly as an exercise in Elisp,
so the code itself is not really worthy of consideration here, plus I
still need to make it a minor mode that could be reproduced elsewhere.

In outline:

+ The Completions' buffer is (setq completions-format 'one-column).

+ The display-buffer-alist controls the placement of the Completions'
  buffer so that (i) it appears in a bottom side window, and (ii) it
  hides its mode line.  This makes the minibuffer and the Completions
  look like parts of the same contiguous space.

+ There are commands for moving up and down which cycle from the
  minibuffer to the Completions' one.  Because those two look like they
  are part of the same area, the cycling feels natural: just go up/down.

+ There is a live-updating snippet that pops-up the Completions' buffer
  automatically and then updates it to match user input.  There also are
  minimum character and delay thresholds, a blocklist and a passlist for
  commands that should not or should always live update.  Those are all
  configurable.

+ The Completions' buffer normally has some helper text at the top.  It
  is removed to keep only completion candidates.

+ The hl-line-mode provides the familiar "current line here" which helps
  with cycling.  Its face is remapped for the Completions' buffer so
  that it is better suited for this particular task.

+ Same principle for display-line-numbers-mode.

+ Another command lets you pass a prefix argument to pick the Nth
  candidate in the Completions' buffer.  The implementation is not
  great, but the idea works.  It can be called from either the
  minibuffer or the Completions.

+ While in the Completions' buffer and while using a prompt of
  completing-read-multiple, another command can be used to append the
  candidate at point to the minibuffer, insert the crm-separator, and go
  back to the Completions' buffer.

The overall experience is good to the point where I do not miss other
interactive UIs.  And I feel that it could be improved further though I
am not there yet skills-wise.

I also use other packages, like Orderless[1] and Marginalia[2].

[1]: <https://github.com/oantolin/orderless>.
[2]: <https://github.com/minad/marginalia>.

I attach a screenshot, though I understand this does not say that much.

-- 
Protesilaos Stavrou
https://protesilaos.com

Attachment: Screenshot from 2021-04-26 07-49-55.png
Description: PNG image


reply via email to

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