branch: elpa/auto-dim-other-buffers
commit a969ff4e0e71f7fede3bc81dcbd424bba8c60a9f
Author: Steven Degutis <[email protected]>
Commit: Steven Degutis <[email protected]>
minor mode
---
README.md | 2 +-
auto-dim-other-buffers.el | 13 ++++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index eb81b5f3c6..dff8715110 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Visually makes non-current buffers less prominent.
## Turn it on
-`M-x` `turn-on-auto-dim-other-buffers`
+`M-x` `auto-dim-other-buffers-mode`
## Customize "dimmed" buffers face
diff --git a/auto-dim-other-buffers.el b/auto-dim-other-buffers.el
index ba5c65847b..c7c0c2e336 100644
--- a/auto-dim-other-buffers.el
+++ b/auto-dim-other-buffers.el
@@ -6,7 +6,7 @@
(defface auto-dim-other-buffers-face '((t :background "black"))
"Face (presumably dimmed somehow) for non-current buffers."
- :group 'auto-dim-other-buffers)
+ :group 'auto-dim-other-buffers-mode)
(defun adob/pre-command-hook ()
(setq adob/last-buffer (current-buffer)))
@@ -46,18 +46,25 @@
(adob/set-face-on-all-buffers 'auto-dim-other-buffers-face))
(defun turn-off-auto-dim-other-buffers ()
- (interactive)
+ (message "turning off")
(remove-hook 'pre-command-hook 'adob/pre-command-hook)
(remove-hook 'post-command-hook 'adob/post-command-hook)
(adob/undim-all-windows))
(defun turn-on-auto-dim-other-buffers ()
- (interactive)
+ (message "turning on")
(setq adob/last-buffer nil)
(adob/dim-all-windows)
(add-hook 'pre-command-hook 'adob/pre-command-hook)
(add-hook 'post-command-hook 'adob/post-command-hook))
+(define-minor-mode auto-dim-other-buffers-mode
+ "Visually makes non-current buffers less prominent"
+ :lighter " auto-dim"
+ (if auto-dim-other-buffers-mode
+ (turn-on-auto-dim-other-buffers)
+ (turn-off-auto-dim-other-buffers)))
+
(provide 'auto-dim-other-buffers)
;;; auto-dim-other-buffers.el ends here