From e5d35f544b91a66553e0d86c2f3d9e29978bc700 Mon Sep 17 00:00:00 2001 From: David Landell Date: Sun, 4 Oct 2020 15:04:19 +0200 Subject: [PATCH] Grep: Ensure window is selected when clicking on find-abbreviate ellipsis Without this fix, clicking on the abbreviate ellipsis when focus is on another window invokes grep-find-toggle-abbreviation in the focused window instead of the clicked one. * lisp/progmodes/grep.el (grep-find-abbreviate-properties): Invoke mouse-select-window before toggling abbrevation. --- lisp/progmodes/grep.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 279eb4d54b..c8c7dfa214 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -455,7 +455,11 @@ grep-find-abbreviate-properties (let ((ellipsis (if (char-displayable-p ?…) "[…]" "[...]")) (map (make-sparse-keymap))) (define-key map [down-mouse-2] 'mouse-set-point) - (define-key map [mouse-2] 'grep-find-toggle-abbreviation) + (define-key map [mouse-2] + (lambda (click) + (interactive "e") + (mouse-select-window click) + (grep-find-toggle-abbreviation))) (define-key map "\C-m" 'grep-find-toggle-abbreviation) `(face nil display ,ellipsis mouse-face highlight help-echo "RET, mouse-2: show unabbreviated command" -- 2.17.1