From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juri Linkov <juri@linkov.net>
Cc: Alexander Shukaev <emacs@Alexander.Shukaev.name>, emacs-devel@gnu.org
Subject: Re: `isearch-complete1' should use `completion-at-point' or `completion-in-region'
Date: Wed, 15 Jan 2020 08:57:54 -0500 [thread overview]
Message-ID: <jwv36cgsuiu.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87pnfl1wj9.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 15 Jan 2020 01:51:54 +0200")
> Maybe something like this:
>
> (defun isearch-completion-at-point-function ()
> (list (minibuffer-prompt-end) (point-max)
> (if isearch-regexp regexp-search-ring search-ring)))
Looks fine, yes.
> (defun isearch-completion-at-point ()
> (interactive)
> (let* ((completion-ignore-case case-fold-search)
> (completion-at-point-functions '(isearch-completion-at-point-function)))
> (completion-at-point)))
Ah, no I was thinking rather of something like
(minibuffer-with-setup-hook
(lambda ()
(setq-local completion-ignore-case case-fold-search)
(add-hook 'completion-at-point-functions
#'isearch-completion-at-point-function nil t))
...)
This way, things like `company-mode` can use it (tho IIUC company-mode
currently doesn't work in the minibuffer) and `isearch-complete-edit`
can be an obsolete alias of `completion-at-point`.
>> For `isearch-complete`, it's a bit more tricky because it's a form of
>> completion that is performed on a text that's kept inside a string
>> rather than inside a buffer, so I think we'll still need some ad-hoc
>> code, but it could better use our completion framework.
> `isearch-complete` already activates the minibuffer conditionally
> when there are completions. It could activate the minibuffer always,
> then immediately exit the minibuffer when completion-at-point
> finds no completions.
Yes. What I meant is that `isearch-complete` can't be turned into
a mere obsolete alias of `completion-at-point`.
FWIW, I think it might be worthwhile trying to rewrite isearch such that
it always uses the minibuffer (instead of using a transient keymap and
displaying the search string in the echo area).
Then `isearch-edit` would simply change the minibuffer's keymap such
that we only exit the minibuffer in the "usual" way.
In such a setting `isearch-complete` could be a simple alias of
`completion-at-point`.
Stefan
next prev parent reply other threads:[~2020-01-15 13:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-07 16:19 bug#39015: `isearch-complete1' should use `completion-at-point' or `completion-in-region' Alexander Shukaev
2020-01-12 23:36 ` `isearch-complete1' should use `completion-at-point' or `completion-in-region' (was: bug#39015) Juri Linkov
2020-01-13 14:35 ` `isearch-complete1' should use `completion-at-point' or `completion-in-region' Alexander Shukaev
2020-01-13 19:38 ` Stefan Monnier
2020-01-14 23:51 ` Juri Linkov
2020-01-15 13:57 ` Stefan Monnier [this message]
2020-01-15 23:24 ` Juri Linkov
2020-01-20 0:27 ` bug#39015: " Juri Linkov
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=jwv36cgsuiu.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=emacs@Alexander.Shukaev.name \
--cc=juri@linkov.net \
/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.