all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
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 01:51:54 +0200	[thread overview]
Message-ID: <87pnfl1wj9.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwvpnfnw3x3.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 13 Jan 2020 14:38:12 -0500")

> First, there are 2 different cases: `isearch-complete-edit` and `isearch-complete`.
>
> For `isearch-complete-edit` we could indeed use `completing-read`, but
> I don't think I like this idea (e.g. I think it'd be odd for Icomplete
> to kick in when in `isearch-edit`).

But the original request was just about allowing completion packages
to kick in when in `isearch-edit`, and Icomplete is one kind of such packages.

> So I think the better solution is to set `completion-at-point-functions`
> and then turn `isearch-complete-edit` into an alias for `completion-at-point`.

Maybe something like this:

(defun isearch-completion-at-point-function ()
  (list (minibuffer-prompt-end) (point-max)
        (if isearch-regexp regexp-search-ring search-ring)))

(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)))

(define-key minibuffer-local-isearch-map "\M-\t" 'isearch-completion-at-point)

But I'm not sure whether this could help completion packages like swiper
to hook into isearch completion.

> 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.



  reply	other threads:[~2020-01-14 23:51 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 [this message]
2020-01-15 13:57       ` Stefan Monnier
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=87pnfl1wj9.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.org \
    --cc=emacs@Alexander.Shukaev.name \
    --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.