unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Daniel Mendler <mail@daniel-mendler.de>
Cc: 74408@debbugs.gnu.org
Subject: bug#74408: 30.0.92; FR: Add a function completion-list-candidate-at-point
Date: Mon, 18 Nov 2024 18:25:31 -0500	[thread overview]
Message-ID: <jwva5dwku3t.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87v7wle77p.fsf@daniel-mendler.de> (Daniel Mendler's message of "Mon, 18 Nov 2024 01:06:18 +0100")

> Thanks. Patch attached.

Thanks, Daniel.  Minor comments below.

> @@ -2628,8 +2628,10 @@ minibuffer-completion-help
>                (when-let* ((buffer (get-buffer "*Completions*"))
>                            (window (get-buffer-window buffer 0)))
>                  (with-current-buffer buffer
> -                  (when-let* ((beg (completions--start-of-candidate-at (window-point window))))
> -                    (cons (get-text-property beg 'completion--string) (- (point) beg))))))
> +                  (when-let* ((cand (save-excursion
> +                                     (goto-char (window-point window))
> +                                     (completion-list-candidate-at-point))))
> +                    (cons (car cand) (- (point) (cadr cand)))))))
>               ;; If the *Completions* buffer is shown in a new
>               ;; window, mark it as softly-dedicated, so bury-buffer in
>               ;; minibuffer-hide-completions will know whether to

AFAICT, it's easy to make `completion-list-candidate-at-point` accept an
optional position argument (which would default to point), which would
be helpful in the two places where we use that function.
WDYT?

> +(defun completion-list-candidate-at-point ()
> +  "Return candidate string at point and bounds in completions buffer."

I suggest you use something like "(STRING BEG END)" to describe the format.


        Stefan






  reply	other threads:[~2024-11-18 23:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-17 21:10 bug#74408: 30.0.92; FR: Add a function completion-list-candidate-at-point Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-17 21:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-18  0:06   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-18 23:25     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-11-18 23:36       ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-19  2:59         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-19 10:03           ` Daniel Mendler 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwva5dwku3t.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=74408@debbugs.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).