[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/auto-dim-other-buffers 6ebff3681f 46/82: Don’t dim alread
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/auto-dim-other-buffers 6ebff3681f 46/82: Don’t dim already dimmed buffer |
Date: |
Mon, 12 Dec 2022 20:58:42 -0500 (EST) |
branch: elpa/auto-dim-other-buffers
commit 6ebff3681fcae32ea3c762a1741ec62c3aa1180f
Author: Michal Nazarewicz <mina86@mina86.com>
Commit: Michal Nazarewicz <mina86@mina86.com>
Don’t dim already dimmed buffer
‘face-remap-add-relative’ may be a rather expensive operation. This
becomes a problem in ‘adob--focus-out-hook’ which dims *all* existing
buffers. Change ‘adob--dim-buffer’ so that it does not needlessly
dim already dimmed buffer.
This fixes https://github.com/mina86/auto-dim-other-buffers.el/issues/13
---
auto-dim-other-buffers.el | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/auto-dim-other-buffers.el b/auto-dim-other-buffers.el
index 64593876e7..53b202aaff 100644
--- a/auto-dim-other-buffers.el
+++ b/auto-dim-other-buffers.el
@@ -74,17 +74,20 @@ Currently only mini buffer and echo areas are ignored."
(string-match "^ \\*Echo Area" (buffer-name buffer))))
;; current remapping cookie for adob
-(defvar-local adob--face-mode-remapping nil)
+(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."
- (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 nil)))
- (force-window-update (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))
+ (force-window-update (current-buffer)))
(defun adob--post-command-hook ()
"If buffer has changed, dim the last one and undim the new one."
- [nongnu] branch elpa/auto-dim-other-buffers created (now 33b5f88b79), ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 890051374f 01/82: first, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 16db9f4942 06/82: MUCH more efficient: only changes faces for 2 buffers max, and only when necessary, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers e7fcc5336c 13/82: less ceremonial readme?, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 6804fde17b 11/82: screenshot, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers fb7ea24922 26/82: dimming/undimming when gaining/losing app focus, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers e64bdbdb0a 34/82: Use `face-remap-add-relative' to not interfere with `buffer-face-mode', ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 6ebff3681f 46/82: Don’t dim already dimmed buffer,
ELPA Syncer <=
- [nongnu] elpa/auto-dim-other-buffers e85510688d 19/82: duh, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers c80b367dd0 22/82: Leave echo area alone, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers bea02696f0 21/82: Use save-current-buffer and with-current-buffer, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers a969ff4e0e 16/82: minor mode, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers cfab476572 36/82: Move hooks adding/removing to separate function, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers cedb4c4895 47/82: Use ‘buffer-list-update-hook’ instead of ‘post-command-hook’, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 44b8965cff 32/82: Specify the license, GPL-3.0+ is used., ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 4cc1e1bb08 55/82: Add version of the dim face for light background, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 8d7ef78b4a 65/82: Prefer ‘after-focus-change-function’, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers af8eec9ec2 62/82: Prefer ‘window-buffer’ to ‘current-buffer’, ELPA Syncer, 2022/12/12