[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `isearch-complete1' should use `completion-at-point' or `completion-

From: Juri Linkov
Subject: Re: `isearch-complete1' should use `completion-at-point' or `completion-in-region'
Date: Wed, 15 Jan 2020 01:51:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)

> 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 ()
  (let* ((completion-ignore-case case-fold-search)

(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 via email to

[Prev in Thread] Current Thread [Next in Thread]