GNU bug report logs -
#71927
29.4; ibuffer-do-isearch and ibuffer-do-isearch-regexp not prompting for input
Previous Next
Reported by: Charles Choi <kickingvegas <at> gmail.com>
Date: Wed, 3 Jul 2024 21:26:01 UTC
Severity: normal
Found in version 29.4
Fixed in version 30.1
Done: Eshel Yaron <me <at> eshelyaron.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Stephen Berman <stephen.berman <at> gmx.net>
>>
>> On Thu, 04 Jul 2024 21:07:36 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:
>>
>> >> From: Stephen Berman <stephen.berman <at> gmx.net>
>> >> Cc: Eli Zaretskii <eliz <at> gnu.org>, Eshel Yaron <me <at> eshelyaron.com>,
>> >> kickingvegas <at> gmail.com, 71927 <at> debbugs.gnu.org, basil <at> contovou.net,
>> >> jpw <at> gnu.org
>> >> Date: Thu, 04 Jul 2024 19:36:34 +0200
>> >>
>> >> On Thu, 04 Jul 2024 19:04:42 +0300 Juri Linkov <juri <at> linkov.net> wrote:
>> >>
>> >> >>>> FWIW, AFAICT everything is working correctly, it's just that the
>> >> >>>> "Operation finished" message hides the prompt. ibuffer-do-isearch
>> >> >>>> should tell define-ibuffer-op not to display that message, somehow.
>> >> >>>
>> >> >>> I don't see how this could be considered "correct": the "Operation
>> >> >>> finished" message is supposed to be shown only after the Isearch is
>> >> >>> finished in all the marked buffer, not before. It looks like we need
>> >> >>> a function that will not return until all the buffers where searched,
>> >> >>> because that's what define-ibuffer-op expects. Don't you agree?
>> >> >
>> >> > It intentionally uses 'no-recursive-edit' set to t, so ibuffer-do-isearch
>> >> > correctly exits immediately while leaving isearch-mode enabled.
>> >> >
>> >> >> The attached patch appears to DTRT, but I only tested it briefly.
>> >> >> ...
>> >> >> (define-ibuffer-op ibuffer-do-isearch ()
>> >> >> "Perform a `isearch-forward' in marked buffers."
>> >> >> (:interactive ()
>> >> >> - :opstring "searched in"
>> >> >> + :no-opstring t
>> >> >
>> >> > Thanks for the patch. I confirm this is the right thing to do.
>> >> > Maybe instead of :no-opstring would be better to use some special value
>> >> > like :opstring 'no? But I'm not sure if this is better than :no-opstring.
>> >>
>> >> Suppressing the message when :opstring has the value 'no is fine with
>> >> me. If Eli is willing to accept this approach, I can go ahead and
>> >> commit it (to master, presumably, since this is a longstanding issue).
>> >
>> > I already said this didn't sound the right solution here, and I
>> > explained why. I'd be interested in hearing counter-arguments, if
>> > there are any.
>>
>> I gave a mild counterargument upthread, that making
>> ibuffer-do-isearch{-regexp} defuns independent of define-ibuffer-op
>> seems like accepting the inadequacy of the latter instead of trying to
>> improve it.
>
> It is indeed inadequate for commands that just put Emacs in a special
> state and return, as opposed to commands that don't return before they
> did the complete job of operating on the marked buffers.
Actually, there's another problem with the way ibuffer-do-isearch is
currently defined via define-ibuffer-op: the BODY of the definition is a
call to multi-isearch-buffers, but the BODY is called for each marked
buffer, not once for all of them, so this command currently calls
multi-isearch-buffers repeatedly when there are multiple marked buffers.
This causes multi-isearch-setup to be called while multi-buffer Isearch
is already in progress, which unfortunately breaks regular Isearch for
the rest of the session.
To see this effect, invoke ibuffer-do-isearch with two or more marked
buffers, quit or finish the search (e.g. type C-g), and then try regular
Isearch with C-s and repeat C-s until wrapping around. But instead of
wrapping around as expected, Emacs displays an error:
Symbol’s function definition is void: nil
A simple solution is to use plain defun for these commands, as follows:
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 95ff014aa5b..33b68b96ff2 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -594,22 +594,16 @@ revert
:modifier-p :maybe)
(revert-buffer t t))
-;;;###autoload (autoload 'ibuffer-do-isearch "ibuf-ext")
-(define-ibuffer-op ibuffer-do-isearch ()
+;;;###autoload
+(defun ibuffer-do-isearch ()
"Perform a `isearch-forward' in marked buffers."
- (:interactive ()
- :opstring "searched in"
- :complex t
- :modifier-p :maybe)
+ (interactive "" ibuffer-mode)
(multi-isearch-buffers (ibuffer-get-marked-buffers)))
-;;;###autoload (autoload 'ibuffer-do-isearch-regexp "ibuf-ext")
-(define-ibuffer-op ibuffer-do-isearch-regexp ()
+;;;###autoload
+(defun ibuffer-do-isearch-regexp ()
"Perform a `isearch-forward-regexp' in marked buffers."
- (:interactive ()
- :opstring "searched regexp in"
- :complex t
- :modifier-p :maybe)
+ (interactive "" ibuffer-mode)
(multi-isearch-buffers-regexp (ibuffer-get-marked-buffers)))
;;;###autoload (autoload 'ibuffer-do-replace-regexp "ibuf-ext")
This bug report was last modified 1 year and 4 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.