0

I used to have this functionality using code below:

(setq magit-display-file-buffer-function
      (lambda (buffer)
        (setq current-prefix-arg t)
        (magit-display-file-buffer-traditional buffer)))

But it doesn't work anymore when I updated to magit 20191217.23.

  • What have you tried so far to fix it? – Dan Dec 22 '19 at 13:03
  • I tried to figure out if magit-display-file-buffer-function and magit-display-file-buffer-traditional exists at all in current version and they don't. It looks like some part of magit was refactored. I don't have much time to dwell in the code, I try to by emacs user not developer. I can always rollback to previous version, but it's almost year old. – Adam Faryna Dec 23 '19 at 0:45
  • 1
    If I understand your problem correctly, try C-u RET when point is on the hunk (instead of just RET). That is magit-diff-visit-file with a prefix argument. Or, you can run M-x magit-diff-visit-file-other-window. – Chris Clark Dec 26 '19 at 17:37
  • 1
    @ChrisClark, thanks. Yes, looks like this is the new way it works, and my config snippet can be removed. I would accept your answer if it wouldn't be just a comment, tough. – Adam Faryna Dec 26 '19 at 23:38
2

I did not remember what I have done here and why, so I went to magit's repository and used magit to find out about its own history. Using l - Fmagit-display-file-buffer-functionRET l I got a limmitted log consisting of a single commit. I looked at that commit (https://github.com/magit/magit/commit/8a214c9fb27280af6b01b6b18d04aca26d24fe2e) and behold its commit message explains what I did and why, and how you can get the behavior that you want:

Remove variable magit-display-file-buffer-function

The is one step in modeling the `magit-diff-visit-file' and
`magit-diff-visit-worktree-file' families of commands after
the `find-file' family.

The next step will be to implement the missing `*-other-window'
and `*-other-frame' variants.

In other words, users can no longer configure the base variant to
not reuse the selected window.  Instead they can use the variant
that behaves the way they like.  That may involve changing key
bindings.

One inconsistency compared to the `find-file' family is preserved:
the base aka. same-window variants continue to display in another
window if a prefix argument is used.

So bind RET to magit-diff-visit-file-other-window.

| improve this answer | |
  • 1
    Thanks @tarsius! If I understand it correctly to have it the same way as before have to change RET binding to always call magit-diff-visit-file with prefix. Is that correct? edit: I just saw @ChrisClark comment, which says exactly that, answer is not needed anymore. – Adam Faryna Dec 26 '19 at 23:36

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.