emacs-devel
[Top][All Lists]
Advanced

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

Re: Simple isearch concerns


From: Juri Linkov
Subject: Re: Simple isearch concerns
Date: Sun, 25 Apr 2021 20:24:50 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> Nice idea.  Like TAB typed in the minibuffer updates the Completions buffer,
>> C-s typed in the isearch-edit-string minibuffer could update the matches
>> in the searched buffer.
>
> Do you think this feature could make it into isearch.el, or would make
> more sense as an external package?  You can take a look at the git repo
> linked in my previous message to get a sense of how the implementation
> would look like.

If its implementation becomes more hackish, then it would make
more sense as an external package.  Otherwise, if we can find
an elegant way to naturally integrate it with isearch.el,
then this feature could make it into isearch.el.

As the first step in this direction, we could try to get rid of the
macro ‘with-isearch-suspended’.  It was a hackish solution to
temporarily exit isearch before reading a string from the minibuffer.

To be able to do the same in a nicer way, we need to turn isearch-mode
into buffer-local.  Its current global status caused too much trouble
in the past.  For example, see our recent attempt to forcefully terminate
isearch when it switched to another buffer.  With buffer-local isearch-mode,
there will be no need to exit isearch before switching to another buffer.
You could even have simultaneously active isearch modes in different buffers,
and freely switch to the minibuffer without exiting buffer-local isearch.

Is such thing achievable?  There is no problem to make hooks used by isearch
buffer-local by adding the arg LOCAL to add-hook:

  (add-hook 'pre-command-hook 'isearch-pre-command-hook nil t)
  (add-hook 'post-command-hook 'isearch-post-command-hook nil t)
  (add-hook 'mouse-leave-buffer-hook 'isearch-mouse-leave-buffer nil t)
  (add-hook 'kbd-macro-termination-hook 'isearch-done nil t)

But trying to make buffer-local overriding-terminal-local-map with:

  (setq-local overriding-terminal-local-map isearch-mode-map)

fails with an error:

  Debugger entered--Lisp error: (error "Symbol overriding-terminal-local-map 
may not be buffer-local")
    make-local-variable(overriding-terminal-local-map)
    (set (make-local-variable 'overriding-terminal-local-map) isearch-mode-map)
    isearch-mode(t nil nil nil)
    isearch-forward(nil 1)

> In isearch.el itself, one would have to introduce a new macro
> `(with-current-search-buffer ...)' and wrap the body of every relevant
> interactive command in it (similar to the `isearch-mb--with-buffer'
> advice in my package sketch).  Then there's also the case of commands
> start or end a search, which need special treatment.

This is similar to what currently does isearch-yank-char-in-minibuffer.
It would be nice to replace it with a new macro that will
redirect all normal isearch commands to the original buffer.



reply via email to

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