From 0652cf16507a17fa7058423ec5a7a23b0fa3cc68 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 27 Jul 2021 10:55:55 +0800 Subject: 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. --- pdf.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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." -- cgit v1.2.3-18-g5258