So in ediff I can press m to widen the frame but if I quit before pressing it again to restore to the original size, then the frame stays that size. I'd like to automate this so that if I forgot to press m before quitting ediff, it will "press" m for me.

I found some elisp that claims to do this:

(add-hook 'ediff-cleanup-hook
  (lambda () (if ediff-wide-display-p 'ediff-toggle-wide-display)))

However, it doesn't seem to be having any effect. Can this be done after all?

1 Answer 1


kovrik on IRC provided me with something that works:

(defun my-toggle-ediff-wide-display ()
  "Turn off wide-display mode (if was enabled) before quitting ediff."
  (when ediff-wide-display-p

(add-hook 'ediff-cleanup-hook 'my-toggle-ediff-wide-display)

I'm new to elisp, can someone tell me why this works and not what I had? I imagine it has to do with ediff-wide-display-p having a different value when I use it in a lambda, or something to do with a buffer local variable or whatever.

  • A function is generally wrapped in parentheses, unless it is passed as an argument to another function in the form of a symbol . . .
    – lawlist
    Jul 20, 2015 at 22:25
  • Can you elaborate? How does that relate to this? What I had was a lambda, which I was told evaluates to itself. Jul 20, 2015 at 22:27
  • 2
    The problem was 'ediff-toggle-wide-display instead of (ediff-toggle-wide-display). In the add-hook example in the answer above, 'my-toggle-ediff-wide-display is being passed as an argument to add-hook in the form of a symbol.
    – lawlist
    Jul 20, 2015 at 22:28
  • Ohhh you're right, I can't believe that slipped past me. Thanks! Jul 20, 2015 at 22:51

Your Answer

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

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