weirdNox / org-noter

Emacs document annotator, using Org-mode
GNU General Public License v3.0
1.08k stars 101 forks source link

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

Open codetrick opened 4 years ago

codetrick commented 4 years ago

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))

aagon commented 3 years ago

This workaround works perfectly!

Why not add a PR with the change @codetrick ?

aagon commented 3 years ago

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

aagon commented 3 years ago

PR #137.

artpelling commented 3 years ago

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