From a5b61bca3f8c91b0859bb0df1a929f9a31a57b99 Mon Sep 17 00:00:00 2001 From: Xi Fu Date: Mon, 18 Jan 2021 11:11:58 -0500 Subject: [PATCH] Fix https://github.com/fuxialexander/org-pdftools/issues/63 Also fixed regex for jumping around skeleton headings and speed up isearch by narrowing to the current page when changing pages --- org-noter-pdftools.el | 14 ++++++++------ org-pdftools.el | 9 ++++++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/org-noter-pdftools.el b/org-noter-pdftools.el index 7d325cc..9c5aece 100644 --- a/org-noter-pdftools.el +++ b/org-noter-pdftools.el @@ -147,17 +147,19 @@ To use this, `org-noter-pdftools-use-org-id' has to be t." "Interface for parse PROPERTY link." (when (org-noter-pdftools--location-link-p property) (setq property (string-trim property "\\[\\[" "\\]\\]")) - (let ((link-regexp (concat "\\(.*\\)::\\([0-9]*\\)\\+\\+\\([[0-9]\\.*[0-9]*\\)\\(;;\\|" (regexp-quote org-pdftools-search-string-separator) "\\)?\\(.*\\)?"))) + (let ((link-regexp (concat "\\(.*\\)::\\([0-9]*\\)\\(\\+\\+\\)?\\([[0-9]\\.*[0-9]*\\)?\\(;;\\|" + (regexp-quote org-pdftools-search-string-separator) + "\\)?\\(.*\\)?"))) (string-match link-regexp property) (let ((path (match-string 1 property)) (page (match-string 2 property)) - (height (match-string 3 property)) + (height (match-string 4 property)) annot-id search-string) (condition-case nil - (cond ((string-equal (match-string 4 property) ";;") - (setq annot-id (match-string 5 property))) - ((string-equal (match-string 4 property) org-pdftools-search-string-separator) - (setq search-string (replace-regexp-in-string "%20" " " (match-string 5 property))))) + (cond ((string-equal (match-string 5 property) ";;") + (setq annot-id (match-string 6 property))) + ((string-equal (match-string 5 property) org-pdftools-search-string-separator) + (setq search-string (replace-regexp-in-string "%20" " " (match-string 6 property))))) (error nil)) (make-org-noter-pdftools--location :path path diff --git a/org-pdftools.el b/org-pdftools.el index 9d81d90..7c46271 100644 --- a/org-pdftools.el +++ b/org-pdftools.el @@ -207,9 +207,12 @@ Can be one of highlight/underline/strikeout/squiggly." (with-selected-window (org-noter--get-doc-window) (isearch-mode t) - (isearch-yank-string search-string))) + (let (pdf-isearch-narrow-to-page t) + (isearch-yank-string search-string)) + )) (isearch-mode t) - (isearch-yank-string search-string))))) + (let (pdf-isearch-narrow-to-page t) + (isearch-yank-string search-string)))))) ((string-match "\\(.*\\)@@\\(.*\\)" link) @@ -231,7 +234,7 @@ Can be one of highlight/underline/strikeout/squiggly." (pdf-annot-get-id (funcall org-pdftools-markup-pointer-function - (pdf-view-active-region t) + (pdf-view-active-region) org-pdftools-markup-pointer-color `((opacity . ,org-pdftools-markup-pointer-opacity)))) (if (and (not (bound-and-true-p org-noter--session))