I just got back to this. Ihor Radchenko <[email protected]> writes:
> Björn Kettunen <[email protected]> writes: > >> I have a patch to fix the bug. The issue was that the window >> configuration to restore to was set to early, i.e. set before popping to >> the frame the note is taken in. > > But if we do not pop the frame, but simply a buffer, we *DO NOT* want > the notes buffer window configuration to be saved. > > Just try > 1. make repro > 2. M-x find-file /tmp/test.org > You will have a single window in the Emacs frame > 3. Add a heading > * heading > 4. C-c C-z > 5. The note window will pop up > 6. type something > 7. C-c C-c > 8. There will be two windows in Emacs frame I could reproduce this issue. I think saving the window configuration after poping to the org-log-note marker but before poping the org-note buffer would work for both setups. In both cases the window configuration in that frame the org-note is taken should be saved and restored. Saving the window configuration of that frame the org-note is in would make sure the correct window configuration is restore no matter what frame is the frame of origin. I added the patch with the updated change. >> The other change I have is to raise the frame where the call to take the >> note is issued from if it's different from the one where it's taken. >> To restore back the focus as it was when the command to take a note was >> called, this aligns the behavior as if the only one frame was used. > > What about using current-frame-configuration instead of > current-window-configuration? If I read correctly this would affect all frames from starting to take the note till being done taking that note.
>From 412eec13d899448bb67c027d0cf8c3eded3e4c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kettunen?= <[email protected]> Date: Sat, 25 Apr 2026 19:06:26 +0300 Subject: [PATCH] org: Fix restoring window configuration when the frame is different * lisp/org.el (org-add-log-note): Fix restoring the window configuration when where the command to take the note was started on is different to the frame where the note is taken in. --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 696c27ecd..b050cd667 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11073,9 +11073,9 @@ (defun org-add-log-note (&optional _purpose) (= org-log-note-recursion-depth (recursion-depth))) (remove-hook 'post-command-hook 'org-add-log-note) (setq org-log-setup nil) - (setq org-log-note-window-configuration (current-window-configuration)) (move-marker org-log-note-return-to (point)) (pop-to-buffer (marker-buffer org-log-note-marker) '(org-display-buffer-full-frame)) + (setq org-log-note-window-configuration (current-window-configuration)) (goto-char org-log-note-marker) (pop-to-buffer "*Org Note*" '(org-display-buffer-split)) (erase-buffer) -- 2.54.0
