From: Tino Calancha Date: Wed, 27 Jul 2016 10:44:06 +0000 (+0900) Subject: Remove hook when disabling ibuffer-auto-mode X-Git-Tag: emacs-26.0.90~1840^2~3 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e0d425976e3a83585db9a586687897fe1ac6455f;p=emacs.git Remove hook when disabling ibuffer-auto-mode * lisp/ibuf-ext.el (ibuffer-auto-mode): Remove 'ibuffer-auto-update-changed' from 'post-command-hook'. --- diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 96b42b99f5c..f93957ecb78 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -250,8 +250,11 @@ the mode if ARG is omitted or nil." nil nil nil (unless (derived-mode-p 'ibuffer-mode) (error "This buffer is not in Ibuffer mode")) - (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector - (add-hook 'post-command-hook 'ibuffer-auto-update-changed)) + (cond (ibuffer-auto-mode + (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed) ; Initialize state vector + (add-hook 'post-command-hook 'ibuffer-auto-update-changed)) + (t + (remove-hook 'post-command-hook 'ibuffer-auto-update-changed)))) (defun ibuffer-auto-update-changed () (when (frame-or-buffer-changed-p 'ibuffer-auto-buffers-changed)