GNU bug report logs -
#69236
29.1; Unwanted Focus Shift when Clicking Menu Functions in Emacs Mode Line
Previous Next
Full log
View this message in rfc822 format
> Date: Thu, 15 Feb 2024 22:55:12 +0100
> From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
>
> 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 "<C-kp-1>") . 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.
This bug report was last modified 80 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.