all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Daniel Mendler <mail@daniel-mendler.de>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: [PATCH] `affixation-function`: Allow only three-element lists
Date: Sun, 25 Apr 2021 20:46:08 +0300	[thread overview]
Message-ID: <87h7jujmbn.fsf@mail.linkov.net> (raw)
In-Reply-To: <e79d94cd-7829-0ac5-b86e-9314a21f3e39@daniel-mendler.de> (Daniel Mendler's message of "Sun, 25 Apr 2021 02:39:53 +0200")

> @@ -2110,7 +2110,9 @@ minibuffer-completion-help
>                        (cond
>                         (aff-fun
>                          (setq completions
> -                              (funcall aff-fun completions)))
> +                              (funcall aff-fun completions))
> +                        (cl-assert (or (not completions)
> +                                       (= 3 (length (car completions))))))

It's surprising to see that you added such artificial restriction.
I expected a change with something more like this:

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index e435d0124a..324a171e66 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2129,7 +2129,7 @@ minibuffer-completion-help
                         (setq completions
                               (mapcar (lambda (s)
                                         (let ((ann (funcall ann-fun s)))
-                                          (if ann (list s ann) s)))
+                                          (if ann (list s "" ann) s)))
                                       completions))))

and then simplify the implementation of completion--insert-strings
by removing all complexity that handled suffix-only completion strings.

> diff --git a/lisp/simple.el b/lisp/simple.el
> index 999755a642..26eb8cad7f 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -2080,8 +2080,11 @@ read-extended-command--affixation
>                              (obsolete
>                               (format " (%s)" (car obsolete)))
>                              ((and binding (not (stringp binding)))
> -                             (format " (%s)" (key-description binding))))))
> -         (if suffix (list command-name suffix) command-name)))
> +                             (format " (%s)" (key-description binding)))
> +                            (t ""))))
> +         (put-text-property 0 (length suffix)
> +                            'face 'completions-annotations suffix)
> +         (list command-name "" suffix)))
>       command-names)))

Why such change only for one particular use of annotations?
Shouldn't completion--insert-strings check if the suffix is an
empty string, and then put the 'completions-annotations' face on it?



  reply	other threads:[~2021-04-25 17:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25  0:39 [PATCH] `affixation-function`: Allow only three-element lists Daniel Mendler
2021-04-25 17:46 ` Juri Linkov [this message]
2021-04-25 18:02   ` Daniel Mendler
2021-04-25 20:34     ` Juri Linkov
2021-04-25 21:04       ` Daniel Mendler
2021-04-27 16:45         ` Juri Linkov
2021-04-27 17:40           ` Daniel Mendler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7jujmbn.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.org \
    --cc=mail@daniel-mendler.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.