[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/auto-dim-other-buffers ec74b4803a 56/82: Split ‘adob--dim
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/auto-dim-other-buffers ec74b4803a 56/82: Split ‘adob--dim-buffer’ into two no-argument functions |
Date: |
Mon, 12 Dec 2022 20:58:44 -0500 (EST) |
branch: elpa/auto-dim-other-buffers
commit ec74b4803adeadf06296c84595fb6ccf4e1b4a3f
Author: Michal Nazarewicz <mina86@mina86.com>
Commit: Michal Nazarewicz <mina86@mina86.com>
Split ‘adob--dim-buffer’ into two no-argument functions
The resulting two functios are much easier to read and removel of the
argument complicated only one call site so this is overall a positive
change.
---
auto-dim-other-buffers.el | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/auto-dim-other-buffers.el b/auto-dim-other-buffers.el
index 3c864c1002..44e860c892 100644
--- a/auto-dim-other-buffers.el
+++ b/auto-dim-other-buffers.el
@@ -82,16 +82,18 @@ Currently only mini buffer and echo areas are ignored."
(defvar-local adob--face-mode-remapping nil
"Current remapping cookie for `auto-dim-other-buffers-mode'.")
-(defun adob--dim-buffer (dim)
- "Dim (if DIM is non-nil) or undim (otherwise) current buffer."
- (when (cond ((and dim (not adob--face-mode-remapping))
- (setq adob--face-mode-remapping
- (face-remap-add-relative 'default
- 'auto-dim-other-buffers-face)))
- ((and (not dim) adob--face-mode-remapping)
- (face-remap-remove-relative adob--face-mode-remapping)
- (setq adob--face-mode-remapping nil)
- t))
+(defun adob--dim-buffer ()
+ "Dim current buffer if not already dimmed."
+ (when (not adob--face-mode-remapping)
+ (setq adob--face-mode-remapping
+ (face-remap-add-relative 'default 'auto-dim-other-buffers-face))
+ (force-window-update (current-buffer))))
+
+(defun adob--undim-buffer ()
+ "Undim current buffer if dimmed."
+ (when adob--face-mode-remapping
+ (face-remap-remove-relative adob--face-mode-remapping)
+ (setq adob--face-mode-remapping nil)
(force-window-update (current-buffer))))
(defun adob--buffer-list-update-hook ()
@@ -107,10 +109,10 @@ Currently only mini buffer and echo areas are ignored."
(and (buffer-live-p adob--last-buffer)
(not (adob--never-dim-p adob--last-buffer))
(with-current-buffer adob--last-buffer
- (adob--dim-buffer t)))
+ (adob--dim-buffer)))
;; Undim the new buffer.
(with-current-buffer buf
- (adob--dim-buffer nil))
+ (adob--undim-buffer))
(setq adob--last-buffer buf))))
(defun adob--focus-out-hook ()
@@ -121,7 +123,7 @@ Currently only mini buffer and echo areas are ignored."
(defun adob--focus-in-hook ()
"Undim current buffers if `auto-dim-other-buffers-dim-on-focus-out'."
(when auto-dim-other-buffers-dim-on-focus-out
- (adob--dim-buffer nil)
+ (adob--undim-buffer)
(setq adob--last-buffer (current-buffer))))
(defun adob--dim-all-buffers (dim)
@@ -132,7 +134,7 @@ function."
(dolist (buffer (buffer-list))
(unless (adob--never-dim-p buffer)
(set-buffer buffer)
- (adob--dim-buffer dim)))))
+ (if dim (adob--dim-buffer) (adob--undim-buffer))))))
(defun adob--hooks (callback)
"Add (if CALLBACK is `add-hook') or remove (if `remove-hook') adob hooks."
- [nongnu] elpa/auto-dim-other-buffers bc36211be2 63/82: Dim buffers appearing in non-selected windows, (continued)
- [nongnu] elpa/auto-dim-other-buffers bc36211be2 63/82: Dim buffers appearing in non-selected windows, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 69d369e884 75/82: Fix minor typos and small refactor making use of ‘dolist`, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers e20bc722d6 02/82: that didnt help..., ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 244c979b67 25/82: after-change-major-mode-hook on next-error-hook, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 37085cf479 28/82: Consistently use “buffers” in function names, not “windows”., ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 2424476114 18/82: fix some stuff, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers db5411dd17 23/82: Fix compiler warning by defining the variable, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 02ae62c5ab 37/82: Remove pre command hook, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 8b909cb210 41/82: fix change major mode on next-error-hook, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers d1ee176652 54/82: Update screenshot; make it animated, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers ec74b4803a 56/82: Split ‘adob--dim-buffer’ into two no-argument functions,
ELPA Syncer <=
- [nongnu] elpa/auto-dim-other-buffers 0c15c0d3a4 52/82: s/adob--ignore-buffer/adob--never-dim-p/, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 82626612bd 71/82: Handle window and buffer switching at the same time, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 2a19931b27 80/82: Introduce ‘auto-dim-other-buffers-hide-face’ for hidden dimmed text, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers f0d48d94c3 77/82: Introduce ‘auto-dim-other-buffers-never-dim-buffer-functions’, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 33b5f88b79 82/82: Correctly handle optional kill-all-local-variables argument in advice, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 9f768ddd9a 76/82: Debounce focus-change events, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 07d906f0f0 04/82: useless extra thing, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers e473ef45ea 05/82: set buffer faces MUCH less often, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 7ed6580b7d 12/82: update sshot, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers e93f115d32 09/82: comments and fix, ELPA Syncer, 2022/12/12