Created
November 6, 2017 09:20
-
-
Save unhammer/f3ad4caaf587943b98b32afd717d326a to your computer and use it in GitHub Desktop.
ediff on clones
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; See http://www.emacswiki.org/emacs/EdiffMode#toc2 | |
(setq ediff-window-setup-function ; I hate having multiple frames | |
'ediff-setup-windows-plain) | |
(setq ediff-split-window-function (lambda (&optional arg) | |
(if (> (frame-width) 156) | |
(split-window-horizontally arg) | |
(split-window-vertically arg)))) | |
(defun ediff--regions-samebuffer (ediff-regions &optional startup-hooks) | |
(let ((cloned-buffer (clone-indirect-buffer-other-window nil t))) | |
(unwind-protect | |
(funcall ediff-regions (current-buffer) cloned-buffer startup-hooks) | |
(kill-buffer cloned-buffer)))) | |
(defun ediff-regions-wordwise-samebuffer (&optional startup-hooks) | |
(interactive) | |
(ediff--regions-samebuffer #'ediff-regions-wordwise startup-hooks)) | |
(defun ediff-regions-linewise-samebuffer (&optional startup-hooks) | |
(interactive) | |
(ediff--regions-samebuffer #'ediff-regions-linewise startup-hooks)) | |
(global-set-key (kbd "C-x =") #'ediff-regions-linewise-samebuffer) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment