summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-07-27 10:55:55 +0800
committerJSDurand <mmemmew@gmail.com>2021-07-27 10:55:55 +0800
commit0652cf16507a17fa7058423ec5a7a23b0fa3cc68 (patch)
tree6a72c1a4ea4fb6f1c05986789fab43ea21e155e8
parente28d8de0d23b9bafb73d08d70eac1a5a45b0e096 (diff)
fix: a bug in pdf-view-position-to-register
* pdf.el (pdf-view-use-dedicated-register): Integrate with the global registers. (pdf-view-position-to-register): (durand-pdf-view-position-to-register): Fix a bug that cannot add new registers caused by an improper use of a macro.
-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."