all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Eshel Yaron <me@eshelyaron.com>
Cc: 70381@debbugs.gnu.org, spacibba@aol.com
Subject: bug#70381: [PATCH] New command 'completion-preview-complete'
Date: Sun, 14 Apr 2024 15:01:35 +0300	[thread overview]
Message-ID: <86plusm9uo.fsf@gnu.org> (raw)
In-Reply-To: <m1ttk4p4tp.fsf@dazzs-mbp.kpn> (bug-gnu-emacs@gnu.org)

> Cc: Ergus <spacibba@aol.com>
> Date: Sun, 14 Apr 2024 13:21:54 +0200
> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Following a recent discussion on emacs-devel[0], this patch adds a new
> command for Completion Preview mode that completes the symbol at point up
> to the longest common prefix of all completion candidates.  This patch
> also adds a visual indication for the longest common prefix when showing
> it as part of the completion preview, so the user can tell how far the new
> 'completion-preview-complete' will complete before invoking this command.
> For example, if the symbol at point is "foo", and the completion
> candidates are "foobar" and "foobaz", then the preview shows "bar" with
> the common prefix "ba" highlighted in face 'completion-preview-common'.

Thanks.

> * lisp/completion-preview.el (completion-preview--try-table):
> Return longest common prefix and list of suffixes instead of
> list of full candidates.  Add illustrative comment.
> (completion-preview--capf-wrapper, completion-preview--update)
> (completion-preview--show, completion-preview-insert)
> (completion-preview-next-candidate): Adjust.
> (completion-preview-common): New face.
> (completion-preview-exact): Distinguish from 'c-p-common'.
> (completion-preview-complete): New command.   ^^^^^^^^^^
> (completion-preview-active-mode-map): Bind it.
> (completion-preview-mode): Mention it in docstring.
> (completion-preview-commands): Add 'c-p-complete'.
                                      ^^^^^^^^^^^^
Please don't abbreviate symbols in the log entries.  Those are
frequently used to search for changes of functions/variables, and such
abbreviations defeat those searches.

If you are annoyed by the need to type long strings, I usually find
M-/ instrumental in reducing that annoyance considerably.

> +(defface completion-preview-common
>    '((((supports :underline t))
>       :underline t :inherit completion-preview)
>      (((supports :weight bold))
>       :weight bold :inherit completion-preview)
>      (t :background "gray"))
> -  "Face for exact completion preview overlay."
> +  "Face for completions longest common prefix in the completion preview."
               ^^^^^^^^^^^
This word is redundant here.  I'd replace it with "the".

> +(defvar-local completion-preview--inhibit-update-p nil
> +  "Whether to inhibit updateing the completion preview following this command.")
                         ^^^^^^^^^
"updating"

> +      (set-text-properties 0 (length suffix)
> +                           `(face ,(if (cdr suffixes)
> +                                       'completion-preview
> +                                     'completion-preview-exact))
> +                           suffix)
> +      (set-text-properties 0 (length common)
> +                           `(face ,(if (cdr suffixes)
> +                                       'completion-preview-common
> +                                     'completion-preview-exact))
> +                           common)

Is the use of back-ticks really necessary here?

> +      (set-text-properties 0 (length suffix)
> +                           `(face ,(if (cdr sufs)
> +                                       'completion-preview
> +                                     'completion-preview-exact))
> +                           suffix)

Likewise here (and in few other places).





  reply	other threads:[~2024-04-14 12:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-14 11:21 bug#70381: [PATCH] New command 'completion-preview-complete' Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-14 12:01 ` Eli Zaretskii [this message]
2024-04-14 14:05   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-18 10:49     ` Eli Zaretskii
2024-04-20 11:36       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=86plusm9uo.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70381@debbugs.gnu.org \
    --cc=me@eshelyaron.com \
    --cc=spacibba@aol.com \
    /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.