From db800d1d23797adea16c601dd6a585c3d6032c5d Mon Sep 17 00:00:00 2001 From: Inc0n Date: Thu, 22 Sep 2022 01:13:22 +0100 Subject: [PATCH] fix x-pop-menu returning nil when lost focus Using t explicitly allows x-pop-menu to quit instead of returning nil when mouse button event is passed. The focus is lost when the user gets rid of the menu without making a valid choice... (see `(describe-function x-pop-menu)`) --- eglot.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eglot.el b/eglot.el index 718a42db..fe7de102 100644 --- a/eglot.el +++ b/eglot.el @@ -3146,8 +3146,13 @@ at point. With prefix argument, prompt for ACTION-KIND." (action (if (and action-kind (null (cadr menu-items))) (cdr (car menu-items)) (if (listp last-nonmenu-event) - (x-popup-menu last-nonmenu-event `("Eglot code actions:" - ("dummy" ,@menu-items))) + (x-popup-menu + ;; Using t explicitly to quit, if menu lost + ;; focus (see x-popup-menu). Since mouse-1 + ;; moves point, t should be safe to use. + t ; last-nonmenu-event + `("Eglot code actions:" + ("dummy" ,@menu-items))) (cdr (assoc (completing-read (format "[eglot] Pick an action (default %s): " default-action)