[Top][All Lists]

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

Re: Simple isearch concerns

From: Zhiwei Chen
Subject: Re: Simple isearch concerns
Date: Sun, 25 Apr 2021 08:16:40 +0000

On Apr 22, 2021, at 1:51 AM, Juri Linkov <juri@linkov.net> wrote:

Actually this feature can cause inconvenience in some cases.

`isearch-occur’ (bound to `M-s o’ in 'isearch-mode-map`) when `isearch’,
even a buffer is created, `isearch’  doesn’t exit though.

In vanilla Emacs, the cursor is in the original buffer. But if you use
shackle or customize `display-buffer-alist’ directly, the cursor
can be refocused to the new created one. Typing in the *Occur* buffer
triggers `isearch-printing-char’ which is counterintuitive.

As discussed in bug#47894, the right solution for you would be to use
such customization that helps isearch-occur to exit isearch explicitly:

#+begin_src emacs-lisp
(advice-add 'isearch-occur :after
           (lambda (&rest _args)
             (isearch-done nil t)

tags 47894 fixed
close 47894 28.0.50

>> Isearch help commands solve the second problem by simply using
>> isearch--display-help-action that inhibits displaying other buffers
>> in the same window.
>> Instead of let-binding display-buffer-overriding-action
>> in all isearch help commands, we could set it temporarily
>> like we already temporarily set overriding-terminal-local-map:

> Actually, I withdraw my patches.  Better not to make any assumptions
> about possible ways how isearch is used because of existence of
> such complex cases like with input methods in this bug report
> (fixed and closed).

> By default, most commands that want to display a buffer
> in another window, exit isearch automatically,
> so there is no problem.  Only isearch help commands
> and isearch-occur don't exit isearch before displaying
> another buffer, thus they need to be treated individually.
isearch-occur is such a special command. Even there is no customization for
`display-buffer-alist', user feels that point is in the original buffer, but
typing "n" changes isearch string rather than insert in the original buffer.
Currently only those commands prefixed with C- and M- will cancel isearch. So I propose to
make `isearch-occur' cancel (exit?) isearch too.

Zhiwei Chen

reply via email to

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