Skip to content

Commit

Permalink
Merge branch 'PR71' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
petermao committed Jan 19, 2024
2 parents 545b8a7 + 63d70bf commit 344a6f3
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions org-noter-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,13 @@ With '/', 'The_Title' would become '/The_Title/'."
:type 'string
:version "28.2")

(defcustom org-noter-focus-doc-after-note-navigation t
"Focus behavior.
When non-nil, automatically focus the document window after moving
between notes. When nil, leave focus in current window."
:group 'org-noter-navigation
:type 'boolean)

(defface org-noter-no-notes-exist-face
'((t
:foreground "chocolate"
Expand Down Expand Up @@ -2526,7 +2533,8 @@ As such, it will only work when the notes window exists."
(org-noter--doc-goto-location (org-noter--parse-location-property previous))
(org-noter--focus-notes-region (org-noter--make-view-info-for-single-note session previous)))
(user-error "There is no previous note"))))
(select-window (org-noter--get-doc-window)))
(when org-noter-focus-doc-after-note-navigation
(select-window (org-noter--get-doc-window))))

(defun org-noter-sync-current-note ()
"Go the location of the selected note, in relation to where the point is.
Expand All @@ -2541,9 +2549,10 @@ As such, it will only work when the notes window exists."
(org-noter--doc-goto-location location)
(user-error "No note selected")))
(user-error "You are inside a different document")))
(let ((window (org-noter--get-doc-window)))
(select-frame-set-input-focus (window-frame window))
(select-window window)))
(when org-noter-focus-doc-after-note-navigation
(let ((window (org-noter--get-doc-window)))
(select-frame-set-input-focus (window-frame window))
(select-window window))))

(defun org-noter-sync-next-note ()
"Go to the location of the next note, in relation to where the point is.
Expand All @@ -2565,7 +2574,8 @@ As such, it will only work when the notes window exists."
(org-noter--doc-goto-location (org-noter--parse-location-property next))
(org-noter--focus-notes-region (org-noter--make-view-info-for-single-note session next)))
(user-error "There is no next note"))))
(select-window (org-noter--get-doc-window)))
(when org-noter-focus-doc-after-note-navigation
(select-window (org-noter--get-doc-window))))

(defun org-noter-enable-update-renames ()
"Enable `dired-rename-file' advice for moving docs and notes.
Expand Down

0 comments on commit 344a6f3

Please sign in to comment.