emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/auto-dim-other-buffers cad370fb6c 72/82: Preserve current-


From: ELPA Syncer
Subject: [nongnu] elpa/auto-dim-other-buffers cad370fb6c 72/82: Preserve current-buffer
Date: Mon, 12 Dec 2022 20:58:46 -0500 (EST)

branch: elpa/auto-dim-other-buffers
commit cad370fb6c9fc7186c2af221932e097af5900a2d
Author: Michal Nazarewicz <mina86@mina86.com>
Commit: Michal Nazarewicz <mina86@mina86.com>

    Preserve current-buffer
    
    Fix two instances where ‘adob--dim-buffer’ function was called without
    current buffer being saved beforehand.  Since ‘adob--dim-buffer’
    changes current buffer, this resulted in… well… current buffer
    changing which might confuse other code.
    
    Fixes: https://github.com/mina86/auto-dim-other-buffers.el/issues/23
---
 auto-dim-other-buffers.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/auto-dim-other-buffers.el b/auto-dim-other-buffers.el
index bbacc203cd..2446199a4c 100644
--- a/auto-dim-other-buffers.el
+++ b/auto-dim-other-buffers.el
@@ -2,7 +2,7 @@
 ;; Author: Michal Nazarewicz <mina86@mina86.com>
 ;; Maintainer: Michal Nazarewicz <mina86@mina86.com>
 ;; URL: https://github.com/mina86/auto-dim-other-buffers.el
-;; Version: 2.0.2
+;; Version: 2.0.3
 
 ;; This file is not part of GNU Emacs.
 
@@ -193,7 +193,8 @@ Dim previously selected window if selection has changed."
              (let ((old-buf (window-buffer adob--last-window)))
                (unless (or (eq old-buf buf)
                            (eq old-buf adob--last-buffer))
-                 (adob--dim-buffer old-buf)
+                 (save-current-buffer
+                   (adob--dim-buffer old-buf))
                  (force-window-update adob--last-window))))
         (setq adob--last-window wnd)))
 
@@ -244,7 +245,8 @@ Otherwise, if a new buffer is displayed somewhere, dim it."
       ;; A new buffer is displayed somewhere but it’s not the selected one so
       ;; dim it.
       (unless (adob--never-dim-p current)
-        (adob--dim-buffer current)))))
+        (save-current-buffer
+          (adob--dim-buffer current))))))
 
 (defun adob--focus-out-hook ()
   "Dim all buffers if `auto-dim-other-buffers-dim-on-focus-out'."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]