GNU bug report logs - #43966
Isearch, C-g and f10 interact to leave Isearch in an inconsistent state.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Mon, 12 Oct 2020 17:08:02 UTC

Severity: normal

Tags: fixed

Fixed in version 28.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43966 in the body.
You can then email your comments to 43966 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#43966; Package emacs. (Mon, 12 Oct 2020 17:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 12 Oct 2020 17:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Isearch, C-g and f10 interact to leave Isearch in an inconsistent
 state.
Date: Mon, 12 Oct 2020 17:07:09 +0000
Hello, Emacs.

In the emacs-27 branch, in X Windows, from a terminal:

(i) emacs -Q -nw.
(ii) M-x menu-bar-mode (to turn it off).
(iii) Visit a file.
(iv) C-s <some characters>.
(v) f10 to open the menu.

(vi) C-x o once or twice to move to the menu window.
(vii) C-g.  (This leaves the menu window in place).
(viii) C-x o to move to the minibuffer.
(ix) C-g.  (This deletes the menu window).

There is now one window open, that displaying the file buffer.
According to the mode line, Isearch is still active, and indeed further
characters can be typed onto the search string.

However, point can be freely moved by, e.g., C-f or C-b., without
terminating the Isearch.  This is a bug.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43966; Package emacs. (Mon, 12 Oct 2020 19:53:02 GMT) Full text and rfc822 format available.

Message #8 received at 43966 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 43966 <at> debbugs.gnu.org
Subject: Re: bug#43966: Isearch, C-g and f10 interact to leave Isearch in an
 inconsistent state.
Date: Mon, 12 Oct 2020 22:36:41 +0300
> (i) emacs -Q -nw.
> (ii) M-x menu-bar-mode (to turn it off).
> (iii) Visit a file.
> (iv) C-s <some characters>.
> (v) f10 to open the menu.
>
> (vi) C-x o once or twice to move to the menu window.
> (vii) C-g.  (This leaves the menu window in place).
> (viii) C-x o to move to the minibuffer.
> (ix) C-g.  (This deletes the menu window).
>
> There is now one window open, that displaying the file buffer.
> According to the mode line, Isearch is still active, and indeed further
> characters can be typed onto the search string.
>
> However, point can be freely moved by, e.g., C-f or C-b., without
> terminating the Isearch.  This is a bug.

This is because 'isearch-menu-bar-commands' contains 'menu-bar-open'
added in bug#32990 to allow invocation of isearch commands from menu.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43966; Package emacs. (Wed, 27 Jan 2021 04:41:02 GMT) Full text and rfc822 format available.

Message #11 received at 43966 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Alan Mackenzie <acm <at> muc.de>, 43966 <at> debbugs.gnu.org
Subject: Re: bug#43966: Isearch, C-g and f10 interact to leave Isearch in an
 inconsistent state.
Date: Wed, 27 Jan 2021 05:40:31 +0100
Juri Linkov <juri <at> linkov.net> writes:

>> However, point can be freely moved by, e.g., C-f or C-b., without
>> terminating the Isearch.  This is a bug.
>
> This is because 'isearch-menu-bar-commands' contains 'menu-bar-open'
> added in bug#32990 to allow invocation of isearch commands from menu.

bug#32990 was a very long thread, so I didn't read that -- but does this
mean that the reported behaviour isn't a bug?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43966; Package emacs. (Wed, 27 Jan 2021 09:38:01 GMT) Full text and rfc822 format available.

Message #14 received at 43966 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Alan Mackenzie <acm <at> muc.de>, 43966 <at> debbugs.gnu.org
Subject: Re: bug#43966: Isearch, C-g and f10 interact to leave Isearch in an
 inconsistent state.
Date: Wed, 27 Jan 2021 11:27:14 +0200
[Message part 1 (text/plain, inline)]
>>> However, point can be freely moved by, e.g., C-f or C-b., without
>>> terminating the Isearch.  This is a bug.
>>
>> This is because 'isearch-menu-bar-commands' contains 'menu-bar-open'
>> added in bug#32990 to allow invocation of isearch commands from menu.
>
> bug#32990 was a very long thread, so I didn't read that -- but does this
> mean that the reported behaviour isn't a bug?

