branch: externals/calibre
commit 7a8ed52e866adef3c6d258668a2a68aa3fa6fcbb
Author: Kjartan Óli Ágústsson <[email protected]>
Commit: Kjartan Óli Ágústsson <[email protected]>

    Set revert-buffer-function instead of using revert hooks
    
    * calibre-library.el (calibre-library--revert): Remove
    (calibre-library-revert): Add
    (calibre-library-mode): Set revert-buffer-function.
    Don't modify tabulated-list-revert-hook.
---
 calibre-library.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/calibre-library.el b/calibre-library.el
index 9c2c70660a..6167dcd11d 100644
--- a/calibre-library.el
+++ b/calibre-library.el
@@ -103,8 +103,7 @@ ARGS should be a list of strings.  SENTINEL is a process 
sentinel to install."
                            (calibre-book-id book))))
           (forward-line)))
 
-(defun calibre-library--revert ()
-  "Refresh the contents of the Library buffer without moving point."
+(defun calibre-library-revert (&rest _IGNORED)
   (let ((pos (tabulated-list-get-id)))
     (calibre-library--refresh t)
     (if (not pos)
@@ -135,8 +134,8 @@ ARGS should be a list of strings.  SENTINEL is a process 
sentinel to install."
 
 (define-derived-mode calibre-library-mode tabulated-list-mode
   (setf tabulated-list-padding 2)
-  (calibre-library--set-header)
-  (add-hook 'tabulated-list-revert-hook #'calibre-library--revert))
+  (setq-local revert-buffer-function #'calibre-library-revert)
+  (calibre-library--set-header))
 
 ;;;###autoload
 (defun calibre-library ()

Reply via email to