ediff-split-window-function horizontal==vertical?
Asked Answered
L

3

18

Emacs 23.1.1 Ediff 2.81.2 on CentOs 6

Prior to any customization, Ediff would, by default, split the windows horizontally (one on top of the other).

I wanted them side by side so I tried adding the following lines to my .emacs

(setq ediff-split-window-function 'split-window-vertically)
(setq ediff-merge-split-window-function 'split-window-vertically)

This had no effect - the windows were still split horizontally. I also tried using the Emacs Customization interface for Ediff to get the vertical split by default - same story.

Note that I tried this in a comparison with two buffers that were vertically split. I also tried it with no files open in buffers and asked Ediff to compare two files - same result.

Then I tried specifying split-window-horizontally as the split window function for both ediff-split and ediff-merge.

(setq ediff-split-window-function 'split-window-horizontally)
(setq ediff-merge-split-window-function 'split-window-horizontally)

This caused the windows to split vertically (next to each other). This was also true when I commented out these lines and used the Emacs Customization interface to set these options.

And yes, I've seen this question but I don't want to eliminate horizontal splitting on a global basis - I just want Ediff to do it by default.

Am I losing my mind or has someone switched the meaning of "horizontal" and "vertical" (and by the way, I'm taking the definition of "vertical" and "horizontal" splitting from my copy of the O'Reilly book "Learning Gnu Emacs")?

Lightning answered 14/3, 2012 at 15:42 Comment(1)
Split-window-horizontally means to split the window into two windows that are horizontally adjacent.Kamseen
D
16

I used emacs variable customization, invoked with C-h v ediff-split-window-function to change the value. After clicking Save for future sessions the following was written to my .emacs:

(custom-set-variables
...
 '(ediff-split-window-function (quote split-window-horizontally))
...)

And it does exactly what I want: putting the two buffers side-by-side. And yes, emacs uses horizontal/vertical in the opposite of what you had in mind. If you read this question again, you will see the explanation, others were confused, too.

Damp answered 21/3, 2012 at 13:30 Comment(2)
It might be clearer to use split-window-right. split-window-horizontally is an alias for split-window-right, the command typically bound to C-x 3. The documentation for both state, "Split the selected window into two side-by-side windows." I understand this probably changed in the 7 years since your response.Zambrano
I have progressed to spacemacs in the mean time where the horizontal splitting is the default and no customization is neededDamp
B
15

Hitting "|" when you are in ediff mode with the 2 files loaded switches from horizontal to vertical.
"?" gives a little ediff help menu. (I'm on Debian Wheezy with emacs 23.4+1-4)

Borderer answered 9/12, 2013 at 18:2 Comment(0)
K
1

While it doesn't quite answer your problem, you could also use a function to specify whether to split vertically or horizontally depending on window dimensions:

(setq ediff-split-window-function 'split-window-sensibly)

split-window-sensibly is built-in.

Kaph answered 9/5, 2015 at 16:46 Comment(1)
This doesn't work for me. split-window-sensibly takes a window as an argument, while split-window-horizontally takes a size. This causes errors when Ediff tries to split the window.Tanner

© 2022 - 2024 — McMap. All rights reserved.