[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/auto-dim-other-buffers 02ae62c5ab 37/82: Remove pre comman
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/auto-dim-other-buffers 02ae62c5ab 37/82: Remove pre command hook |
Date: |
Mon, 12 Dec 2022 20:58:41 -0500 (EST) |
branch: elpa/auto-dim-other-buffers
commit 02ae62c5aba83cf19b5df980498beb3e32fab48c
Author: Michal Nazarewicz <mina86@mina86.com>
Commit: Michal Nazarewicz <mina86@mina86.com>
Remove pre command hook
The only purpose of `adob--pre-command-hook' was to record the
`current-buffer' before the command was executed. This allowed
`adob--post-command-hook' to check whether the buffer changed.
A much simpler approach is to record buffer whenever it is
undimmed. This gets rid of the pre command hook and the whole
logic is now in `adob--post-command-hook'.
---
auto-dim-other-buffers.el | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/auto-dim-other-buffers.el b/auto-dim-other-buffers.el
index 120e7d20fe..e6f18f0e21 100644
--- a/auto-dim-other-buffers.el
+++ b/auto-dim-other-buffers.el
@@ -81,15 +81,10 @@ Currently only mini buffer and echo areas are ignored."
(setq adob--face-mode-remapping)))
(force-window-update (current-buffer)))
-(defun adob--pre-command-hook ()
- "Record current buffer before the command is run."
- (setq adob--last-buffer (current-buffer)))
-
(defun adob--post-command-hook ()
"If buffer has changed, dim the last one and undim the new one."
;; if we haven't switched buffers, do nothing
(unless (eq (current-buffer) adob--last-buffer)
-
;; first, try to dim the last buffer. if it's nil, then the
;; feature was just turned on and all buffers are already
;; dimmed. if it's just killed, don't try to set its face.
@@ -98,7 +93,8 @@ Currently only mini buffer and echo areas are ignored."
(with-current-buffer adob--last-buffer
(adob--dim-buffer t)))
;; now, restore the current buffer, and undim it.
- (adob--dim-buffer nil)))
+ (adob--dim-buffer nil)
+ (setq adob--last-buffer (current-buffer))))
(defun adob--after-change-major-mode-hook ()
"Dim or undim a new buffer if a new window, like help window, has popped up."
@@ -117,8 +113,7 @@ function."
(defun adob--hooks (callback)
"Add (if CALLBACK is `add-hook') or remove (if `remove-hook') adob hooks."
(dolist (args
- '((pre-command-hook adob--pre-command-hook)
- (post-command-hook adob--post-command-hook)
+ '((post-command-hook adob--post-command-hook)
(focus-out-hook adob--dim-all-buffers)
(focus-in-hook adob--after-change-major-mode-hook)
(after-change-major-mode-hook adob--after-change-major-mode-hook)
- [nongnu] elpa/auto-dim-other-buffers 31c13e7ed8 45/82: Use ‘window-buffer’ instead of ‘current-buffer’, (continued)
- [nongnu] elpa/auto-dim-other-buffers 31c13e7ed8 45/82: Use ‘window-buffer’ instead of ‘current-buffer’, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 90f6a6f0fb 49/82: Bump Version in comment, ELPA Syncer, 2022/12/12
- [nongnu] elpa/auto-dim-other-buffers 53652211c1 53/82: Add MELPA badge to README, ELPA Syncer, 2022/12/12
- [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 <=
- [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, 2022/12/12
- [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