2

When I issue M-x ediff-buffersI'd like ediff to create a new frame with the two buffers (and close this frame when done with the comparison). How can I customise ediff to do so?

I tried

(defun leo-ediff-before-setup ()   (make-frame)) (add-hook 'ediff-before-setup-hook 'leo-ediff-before-setup) 

but this sets the initial frame and a new frame up for the comparison.

6
  • make-frame just creates a frame displaying the current buffer. Is that what you want? Is the current buffer what you want in the new frame? Commented Sep 10, 2020 at 19:25
  • I would like ediff to use the new frame for its buffer-window arrangements plus I want ediff not to fiddle with the window layout in the old frame. Does this make sense? Commented Sep 10, 2020 at 22:42
  • 1
    Read all of C-h v ediff-window-setup-function and go from there. (You can answer your own question if you get that working.) Commented Sep 11, 2020 at 3:39
  • @phils thanks for chiming in! I've just tried to advise ediff-setup-windows-multiframe (which is called fromediff-window-setup-function) to make a frame before all the setup, but it seems to be already too late: the new frame is made, but ediff arranges the buffer still in the old frame. :-( Commented Sep 11, 2020 at 5:02
  • I believe you'll want to write a new function which does exactly what you want it to do. Commented Sep 11, 2020 at 5:02

1 Answer 1

2

The problem with the code in the question is that the newly made frame is not selected - and ediff operates on the selected frame. So, correct is:

(defun leo-ediff-before-setup () (select-frame (make-frame))) (add-hook 'ediff-before-setup-hook 'leo-ediff-before-setup) 

Of course there's more customisation needed if the frame is to be closed at the end of the ediff session.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.