2

For instance, say that I have a two-window vertical split. If I call ediff-buffers from the right window, it will swap the right and the left window for the diff, and even leave it like that afterwards.

I'd like ediff to try to keep the buffers in the same order during the diff. Is there already some setting that does this?

2
  • You might have to write a custom function, then tell ediff to use it by customizing ediff-window-setup-function Dec 16, 2014 at 16:12
  • Yes, that's a given. But maybe there's already some little-known (require 'ediff-foobar) that does this. That's why I'm asking.
    – abo-abo
    Dec 16, 2014 at 16:17

1 Answer 1

1

Since there were no replies so far, apparently there's no magical solution.

Here's the solution I went with:

(apply #'ediff-regions-internal
           `(,@(if (equal (selected-window)
                          (lispy--vertical-splitp))
                   (append e1 e2)
                   (append e2 e1))
               nil ediff-regions-linewise nil nil))

A utility function that might be of use to others:

(defun lispy--vertical-splitp ()
  "Return nil if the frame isn't two vertical windows.
In case it is, return the left window."
  (let ((windows (window-list)))
    (when (= (length windows) 2)
      (let ((wnd1 (car windows))
            (wnd2 (cadr windows)))
        (when (= (window-pixel-top wnd1)
                 (window-pixel-top wnd2))
          (if (< (window-pixel-left wnd1)
                 (window-pixel-left wnd2))
              wnd1
            wnd2))))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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