From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69236: 29.1; Unwanted Focus Shift when Clicking Menu Functions in Emacs Mode Line Date: Sun, 18 Feb 2024 20:59:01 +0200 Message-ID: <86wmr1r43u.fsf@gnu.org> References: <05e7cb08-1a09-41de-ac03-7146891d4353@medialab.sissa.it> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12455"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69236@debbugs.gnu.org To: Gabriele Nicolardi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 18 20:00:04 2024 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 1rbmOS-00030U-Q5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Feb 2024 20:00:04 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbmO7-0003MZ-G5; Sun, 18 Feb 2024 13:59:43 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbmO5-0003Lo-SB for bug-gnu-emacs@gnu.org; Sun, 18 Feb 2024 13:59:41 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rbmO5-0001QH-K6 for bug-gnu-emacs@gnu.org; Sun, 18 Feb 2024 13:59:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rbmOP-0007pY-Sl for bug-gnu-emacs@gnu.org; Sun, 18 Feb 2024 14:00:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Feb 2024 19:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69236 X-GNU-PR-Package: emacs Original-Received: via spool by 69236-submit@debbugs.gnu.org id=B69236.170828277330031 (code B ref 69236); Sun, 18 Feb 2024 19:00:01 +0000 Original-Received: (at 69236) by debbugs.gnu.org; 18 Feb 2024 18:59:33 +0000 Original-Received: from localhost ([127.0.0.1]:38285 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbmNx-0007oG-BJ for submit@debbugs.gnu.org; Sun, 18 Feb 2024 13:59:33 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rbmNv-0007o3-0f for 69236@debbugs.gnu.org; Sun, 18 Feb 2024 13:59:32 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbmNU-0001OX-Br; Sun, 18 Feb 2024 13:59:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=CgFfQiMNZwTqwVT2ssGUIGOvVYp1/v/7TbzLWILX1s0=; b=sPWNwIZMt56T iOc0p6UEj/7QQ3ztrQS1YLPfiBrwkup7SlqTrM8nXlTheMS0LqoFR+iIRU4FSPGYx3oPIIlaJMI5N 2mRHa0gE+/pmOeTVjJoF8dKnmQt6/fK6XikLqII5jljxd+vx6c/mAyeVm7IEl79weoOdkYHvoKqtw L3N/pnPuDXNhSlTa1UpGLCuHjuLClyvkLnQfYxriJXuPsbjVV/RvZ1qnY+jXxbjJ+98b7bVabQ2aT ecplXjnSpyVNo+3y5DfmFDglBH5zeVaHJ44mkysag0SfBTvIRL8WbDdAOuDDlETggLga+LraaZYwl Ojs7QumYvFXZWDwcQk1kxw==; In-Reply-To: <05e7cb08-1a09-41de-ac03-7146891d4353@medialab.sissa.it> (message from Gabriele Nicolardi on Thu, 15 Feb 2024 22:55:12 +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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280197 Archived-At: > Date: Thu, 15 Feb 2024 22:55:12 +0100 > From: Gabriele Nicolardi > > I have this MWE code: > > (defun mwe-function-1 () > "MWE function 1" > (interactive) > (unwind-protect > (query-replace "foo" "bar" nil (point-min) (point-max)) > ;; UNWINDFORMS > (read-string "function 1 executed"))) > > (defun mwe-function-2 () > "MWE function 2" > (interactive) > (unwind-protect > (query-replace "foo" "bar" nil (point-min) (point-max)) > ;; UNWINDFORMS > (read-string "function 2 executed"))) > > (defun mwe-function-3 () > "MWE function 3" > (interactive) > (unwind-protect > (query-replace "foo" "bar" nil (point-min) (point-max)) > ;; UNWINDFORMS > (read-string "function 3 executed"))) > > (define-minor-mode mwe-mode > "MWE mode" > :init-value nil > :lighter (:eval (propertize " MWE " > 'face '(:foreground "RoyalBlue" :background "DarkGoldenrod1"))) > > :keymap > `( > (,(kbd "") . mwe-function) > ) > > (if mwe-mode > (easy-menu-define mwe-menu mwe-mode-map > "MWE" > '("MWE mode" > ;; I want the menu on mode-line only: > :visible (not (eq (framep (selected-frame)) 'x)) > ["mwe-function-1" mwe-function-1 > :help "mwe-function 1"] > ["mwe-function-2" mwe-function-2 > :help "mwe-function 2"] > ["mwe-function-3" mwe-function-3 > :help "mwe-function 3"])) > t)) > > that builds a minor mode where I have the mwe-menu on the mode line. > > It happens, very randomly but quite often, that I am experiencing an > issue in Emacs where clicking on a function name in a menu displayed on > the mode line not only triggers the desired function but also has an > unintended effect on the window or buffer below, interfering with the > intended functionality. > > When I click on the function mwe-function-* in the menu, it doesn't get > executed because the mouse event interrupts `query-replace'. The issue > doesn't occur consistently and is quite random. Please show the output of "C-h l" in both cases, i.e. when things work and when they don't. This should give some ideas about what goes wrong. Thanks.