From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#43966: Isearch, C-g and f10 interact to leave Isearch in an inconsistent state. Date: Wed, 27 Jan 2021 11:27:14 +0200 Organization: LINKOV.NET Message-ID: <87eei691cd.fsf@mail.linkov.net> References: <20201012170709.GB22249@ACM> <874kmz1ch2.fsf@mail.linkov.net> <87czxrat6o.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27160"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: Alan Mackenzie , 43966@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 27 10:38:23 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4hHL-0006xL-Pb for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Jan 2021 10:38:23 +0100 Original-Received: from localhost ([::1]:37386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4hHK-0004Uq-DP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 27 Jan 2021 04:38:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4hH0-0004US-6k for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2021 04:38:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60497) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l4hGz-0000vo-V9 for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2021 04:38:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l4hGz-0002df-SV for bug-gnu-emacs@gnu.org; Wed, 27 Jan 2021 04:38:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Jan 2021 09:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43966 X-GNU-PR-Package: emacs Original-Received: via spool by 43966-submit@debbugs.gnu.org id=B43966.161174027010115 (code B ref 43966); Wed, 27 Jan 2021 09:38:01 +0000 Original-Received: (at 43966) by debbugs.gnu.org; 27 Jan 2021 09:37:50 +0000 Original-Received: from localhost ([127.0.0.1]:43807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4hGo-0002d5-9z for submit@debbugs.gnu.org; Wed, 27 Jan 2021 04:37:50 -0500 Original-Received: from relay9-d.mail.gandi.net ([217.70.183.199]:53101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4hGn-0002cg-CG for 43966@debbugs.gnu.org; Wed, 27 Jan 2021 04:37:49 -0500 X-Originating-IP: 91.129.98.64 Original-Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64]) (Authenticated sender: juri@linkov.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 49BC5FF803; Wed, 27 Jan 2021 09:37:40 +0000 (UTC) In-Reply-To: <87czxrat6o.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 27 Jan 2021 05:40:31 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:198687 Archived-At: --=-=-= Content-Type: text/plain >>> 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=isearch-tmm-menubar.patch 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) --=-=-=--