summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-08-28 23:26:27 +0800
committerJSDurand <mmemmew@gmail.com>2022-08-28 23:26:27 +0800
commite46eef2a70c675a0cb62cc35bbf50ec3d31f6ee0 (patch)
treeab2067b434c67e2fa1bf6d2dc2a10eb3da2919ea
parentd2981800dabfb0cdae9eaaf5a4c644c177fb0e12 (diff)
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.
-rw-r--r--basic.el21
1 files changed, 21 insertions, 0 deletions
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)))