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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion org-noter.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
(require 'org)
(require 'org-element)
(require 'cl-lib)
(require 'org-roam-bibtex nil t)

(declare-function doc-view-goto-page "doc-view")
(declare-function image-display-size "image-mode")
Expand All @@ -57,6 +58,7 @@
(declare-function pdf-view-active-region-text "ext:pdf-view")
(declare-function pdf-view-goto-page "ext:pdf-view")
(declare-function pdf-view-mode "ext:pdf-view")
(declare-function orb-find-note-file "ext:orb-utils")
(defvar nov-documents-index)
(defvar nov-file-name)

Expand Down Expand Up @@ -1320,7 +1322,7 @@ With a prefix ARG, remove start location."
(org-noter--with-valid-session
(let ((inhibit-read-only t)
(ast (org-noter--parse-root))
(location (org-noter--doc-approx-location 'interactive)))
(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))
Expand Down Expand Up @@ -2207,6 +2209,11 @@ notes file, even if it finds one."
(when (org-noter--check-if-document-is-annotated-on-file document-path file)
(push file notes-files-annotating)))))

(when (fboundp #'orb-find-note-file)
(when-let ((file-name (orb-find-note-file document-base)))
(push file-name notes-files)
(push file-name notes-files-annotating)))

(setq search-names (nreverse search-names))

(when (or arg (not notes-files-annotating))
Expand Down