]> git.eshelyaron.com Git - emacs.git/commit
Minor improvements to new Completion Preview commands
authorEshel Yaron <me@eshelyaron.com>
Wed, 26 Jun 2024 09:06:52 +0000 (11:06 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 26 Jun 2024 13:36:44 +0000 (15:36 +0200)
commitf48c4d2a31ad43b049c0a657a1ed3a324b2a7ced
tree97a872c27fbf716518222e0d2e3166bda27c19b0
parent7b820e2c28fd77a8ad43e5e9345ab2d0c543da4c
Minor improvements to new Completion Preview commands

* lisp/completion-preview.el (Commentary): Mention
`completion-preview-partial-insert' and elaborate about
`completion-preview-insert-sexp'.
(completion-preview--barf-if-no-preview): New function.
(completion-preview-insert, completion-preview-complete):
Use it.
(completion-preview-partial-insert): Rename arg to FUN; only
compute (+ end (length aft)) once; bind 'deactivate-mark' to
nil while inserting/deleting to allow commands that use this
function to work as expected with 'shift-select-mode';
improve behavior when called with point not at the start of
the completion preview overlay (e.g. when point is in the
middle of a multi-word symbol and this function is called
via 'completion-preview-insert-word'); add the base part of
the completion candidate to when calling exit-function.
(completion-preview-insert-word): Improve docsting, rename
argument ARG to N.
(completion-preview-insert-sexp): Likewise, and also remove
second argument INTERACTIVE.
(completion-preview--active-p): Rename to...
(completion-preview-active-p): ...this.  Make this function
public so users can leverage it for their own commands.
Extend docstring to explain how to do that.

* test/lisp/completion-preview-tests.el
(completion-preview-insert-calls-exit-function)
(completion-preview-insert-word): Break long lines.
(completion-preview-insert-sexp)
(completion-preview-insert-nonsubword)
(completion-preview-insert-subword): Fix docstrings.
(completion-preview-insert-mid-symbol): New test.

(cherry picked from commit 9cb2a2040888c28587bed2b0902d9da90720f9a0)
lisp/completion-preview.el
test/lisp/completion-preview-tests.el