From b9d46ec704f654b7a95762810b54c95a6a194789 Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Wed, 12 Dec 2018 15:26:26 -0500 Subject: [PATCH] [emacs] focus follows mouse, except in gnus-summary-mode buffers --- init.org | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/init.org b/init.org index 7c12ad5..9c64204 100644 --- a/init.org +++ b/init.org @@ -419,6 +419,24 @@ Font stack with better unicode support, around =Ubuntu Mono= and (setq text-scale-mode-step 1.05) #+end_src +** Focus follows mouse + +I’d like focus to follow the mouse when I move the cursor from one +window to the next. + +#+begin_src emacs-lisp +(setq mouse-autoselect-window t) +#+end_src + +Let’s define a function to conveniently disable this for certain +buffers and/or modes. + +#+begin_src emacs-lisp +(defun amin--no-mouse-autoselect-window () + (make-local-variable 'mouse-autoselect-window) + (setq mouse-autoselect-window nil)) +#+end_src + ** Libraries #+begin_src emacs-lisp @@ -2243,7 +2261,8 @@ For when I /have to/ use GH. :map gnus-summary-mode-map ("r" . gnus-summary-reply-with-original) ("R" . gnus-summary-wide-reply-with-original) - ("M-L" . org-store-link))) + ("M-L" . org-store-link)) + :hook (gnus-summary-mode . amin--no-mouse-autoselect-window)) (use-package gnus-msg :config -- 2.20.1