From: Amin Bandali Date: Wed, 12 Dec 2018 20:26:26 +0000 (-0500) Subject: [emacs] focus follows mouse, except in gnus-summary-mode buffers X-Git-Url: https://git.shemshak.org/~bandali/configs/commitdiff_plain/b9d46ec704f654b7a95762810b54c95a6a194789?hp=e87abe21e1508a23d17c14b02ca9b0244b329106 [emacs] focus follows mouse, except in gnus-summary-mode buffers --- 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