summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf.el31
1 files changed, 31 insertions, 0 deletions
diff --git a/pdf.el b/pdf.el
index f595e7b..25f8f66 100644
--- a/pdf.el
+++ b/pdf.el
@@ -1,5 +1,36 @@
(use-package "pdf-tools/lisp" 'pdf-view)
+;; I want to integrate with the global register list.
+(setq pdf-view-use-dedicated-register nil)
+
+;; NOTE: Fix a bug
+
+;;;###autoload
+(defun durand-pdf-view-position-to-register (register)
+ "Store current PDF position in register REGISTER.
+
+See also `point-to-register'.
+
+Modifed by Durand 2021-07-27 10:42:02.828266."
+ (interactive
+ (list (pdf-view-with-register-alist
+ (register-read-with-preview "Position to register: "))))
+ (let ((p (assq register (cond (pdf-view-use-dedicated-register
+ pdf-view-register-alist)
+ (register-alist)))))
+ (cond
+ (p (setcdr p (pdf-view-registerv-make)))
+ (pdf-view-use-dedicated-register
+ (setq pdf-view-register-alist
+ (cons (cons register (pdf-view-registerv-make))
+ pdf-view-register-alist)))
+ ((setq register-alist
+ (cons (cons register (pdf-view-registerv-make))
+ register-alist))))))
+
+(advice-add 'pdf-view-position-to-register :override
+ 'durand-pdf-view-position-to-register)
+
;;;###autoload
(defun pdf-view-down-half-page-or-previous-page ()
"Scroll down half page or go to the previous page."