mirror of
https://github.com/correl/dotfiles.git
synced 2025-01-07 03:00:06 +00:00
[emacs] add commandline switches for ediff mode
This commit is contained in:
parent
dd1f794de4
commit
04465c0edf
1 changed files with 24 additions and 0 deletions
24
.emacs.d/init.d/ediff.el
Normal file
24
.emacs.d/init.d/ediff.el
Normal file
|
@ -0,0 +1,24 @@
|
|||
;; Ediff
|
||||
(defun command-line-diff (switch)
|
||||
(let ((file1 (pop command-line-args-left))
|
||||
(file2 (pop command-line-args-left)))
|
||||
(ediff file1 file2)))
|
||||
|
||||
(add-to-list 'command-switch-alist '("diff" . command-line-diff))
|
||||
|
||||
(defun git-mergetool (switch)
|
||||
(let ((local (pop command-line-args-left))
|
||||
(remote (pop command-line-args-left))
|
||||
(base (pop command-line-args-left))
|
||||
(merged (pop command-line-args-left)))
|
||||
(setq ediff-quit-hook 'kill-emacs
|
||||
ediff-quit-merge-hook (lambda ()
|
||||
(let ((file ediff-merge-store-file))
|
||||
(set-buffer ediff-buffer-C)
|
||||
(write-region (point-min) (point-max) file)
|
||||
(message "Merge buffer saved in: %s" file)
|
||||
(set-buffer-modified-p nil)
|
||||
(sit-for 1))))
|
||||
(emerge-files-with-ancestor local remote base nil merged)))
|
||||
|
||||
(add-to-list 'command-switch-alist '("mergetool" . git-mergetool))
|
Loading…
Reference in a new issue