branch: elpa/auto-dim-other-buffers commit cedb4c48955812f26ab5f22340f9a48e85aa17e7 Author: Michal Nazarewicz <min...@mina86.com> Commit: Michal Nazarewicz <min...@mina86.com>
Use ‘buffer-list-update-hook’ instead of ‘post-command-hook’ In certain cases, ‘post-command-hook’ is called before a buffer is changed and then doesn’t get called again. This leads to buffer not being properly undimmed. Change to use ‘buffer-list-update-hook’ which is called on every buffer change. This fixes https://github.com/mina86/auto-dim-other-buffers.el/issues/12 --- auto-dim-other-buffers.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auto-dim-other-buffers.el b/auto-dim-other-buffers.el index 53b202aaff..572977a11f 100644 --- a/auto-dim-other-buffers.el +++ b/auto-dim-other-buffers.el @@ -89,7 +89,7 @@ Currently only mini buffer and echo areas are ignored." t)) (force-window-update (current-buffer))) -(defun adob--post-command-hook () +(defun adob--buffer-list-update-hook () "If buffer has changed, dim the last one and undim the new one." (let ((buf (window-buffer))) ;; if we haven't switched buffers, do nothing @@ -130,7 +130,7 @@ function." (defun adob--hooks (callback) "Add (if CALLBACK is `add-hook') or remove (if `remove-hook') adob hooks." (dolist (args - '((post-command-hook adob--post-command-hook) + '((buffer-list-update-hook adob--buffer-list-update-hook) (focus-out-hook adob--focus-out-hook) (focus-in-hook adob--focus-in-hook))) (apply callback args)))