From e46eef2a70c675a0cb62cc35bbf50ec3d31f6ee0 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 28 Aug 2022 23:26:27 +0800 Subject: basic: delete associated timers to pdf-view-mode * basic.el (durand-kill-current-buffer): Modify this funcion so that the associated timers to PDF files are also killed at the time of deletion. --- basic.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/basic.el b/basic.el index bfb8a87..b2ab6d0 100644 --- a/basic.el +++ b/basic.el @@ -239,6 +239,27 @@ window, then also delete the selected window." ((window-minibuffer-p (selected-window)) ;; this is the same as calling `abort-recursive-edit'. (throw 'exit t)) + ((derived-mode-p 'pdf-view-mode) + ;; We also want to kill the associated timer, if any. + (mapc + (lambda (timer) + (cond + ((and + (eq (timer--function timer) 'pdf-cache--prefetch-start) + (listp (timer--args timer)) + (memq (current-buffer) (timer--args timer))) + (setq timer-idle-list (delq timer timer-idle-list))))) + timer-idle-list) + (mapc + (lambda (timer) + (cond + ((and + (eq (timer--function timer) 'pdf-cache--prefetch-start) + (listp (timer--args timer)) + (memq (current-buffer) (timer--args timer))) + (setq timer-list (delq timer timer-list))))) + timer-list) + (kill-buffer (current-buffer))) (t (kill-buffer (current-buffer)))) (cond ((and arg (not (one-window-p t))) -- cgit v1.2.3-18-g5258