branch: elpa/auto-dim-other-buffers commit 475321c845fa1da25c92b651cbfb94b6f59a94f1 Author: Michal Nazarewicz <min...@mina86.com> Commit: Michal Nazarewicz <min...@mina86.com>
Refactor `adob--dim-buffer' to check `dim' only once Instead of having two top-level `when' statements first checking for “(and (not dim) …)” and the second one for “dim”, use an `if' checking for “dim” with a nested `when' checking for “…”. Also, after removing relative face remap, set the `adob--face-map-remapping' variable to nil. --- auto-dim-other-buffers.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/auto-dim-other-buffers.el b/auto-dim-other-buffers.el index 1df1bfb741..d29b567e71 100644 --- a/auto-dim-other-buffers.el +++ b/auto-dim-other-buffers.el @@ -8,7 +8,7 @@ ;; Michal Nazarewicz <min...@mina86.com> ;; Maintainer: Michal Nazarewicz <min...@mina86.com> ;; URL: https://github.com/mina86/auto-dim-other-buffers.el -;; Version: 1.6 +;; Version: 1.6.1 ;; This file is not part of GNU Emacs. @@ -73,11 +73,12 @@ Currently only mini buffer and echo areas are ignored." (defun adob--dim-buffer (dim) "Dim (if DIM is non-nil) or undim (otherwise) current buffer." - (when (and (not dim) adob--face-mode-remapping) - (face-remap-remove-relative adob--face-mode-remapping)) - (when dim - (setq adob--face-mode-remapping - (face-remap-add-relative 'default 'auto-dim-other-buffers-face))) + (if dim + (setq adob--face-mode-remapping + (face-remap-add-relative 'default 'auto-dim-other-buffers-face)) + (when adob--face-mode-remapping + (face-remap-remove-relative adob--face-mode-remapping) + (setq adob--face-mode-remapping))) (force-window-update (current-buffer))) (defun adob--pre-command-hook ()