Git fixed in emacs without changing window layout?

I usually work in emacs with a frame divided into two side-by-side windows. Making a change with git ( Cx vv ) opens a buffer in another window to comment on the change. The problem is that when I finish the comment and type Cc Cc , the window containing the comment dies along with the VC log buffer. Then I need to split the frame into two windows again and find the buffer that was in the remote window.

Is there a way to keep this process ( Cx vv [commit message] Cc Cc ) from ruining my window layout? I would be happy that the VC log opens in another window and then disappears without changing the layout of the window or so that the VC log temporarily crashes one of the windows while my original buffer / window layout is restored when I finish committing. I could write a wrapper function for vc-next-action that saves and restores the window configuration, but there seems to be an easier way for this. Any ideas?

+6
source share
2 answers

Quick viewing of vc options is not possible, but you can tell vc-next-action (tied to Cx vv ) using save-window-excursion , which restores windows

 (defadvice vc-next-action (around keep-windows activate) (save-window-excursion ad-do-it)) 

There is also a winner-mode for general recovery. And if you use git, you definitely need to look at the magnet.

+8
source

I had the same problem. This seems to work.

 (defadvice log-edit-done (around keep-windows activate) (save-window-excursion ad-do-it)) 

help for Cc Cc in the vc-log buffer shows this:

Cc Cc runs the log-edit-done command, which is an interactive compiled Lisp function in `log-edit.el '.

+1
source

Source: https://habr.com/ru/post/894419/


All Articles