It's still a bug.  The problem is that when the menu-bar is disabled,
menu-bar-open calls tmm-menubar directly, but in isearch-mode
isearch-tmm-menubar should be used instead.  isearch-mode-map remaps
tmm-menubar to isearch-tmm-menubar, but this doesn't help
in case of menu-bar-open calling tmm-menubar directly.

I see no way to fix this other than handling isearch-mode in tmm-menubar:

[isearch-tmm-menubar.patch (text/x-diff, inline)]
diff --git a/lisp/isearch.el b/lisp/isearch.el
index a86678572c..a1e3fe2c3f 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -513,7 +513,7 @@ isearch-tmm-menubar
     (call-interactively command)))
 
 (defvar isearch-menu-bar-commands
-  '(isearch-tmm-menubar menu-bar-open mouse-minor-mode-menu)
+  '(isearch-tmm-menubar tmm-menubar menu-bar-open mouse-minor-mode-menu)
   "List of commands that can open a menu during Isearch.")
 
 (defvar isearch-menu-bar-yank-map
@@ -787,7 +787,6 @@ isearch-mode-map
 
     (define-key map [menu-bar search-menu]
       (list 'menu-item "Isearch" isearch-menu-bar-map))
-    (define-key map [remap tmm-menubar] 'isearch-tmm-menubar)
 
     map)
   "Keymap for `isearch-mode'.")
diff --git a/lisp/tmm.el b/lisp/tmm.el
index e49246a5c4..2040f52270 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -56,12 +56,14 @@ tmm-menubar
 `tty-menu-open-use-tmm' to a non-nil value."
   (interactive)
   (run-hooks 'menu-bar-update-hook)
-  (let ((menu-bar (menu-bar-keymap))
-        (menu-bar-item-cons (and x-position
-                                 (menu-bar-item-at-x x-position))))
-    (tmm-prompt menu-bar
-                nil
-                (and menu-bar-item-cons (car menu-bar-item-cons)))))
+  (if isearch-mode
+      (isearch-tmm-menubar)
+    (let ((menu-bar (menu-bar-keymap))
+          (menu-bar-item-cons (and x-position
+                                   (menu-bar-item-at-x x-position))))
+      (tmm-prompt menu-bar
+                  nil
+                  (and menu-bar-item-cons (car menu-bar-item-cons))))))
 
 ;;;###autoload
 (defun tmm-menubar-mouse (event)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43966; Package emacs. (Thu, 28 Jan 2021 03:04:02 GMT) Full text and rfc822 format available.

Message #17 received at 43966 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: Alan Mackenzie <acm <at> muc.de>, 43966 <at> debbugs.gnu.org
Subject: Re: bug#43966: Isearch, C-g and f10 interact to leave Isearch in an
 inconsistent state.
Date: Thu, 28 Jan 2021 04:03:29 +0100
Juri Linkov <juri <at> linkov.net> writes:

> It's still a bug.  The problem is that when the menu-bar is disabled,
> menu-bar-open calls tmm-menubar directly, but in isearch-mode
> isearch-tmm-menubar should be used instead.  isearch-mode-map remaps
> tmm-menubar to isearch-tmm-menubar, but this doesn't help
> in case of menu-bar-open calling tmm-menubar directly.

Ah, I see.

> I see no way to fix this other than handling isearch-mode in tmm-menubar:

It does seem a bit hackish, but I guess there's no other real
alternative...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43966; Package emacs. (Thu, 28 Jan 2021 19:31:01 GMT) Full text and rfc822 format available.

Message #20 received at 43966 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Alan Mackenzie <acm <at> muc.de>, 43966 <at> debbugs.gnu.org
Subject: Re: bug#43966: Isearch, C-g and f10 interact to leave Isearch in an
 inconsistent state.
Date: Thu, 28 Jan 2021 21:28:02 +0200
tags 43966 fixed
close 43966 28.0.50
quit

>> I see no way to fix this other than handling isearch-mode in tmm-menubar:
>
> It does seem a bit hackish, but I guess there's no other real
> alternative...

Other alternatives would add more complexity via some redirections.
But since there are other places with special handling of isearch-mode,
this is not bad.  So now pushed to master.




Added tag(s) fixed. Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Thu, 28 Jan 2021 19:31:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.0.50, send any further explanations to 43966 <at> debbugs.gnu.org and Alan Mackenzie <acm <at> muc.de> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Thu, 28 Jan 2021 19:31:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 26 Feb 2021 12:24:14 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 60 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.