tools/pdf: fix 1826
Error occurs if pdf-annot is never loaded before kill-buffer hook runs.
This commit is contained in:
parent
45240699e0
commit
a940f56fb4
1 changed files with 12 additions and 11 deletions
|
@ -5,17 +5,18 @@
|
||||||
:config
|
:config
|
||||||
(map! :map pdf-view-mode-map :gn "q" #'kill-current-buffer)
|
(map! :map pdf-view-mode-map :gn "q" #'kill-current-buffer)
|
||||||
|
|
||||||
(defun +pdf-cleanup-windows-h ()
|
(after! pdf-annot
|
||||||
"Kill left-over annotation buffers when the document is killed."
|
(defun +pdf-cleanup-windows-h ()
|
||||||
(when (buffer-live-p pdf-annot-list-document-buffer)
|
"Kill left-over annotation buffers when the document is killed."
|
||||||
(pdf-info-close pdf-annot-list-document-buffer))
|
(when (buffer-live-p pdf-annot-list-document-buffer)
|
||||||
(when (buffer-live-p pdf-annot-list-buffer)
|
(pdf-info-close pdf-annot-list-document-buffer))
|
||||||
(kill-buffer pdf-annot-list-buffer))
|
(when (buffer-live-p pdf-annot-list-buffer)
|
||||||
(let ((contents-buffer (get-buffer "*Contents*")))
|
(kill-buffer pdf-annot-list-buffer))
|
||||||
(when (and contents-buffer (buffer-live-p contents-buffer))
|
(let ((contents-buffer (get-buffer "*Contents*")))
|
||||||
(kill-buffer contents-buffer))))
|
(when (and contents-buffer (buffer-live-p contents-buffer))
|
||||||
(add-hook! 'pdf-view-mode-hook
|
(kill-buffer contents-buffer))))
|
||||||
(add-hook 'kill-buffer-hook #'+pdf-cleanup-windows-h nil t))
|
(add-hook! 'pdf-view-mode-hook
|
||||||
|
(add-hook 'kill-buffer-hook #'+pdf-cleanup-windows-h nil t)))
|
||||||
|
|
||||||
(setq-default pdf-view-display-size 'fit-page
|
(setq-default pdf-view-display-size 'fit-page
|
||||||
pdf-view-use-scaling t
|
pdf-view-use-scaling t
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue