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

Fix location autosave when using org-pdftools integration #93

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xzz53
Copy link

@xzz53 xzz53 commented Feb 5, 2020

Hi!

I'm trying to get org-noter-integration.el working. Core functionality seems to be OK, but I've encountered an issue when running with org-noter-auto-save-last-location enabled. It results in org-noter-pdftools--doc-approx-location being called with 'interactive argument on every page change. That in turn activates interactive branch ("Do you want to create a free pointer annotation for the link?") in org-pdftools-get-link. This patch prevents that by changing org-noter-set-start-location so that 'interactive is passed to org-noter-pdftools--doc-approx-location only when directly called by user, not from org-noter--doc-location-change-handler.

@smallzhan
Copy link

@xzz53 Could you show your configuration about org-noter-integration.el' about org-noter'?

After loading the org-noter-integration.el in my config. click the pdftools:xxx link in the notes file failed to link to the location of pdf file.
and a message `Invalid function: org-noter--with-valid-session' appears in minibuffer.

@xzz53
Copy link
Author

xzz53 commented Feb 6, 2020

@smallzhan, at present I just do (load "~/.emacs.d/straight/repos/org-noter/other/org-noter-integration.el"). I've just tested opening pdftools: links, and they work as expected. Are you sure you use master branch of both org-noter and org-pdftools?

PS
I plan to set up a PR against org-pdftools to merge org-noter-integration.el there when I'm sure it basically works, in a few days probably

@xzz53 Could you show your configuration about org-noter-integration.el' about org-noter'?

After loading the org-noter-integration.el in my config. click the pdftools:xxx link in the notes file failed to link to the location of pdf file.
and a message `Invalid function: org-noter--with-valid-session' appears in minibuffer.

@smallzhan
Copy link

@xzz53 seems that org-pdftools can't be complied as .elc, now it works, thank you!

Your `PS' will be a very great work!

PS
I plan to set up a PR against org-pdftools to merge org-noter-integration.el there when I'm sure it basically works, in a few days probably

@spacekitteh
Copy link

I'm getting this issue now suddenly. It's frustrating as hell. Please merge!

@wilya7
Copy link

wilya7 commented Jun 29, 2020

I'm getting this issue now suddenly. It's frustrating as hell. Please merge!

Same here. The package with this bug is unusable.

Update:

As a work around I installed el-patch and added to my init.el the following code:

(eval-when-compile
  (require 'el-patch))
(el-patch-feature org-noter)
(with-eval-after-load 'org-noter
  (el-patch-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 (el-patch-add (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)))))))))

@LorenRiccie
Copy link

"click anywhere on the page to add a link to. Do you want to do that?" keeps popping up ! Makes the package in Emacs 27.1 useless

@wilya7
Copy link

wilya7 commented Jan 4, 2021

"click anywhere on the page to add a link to. Do you want to do that?" keeps popping up ! Makes the package in Emacs 27.1 useless

The author seems to have completely abandoned the package. From my point of view, either you fork and patch the package in your local github repository and instruct emacs to use it, or you install el-patch and patch org-noter every time you start emacs by adding #93 (comment) to your init.el.

@wilya7
Copy link

wilya7 commented Jan 27, 2021

Now if you follow the use-package configuration recommended by the readme of org-pdftools, the fix goes in there. See: fuxialexander/org-pdftools@2335f6a

It works well for me.

c1-g added a commit to c1-g/org-noter-plus-djvu that referenced this pull request Mar 10, 2022
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

Successfully merging this pull request may close these issues.

None yet

5 participants