Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking to specific pages of a pdf no longer works after upgrade #109

Closed
jhncondix opened this issue Feb 12, 2025 · 0 comments
Closed

Linking to specific pages of a pdf no longer works after upgrade #109

jhncondix opened this issue Feb 12, 2025 · 0 comments

Comments

@jhncondix
Copy link

jhncondix commented Feb 12, 2025

After upgrading from org-pdftools-20220320.301 to org-pdftools-20250210.118,
linking to specific pdf pages no longer works and links in org files to pdfs created
previously no longer work.

I am on GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10)

If I try to create a link to a pdf page using C-c l, the error is:

org-pdftools-abbreviate-file-name: Symbol’s function definition is void: find-if

If I try to jump from a note to a pdf page using a previously created link using C-c C-o, the
error is:

org-pdftools-open-pdftools: Symbol’s function definition is void: getf

If I revert to org-pdftools-20220320.301 everything works again.

This is my org pdf tools configuration in my init.el, which worked fine until
the upgrade:

;; ORG-PDF-TOOLS CONFIGURATION

(require 'org-noter-pdftools)
(add-hook 'org-mode-hook 'org-pdftools-setup-link)

;; Add a function to ensure precise note is inserted
(defun org-noter-pdftools-insert-precise-note (&optional toggle-no-questions)
  (interactive "P")
  (org-noter--with-valid-session
   (let ((org-noter-insert-note-no-questions (if toggle-no-questions
                                                 (not org-noter-insert-note-no-questions)
                                               org-noter-insert-note-no-questions))
         (org-pdftools-use-isearch-link t)
         (org-pdftools-use-freepointer-annot t))
     (org-noter-insert-note (org-noter--get-precise-info)))))

;; fix https://github.com/weirdNox/org-noter/pull/93/commits/f8349ae7575e599f375de1be6be2d0d5de4e6cbf
(defun org-noter-set-start-location (&optional arg)
  "When opening a session with this document, go to the current location.
With a prefix ARG, remove start location."
  (interactive "P")
  (org-noter--with-valid-session
   (let ((inhibit-read-only t)
         (ast (org-noter--parse-root))
         (location (org-noter--doc-approx-location (when (called-interactively-p 'any) 'interactive))))
     (with-current-buffer (org-noter--session-notes-buffer session)
       (org-with-wide-buffer
        (goto-char (org-element-property :begin ast))
        (if arg
            (org-entry-delete nil org-noter-property-note-location)
          (org-entry-put nil org-noter-property-note-location
                         (org-noter--pretty-print-location location))))))))
(with-eval-after-load 'pdf-annot
  (add-hook 'pdf-annot-activate-handler-functions #'org-noter-pdftools-jump-to-note))

I also have a config that uses the use-package config pasted from your web site and the same issue occurs.

Thanks for any help!! I really depend on this functionality in my research!

Here are the warning messages during the upgrade:

In toplevel form:
org-pdftools.el:56:2: Warning: custom-declare-variable `org-pdftools-path-generator' docstring wider than 80 characters
org-pdftools.el:64:2: Warning: custom-declare-variable `org-pdftools-path-exporter' docstring wider than 80 characters
org-pdftools.el:74:2: Warning: custom-declare-variable `org-pdftools-path-export-translations' docstring wider than 80 characters
org-pdftools.el:93:2: Warning: custom-declare-variable `org-pdftools-export-style' docstring wider than 80 characters

In org-pdftools-abbreviate-file-name:
org-pdftools.el:145:62: Warning: Unused lexical variable `from'
org-pdftools.el:291:56: Warning: attempt to let-bind constant ‘t’
org-pdftools.el:295:51: Warning: attempt to let-bind constant ‘t’

In org-pdftools-open-pdftools:
org-pdftools.el:299:13: Warning: reference to free variable ‘pathlist’
org-pdftools.el:300:13: Warning: reference to free variable ‘occur-search-string’

In org-pdftools-setup-link:
org-pdftools.el:468:9: Warning: assignment to free variable ‘org-pdftools-prefix’
org-pdftools.el:469:28: Warning: reference to free variable ‘org-pdftools-prefix’

In org-pdftools-complete-link:
org-pdftools.el:496:21: Warning: Unused lexical argument `predicate'

In end of data:
org-pdftools.el:447:19: Warning: the function ‘org-export-file-uri’ is not known to be defined.
org-pdftools.el:224:13: Warning: the function ‘getf’ is not known to be defined.
org-pdftools.el:144:28: Warning: the function ‘find-if’ is not known to be defined.
org-pdftools.el:138:74: Warning: the function ‘equalp’ is not known to be defined.

And here are the compilation warnings on restart:


⛔ Warning (comp): org-pdftools.el:56:2: Warning: custom-declare-variable `org-pdftools-path-generator' docstring wider than 80 characters
⛔ Warning (comp): org-pdftools.el:64:2: Warning: custom-declare-variable `org-pdftools-path-exporter' docstring wider than 80 characters
⛔ Warning (comp): org-pdftools.el:74:2: Warning: custom-declare-variable `org-pdftools-path-export-translations' docstring wider than 80 characters
⛔ Warning (comp): org-pdftools.el:93:2: Warning: custom-declare-variable `org-pdftools-export-style' docstring wider than 80 characters
⛔ Warning (comp): org-pdftools.el:145:62: Warning: Unused lexical variable `from'
⛔ Warning (comp): org-pdftools.el:291:56: Warning: attempt to let-bind constant ‘t’
⛔ Warning (comp): org-pdftools.el:295:51: Warning: attempt to let-bind constant ‘t’
⛔ Warning (comp): org-pdftools.el:299:13: Warning: reference to free variable ‘pathlist’
⛔ Warning (comp): org-pdftools.el:300:13: Warning: reference to free variable ‘occur-search-string’
⛔ Warning (comp): org-pdftools.el:468:9: Warning: assignment to free variable ‘org-pdftools-prefix’
⛔ Warning (comp): org-pdftools.el:469:28: Warning: reference to free variable ‘org-pdftools-prefix’
⛔ Warning (comp): org-pdftools.el:496:21: Warning: Unused lexical argument `predicate'
⛔ Warning (comp): org-pdftools.el:447:19: Warning: the function ‘org-export-file-uri’ is not known to be defined.
⛔ Warning (comp): org-pdftools.el:224:13: Warning: the function ‘getf’ is not known to be defined.
⛔ Warning (comp): org-pdftools.el:144:28: Warning: the function ‘find-if’ is not known to be defined.
⛔ Warning (comp): org-pdftools.el:138:74: Warning: the function ‘equalp’ is not known to be defined.

Backtrace when doing C-c C-o:

Debugger entered--Lisp error: (void-function getf)
  getf((:path "~/Documents/Books/History/Europe/England/MedievalE..." :page "429" :height "0.20" :annot-id nil :search-string nil) :path)
  org-pdftools-open-pdftools("~/Documents/Books/History/Europe/England/MedievalE...")
  org-pdftools-open("~/Documents/Books/History/Europe/England/MedievalE...")
  org-link-open((link (:type "pdf" :path "~/Documents/Books/History/Europe/England/MedievalE..." :format bracket :raw-link "pdf:~/Documents/Books/History/Europe/England/Medie..." :application nil :search-option nil :begin 3303 :end 3465 :contents-begin 3452 :contents-end 3463 :post-blank 0 :parent (paragraph (:begin 2967 :end 3468 :contents-begin 2967 :contents-end 3467 :post-blank 1 :post-affiliated 2967 :mode nil :granularity element :parent (section (:begin 141 :end 5781 :contents-begin 141 :contents-end 5781 :robust-begin 141 :robust-end 5779 :post-blank 0 :post-affiliated 141 :mode section :granularity element :parent (headline ...))))))) nil)
  org-open-at-point(nil)
  funcall-interactively(org-open-at-point nil)
  command-execute(org-open-at-point)

Backtrace when doing C-c l

Debugger entered--Lisp error: (void-function find-if)
  find-if(#f(compiled-function (rule) #<bytecode 0x32e351257b466a0>) nil)
  org-pdftools-abbreviate-file-name("/home/john/Documents/Books/History/Europe/England/...")
  org-pdftools-get-link()
  org-pdftools-store-link()
  org-store-link(nil 1)
  funcall-interactively(org-store-link nil 1)
  command-execute(org-store-link)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant