all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#43966: Isearch, C-g and f10 interact to leave Isearch in an inconsistent state.
@ 2020-10-12 17:07 Alan Mackenzie
  2020-10-12 19:36 ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2020-10-12 17:07 UTC (permalink / raw)
  To: 43966

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).





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43966: Isearch, C-g and f10 interact to leave Isearch in an inconsistent state.
  2020-10-12 17:07 bug#43966: Isearch, C-g and f10 interact to leave Isearch in an inconsistent state Alan Mackenzie
@ 2020-10-12 19:36 ` Juri Linkov
  2021-01-27  4:40   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2020-10-12 19:36 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 43966

> (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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43966: Isearch, C-g and f10 interact to leave Isearch in an inconsistent state.
  2020-10-12 19:36 ` Juri Linkov
@ 2021-01-27  4:40   ` Lars Ingebrigtsen
  2021-01-27  9:27     ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-27  4:40 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Alan Mackenzie, 43966

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43966: Isearch, C-g and f10 interact to leave Isearch in an inconsistent state.
  2021-01-27  4:40   ` Lars Ingebrigtsen
@ 2021-01-27  9:27     ` Juri Linkov
  2021-01-28  3:03       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2021-01-27  9:27 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Alan Mackenzie, 43966

[-- Attachment #1: Type: text/plain, Size: 779 bytes --]

>>> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: isearch-tmm-menubar.patch --]
[-- Type: text/x-diff, Size: 1616 bytes --]

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)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#43966: Isearch, C-g and f10 interact to leave Isearch in an inconsistent state.
  2021-01-27  9:27     ` Juri Linkov
@ 2021-01-28  3:03       ` Lars Ingebrigtsen
  2021-01-28 19:28         ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-28  3:03 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Alan Mackenzie, 43966

Juri Linkov <juri@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#43966: Isearch, C-g and f10 interact to leave Isearch in an inconsistent state.
  2021-01-28  3:03       ` Lars Ingebrigtsen
@ 2021-01-28 19:28         ` Juri Linkov
  0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2021-01-28 19:28 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Alan Mackenzie, 43966

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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-28 19:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-12 17:07 bug#43966: Isearch, C-g and f10 interact to leave Isearch in an inconsistent state Alan Mackenzie
2020-10-12 19:36 ` Juri Linkov
2021-01-27  4:40   ` Lars Ingebrigtsen
2021-01-27  9:27     ` Juri Linkov
2021-01-28  3:03       ` Lars Ingebrigtsen
2021-01-28 19:28         ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.