0

For editing messages, Magit opens a frame. It disappears if I finish the editing session, but it stays if I choose to cancel the session. In the latter case, I have to manually close the frame. So I wonder if there is a config variable to close the editing frame automatically.

1

For editing messages, Magit opens a frame.

It doesn't do that by default.

git-commit.el adds an entry to with-editor-server-window-alist, which controls how message buffers are displayed. This is the value of that variable for me:

(("/\\(\\(\\(COMMIT\\|NOTES\\|PULLREQ\\|MERGEREQ\\|TAG\\)_EDIT\\|MERGE_\\|\\)MSG\\|\\(BRANCH\\|EDIT\\)_DESCRIPTION\\)\\'" 
  . switch-to-buffer))

It disappears if I finish the editing session, but it stays if I choose to cancel the session. In the latter case, I have to manually close the frame.

git-commit.el attempts to force the use of switch-to-buffer because I have concluded that it would be a good idea to not use a separate frame. You can use a separate frame, but this may lead to issues like this.

When you finish or cancel writing a commit message, then an attempt is made to restore the frame to how it was before the commit was initiated. But this assumes that no new frame was created to display the buffer.

The reason that finishing the commit removes the frame and canceling does not, appears to be that the former calls server-done, which calls server-buffer-done, which ... does stuff. Calling server-done in order to cancel would be wrong.

  • 1
    thank you for the detailed explanation, especially pointing out that opening a new frame is not the default behavior. In my Emacs config, I had some settings for Emacs server, which force emacsclient to open a new frame every time. I forget why I added them. Now I have deleted those setting and everything works as expected. – capfredf May 3 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.