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

Autosave, global write/save commands do not save PDF buffer when using org-noter/org-pdftools #68

Open
workcomplete opened this issue Mar 9, 2021 · 5 comments

Comments

@workcomplete
Copy link

I did some reading over the weekend and marked up a number of PDFs using the combined highlight-annotation and text extraction of org-pdftools by calling org-noter-insert-note. This works beautifully and I am able cruise through my compiled notes document calling 'sync next/previous note' to see the highlighted portion of the text presented in the PDF.

On reopening the PDFs to resume note-taking this morning the highlight-annotations have disappeared from the pdf document. The notes themselves are intact (i.e. the content, noter page address and ID are correct) and when I scroll through the pdf, the notes document is still synced (e.g. it scrolls in sync with the pdf).

However, when I call org-noter-sync-[next/previous/current]-note I get "no such annotation". The mini-buffer in the pdf document buffer still tells me there are "[some number of] notes invalid" on the page. pdf-tools-install does not fix this. pdf-annont-minor-mode is active in the bufffer.

Given the layers of programs being used to make this workflow happen I'm not sure if this is an org-pdftools problem but it's the most recent addition to the workflow so I figured I would start here. My config is exactly as is posted in the README for this project. If other parts of my config would be helpful I'm happy to share.

I did reinstall pdf-tools last week due to the change in maintainer (vedang), but that was before marking these documents up.

FWIW my pdfs are OCR tesseract generated from scans of books- this has been associated with some weird behavior with pdf-tools in the past but I have not encountered this specific issue before.

@workcomplete
Copy link
Author

This could be a user error. Org-noter opens a new frame with vertical split, document buffer and notes buffer. Calling "write" in the notes buffer does not save the linked annotations. It appears that with my setup I have to call "write" in both the notes and PDF buffer.

@igoralmeida
Copy link

(Disclaimer: I haven't actually installed org-pdftools yet, but I have used pdf-tools and org-noter extensively)

It does look like user error, and I don't think it has anything to do with org-pdftools itself.
For future reference:

The 'annotations' (highlights, free text, etc.) are the responsibility of pdf-tools (or any other PDF viewer). Once you've added them with pdf-tools (something like C-c C-a t or pdf-annot-add-text-annotation), you must save the PDF, because that's where the annotations live.

The 'notes' you navigate with org-noter-sync-xxxx are the responsibility of org-noter, and they live in an .org file that you chose the first time you opened an org-noter session for that PDF. You just need to save the org buffer to keep these.

There is at least a one-way method to create 'notes' for org-noter out of pdf-tools 'annotations' with org-noter-create-skeleton, but you'll have to run it every time you add a new annotation :) The good thing is that you can use the same org-noter-sync-xxxx commands to navigate through both sets (otherwise you'll need something like pdf-annot-list-annotations and then pdf-annot-list-follow-minor-mode).

There are github issues in the repos that you can read through discussing a way to keep these two in sync, but it's still very experimental as far as I know.

@workcomplete
Copy link
Author

Thanks @igoralmeida for that response, the issue at hand is not keeping the .org notes and pdf annotations in sync, org-pdftools handles this very well. The issue is that autosave does not happen in the pdf buffer when annotating the PDFs using org-noter and org-pdftools. On top of this, calling ":w" or "save-all-buffers" only saves only the .org file and not the pdf annotations unless explicitly called from the PDF buffer. This only happens in org-noter mode (eg. if I annotate a pdf using pdf tools, the changes are autosaved, and ":w" will also save the pdf annotations if called from another buffer).

@workcomplete workcomplete changed the title Highlights/annotations dissapear from document after closing/reopening pdf. Autosave, global write/save commands do not save PDF buffer when using org-noter/org-pdftools May 6, 2021
@Muff2n
Copy link

Muff2n commented Jul 8, 2021

I have also been burned by this. I have annotations that are saved in the org-noter buffer but not saved in the pdf. There appear to be two problems:

  • Calling save on the org-noter buffer does not save the pdf, it would be nice if it did.
  • I use spacemacs and it seems that calling :w on the pdf does not save it properly, I need to use SPC f s. This means that I cannot use :wa in a different buffer and have the pdf also be saved.

Because forgetting to properly save the pdf buffer causes my highlights to be lost, it would be nice if there was a function to add the org-noter annotations to the pdf.

@Muff2n
Copy link

Muff2n commented Jul 27, 2021

I have had some success using the 'fix' fapdash has posted in the linked issue.

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

3 participants