From: Stephen Berman Date: Wed, 26 Nov 2014 22:17:41 +0000 (+0100) Subject: todo-mode.el: Handle calling revert-buffer. X-Git-Tag: emacs-24.4.90~170 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=47f573a4bf6b5126884286690ce1e8818ada74ee;p=emacs.git todo-mode.el: Handle calling revert-buffer. Fixes: debbugs:19187 * calendar/todo-mode.el: (todo-revert-buffer): New function. (todo-modes-set-1): Use it as the buffer-local value of revert-buffer-function. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0741bfd41c9..5947c76ac17 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2014-11-26 Stephen Berman + + * calendar/todo-mode.el: Handle calling revert-buffer (bug#19187). + (todo-revert-buffer): New function. + (todo-modes-set-1): Use it as the buffer-local value of + revert-buffer-function. + 2014-11-26 Stephen Berman * calendar/todo-mode.el (todo-mode): If called interactively, just diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index ed7c60776b2..3ba263f00e3 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -5194,6 +5194,15 @@ Overrides `diary-goto-entry'." (add-function :override diary-goto-entry-function #'todo-diary-goto-entry) +(defun todo-revert-buffer (&optional ignore-auto noconfirm) + "Call `revert-buffer', preserving buffer's current modes. +Also preserve category display, if applicable." + (interactive (list (not current-prefix-arg))) + (let ((revert-buffer-function nil)) + (revert-buffer ignore-auto noconfirm 'preserve-modes) + (when (memq major-mode '(todo-mode todo-archive-mode)) + (todo-category-select)))) + (defun todo-desktop-save-buffer (_dir) `((catnum . ,(todo-category-number (todo-current-category))))) @@ -6540,6 +6549,7 @@ Added to `window-configuration-change-hook' in Todo mode." (defun todo-modes-set-1 () "Make some settings that apply to multiple Todo modes." (setq-local font-lock-defaults '(todo-font-lock-keywords t)) + (setq-local revert-buffer-function 'todo-revert-buffer) (setq-local tab-width todo-indent-to-here) (setq-local indent-line-function 'todo-indent) (when todo-wrap-lines