New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to make magit-status always open in current window #2541
Comments
This is controlled by (defun magit-display-buffer-traditional (buffer)
"Display BUFFER the way this has traditionally been done."
(display-buffer
buffer (if (and (derived-mode-p 'magit-mode)
(not (memq (with-current-buffer buffer major-mode)
'(magit-process-mode
magit-revision-mode
magit-diff-mode
magit-stash-mode
magit-status-mode))))
'(display-buffer-same-window)
nil))) ; display in another window If you wanted Magit to open up every buffer in the current window, you (setq magit-display-buffer-function
(lambda (buffer)
(display-buffer buffer '(display-buffer-same-window)))) However, that's not very convenient for things like showing revisions (setq magit-display-buffer-function
(lambda (buffer)
(display-buffer
buffer (if (and (derived-mode-p 'magit-mode)
(memq (with-current-buffer buffer major-mode)
'(magit-process-mode
magit-revision-mode
magit-diff-mode
magit-stash-mode
magit-status-mode)))
nil
'(display-buffer-same-window))))) |
@kyleam Thanks, your last code snippet seems to do the job. Would it not make sense to have a more user friendly option for this stuff though? Cause I found it annoying that magit would pop up somewhere semi-random when I was jumping in and out of |
@kyleam Thanks for the snippet. This is exactly what I was looking for. Only one thing(at least on my part), when I activate the commit behavior in my magit status window, I get only the diff window and not a split between the commit message and the diff. I therefore have to switch manually to the COMMIT_MSG buffer to type in my commit. |
That makes sense because, with the snippert above, a diff is shown in
|
Cool! It works. Thanks a lot for the explanation. I have a lot of learning to do in elisp and emacs ;) |
Sure, but there are many possible Anyway, this is what I have come up so far (completely untested and one function does not even have an implementation yet): (defun magit-display-buffer-other-window-except-diff-v1 (buffer)
"Display BUFFER in the selected window except for some modes.
Display buffers whose `major-mode' derive from `magit-diff-mode'
or `magit-process-mode' in another window, and display all other
buffers in the selected window."
(display-buffer
buffer (if (or (derived-mode-p 'magit-diff-mode)
(derived-mode-p 'magit-process-mode))
nil ; display in another window
'(display-buffer-same-window))))
(defun magit-display-buffer-fullcolumn-with-log-exception-v1 (buffer)
"Display BUFFER using the full column except in some cases.
Display most buffers whose `magit-mode' derive from `magit-mode'
in the selected window and grow that window to the full height
of the frame, deleting other window in that column as necessary.
But buffers whose modes derive from `magit-process-mode' are
always displayed in another window and buffers whose modes
derive from `magit-diff-mode' are also displayed in another
window, provided that the mode of the current buffer derives
from `magit-log-mode' or `magit-cherry-mode'."
) And here's a snippet that might also help:
|
As mentioned in #2541, there are a lot of possible behaviors for display-buffer functions. Provide a few more options that users can try before resorting to writing their own functions. magit-display-buffer-same-window-except-diff-v1 and wmagit-display-buffer-fullcolumn-most-v1 are modified from variants proposed in #2541. magit-display-buffer-fullframe-status-v1 provides the full-frame status behavior that seems to be popular (#1953). The names of these functions are versioned, as suggested in #2541. The helper function magit--display-buffer-fullframe is modified from a function that Sebastian Wiesner shared in #1953.
As mentioned in #2541, there are a lot of possible behaviors for display-buffer functions. Provide a few more options that users can try before resorting to writing their own functions. magit-display-buffer-same-window-except-diff-v1 and magit-display-buffer-fullcolumn-most-v1 are modified from variants proposed in #2541. magit-display-buffer-fullframe-status-v1 provides the full-frame status behavior that seems to be popular (#1953). The names of these functions are versioned, as suggested in #2541. The helper function magit--display-buffer-fullframe is modified from a function that Sebastian Wiesner shared in #1953.
As mentioned in #2541, there are a lot of possible behaviors for display-buffer functions. Provide a few more options that users can try before resorting to writing their own functions. magit-display-buffer-same-window-except-diff-v1 and magit-display-buffer-fullcolumn-most-v1 are modified from variants proposed in #2541. magit-display-buffer-fullframe-status-v1 provides the full-frame status behavior that seems to be popular (#1953). The names of these functions are versioned, as suggested in #2541. The helper function magit--display-buffer-fullframe is modified from a function that Sebastian Wiesner shared in #1953.
Fixed by getting rid of `nomis/magit-display-buffer-function`, which was a fix for the following problem that seems to have gone away: > Have Magit status buffer open in same window > See magit/magit#2541
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
That too is not controlled by Unless you are using a very old magit version it also isn't controlled by I don't understand your problem description. Also we no longer use the issue tracker for support requests and repurposing old issues for new support requests was never a good idea in the first place. Please open a new "discussion" instead, possibly with screenshots. |
Since I updated magit, it always opens in a "other" window now. I recall earlier last year there were a few options around this behavior, and they changed names a few times, the most recent one I set in my config was
magit-status-buffer-switch-function
to'switch-to-buffer
which made it open in the current buffer as I like.But now there doesn't seem to be any options for it. And sadly my lisp skills aren't good enough to dig through the code and the find the solution in 5 minutes. Hence any possible of adding back such an option, or pointing me in the right direction to make magit behave that way?
Thanks :)
The text was updated successfully, but these errors were encountered: