emacs-devel
[Top][All Lists]
Advanced

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

Re: [WIP PATCH] Controlling Isearch from the minibuffer


From: Augusto Stoffel
Subject: Re: [WIP PATCH] Controlling Isearch from the minibuffer
Date: Wed, 12 May 2021 08:40:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

On Tue, 11 May 2021 at 00:17, Juri Linkov <juri@linkov.net> wrote:

>>> You can avoid the timer hack by adding a guard to
>>> isearch-post-command-hook: when at the end of the isearch command,
>>> point is not in the minibuffer, activate the minibuffer
>>> (assuming that isearch-from-minibuffer is t).
>>
>> That didn't work well, because when canceling a command called from the
>> post-command hook one gets an ugly error message.
>
> How do yo cancel such a command?

C-g

>
>> I hope this is a guideline rather than an axiom, so let me describe what
>> the *slight* incompatible changes are:
>>
>> 1. The user is forced to see lazy highlight and lazy count while editing
>>    the search string via M-e, as long as these options are already
>>    enabled globally.
>
> Why not enable these incompatible changes only when
> isearch-from-minibuffer is t?

Without the improvements to the good old M-e, my patch would be totally
independent of the rest of isearch.el, so it could just as well be an
external package.  That's OK too, but why would anyone keep lazy
highlight/count on for normal Isearch, but wish to disable it after
pressing M-e?

To put it from another perspective: you said earlier that my patch could
be boiled down to 10 lines.  Well, adding lazy highlight/count to
`isearch-edit-string' is certainly more work than that.  But once this
is in place, then yes, the minibuffer-controlled mode is a small
addition.

>
>> 2. A M-s prefix is added to minibuffer-local-isearch-map, as well as a
>>    few extra commands (M->, M-<, etc.)
>
> The users might want to use M-< M-> to go to the beginning/end of the
> minibuffer.

This seems way less useful than going to the first/last match in the
search buffer, since in the minibuffer C-a and C-e are usually
sufficient.

By the way, what's the idea behind `minibuffer-beginning-of-buffer'?  It
moves past the prompt, which is a useless point to go.

>
>> 3. <right> and C-f are unbound.
>
> Removing <right> and C-f is a very good thing, indeed.
>
>>> The with-isearch-window-quitting-edit macro can be avoided the same way
>>> as the with-isearch-window macro.
>>
>> I'm not sure this is possible.  Is there a way to get rid of the
>> minibuffer without returning control to the caller of
>> `read-from-minibuffer'?  I couldn't find a way to do this, hence the
>> throw/catch of a continuation function in the current version of the
>> patch.
>
> Why not return control to the caller with `exit-minibuffer'?
> When still necessary, you could try `exit-recursive-edit'.

First of all, let me say that you suggestion to get rid of the
`with-isearch-window' macro works fine.  The remaining problem is with
commands that create a minibuffer, and therefore require that we quit
the `isearch-edit-string' minibuffer first.  One example would be
`isearch-query-replace'.

So here's the the situation in more detail:

- You are in an `isearch-edit-string' session
- Then you press M-%
- Now we are in the pre-command-hook. We check `this-command` and
  see that it will need the minibuffer.

>From there, how can we get rid of the minibuffer and continue running
this-command?  Calling `exit-minibuffer' now would return control to
whoever called `isearch-edit-string', so `this-command' would never run.



reply via email to

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