weirdNox / org-noter

Emacs document annotator, using Org-mode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parameter `org-noter-kill-frame-at-session-end` has an edge case

codetrick opened this issue · comments

emacs version: 27.1
org-noter version: 20191020.1212

When there are more than one frames open, and the frame where the org-noter buffers are in has no non-noter window, then killing the org-noter session will also kill the frame, even when org-noter-kill-frame-at-session-end is set to nil.

The reason this happens seems to be that the org-noter document buffer is in a dedicated window. Emacs's kill-buffer calls replace-buffer-in-windows after the buffer is killed. This function checks if the window is dedicated. If the window is dedicated and is the only window in the frame, then the window will be deleted. The frame will be deleted too if there are other frames open. This explains the behavior observed above.

The solution is to add the following in the function org-noter-kill-session before (kill-buffer doc-buffer):

(if (not org-noter-kill-frame-at-session-end) (set-window-dedicated-p (get-buffer-window doc-buffer) nil))

commented

This workaround works perfectly!

Why not add a PR with the change @codetrick ?

commented

If it's OK with you @codetrick I will open the PR myself.

commented

PR #137.

i am having the same issue and it pretty annoying. please merge this :)