.emacs.d

My Emacs configuration files.
Log | Files | Refs | README

commit 44c8cd191fcd99bc8ef11fee9f9cbd6f86f622fb
parent f2a3b3d729dadfb87983034dba58761e1acc72fa
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Tue, 18 Apr 2017 11:06:51 -0400

Put ediff configurations in a setup file.

Diffstat:
Minit.el | 18++++--------------
Alisp/setup-ediff.el | 37+++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/init.el b/init.el @@ -98,24 +98,14 @@ ;; Setup key bindings (require 'key-bindings) -;; Setup key bindings +;; Setup Editorconfig (require 'setup-editorconfig) -;; Setup key bindings +;; Setup Company mode (require 'setup-company-mode) -;; Ediff -;; Source <https://oremacs.com/2015/01/17/setting-up-ediff/> -(defmacro csetq (variable value) - `(funcall (or (get ',variable 'custom-set) - 'set-default) - ',variable ,value)) - -(csetq ediff-window-setup-function 'ediff-setup-windows-plain) -(csetq ediff-split-window-function 'split-window-horizontally) -(csetq ediff-diff-options "-w") -;; (winner-mode) -;; (add-hook 'ediff-after-quit-hook-internal 'winner-undo) +;; Setup Company mode +(require 'setup-ediff) ;; Bookmarks ;; To have emacs open bookmarks on startup diff --git a/lisp/setup-ediff.el b/lisp/setup-ediff.el @@ -0,0 +1,37 @@ +;; Ediff Config + +;; Source <https://oremacs.com/2015/01/17/setting-up-ediff/> +(defmacro csetq (variable value) + `(funcall (or (get ',variable 'custom-set) + 'set-default) + ',variable ,value)) + +(csetq ediff-window-setup-function 'ediff-setup-windows-plain) +(csetq ediff-split-window-function 'split-window-horizontally) +(csetq ediff-diff-options "-w") +;; (winner-mode) +;; (add-hook 'ediff-after-quit-hook-internal 'winner-undo) + +;; Press e in dired-mode to immediately ediff two marked files +;; -*- lexical-binding: t -*- +(defun ora-ediff-files () + (interactive) + (let ((files (dired-get-marked-files)) + (wnd (current-window-configuration))) + (if (<= (length files) 2) + (let ((file1 (car files)) + (file2 (if (cdr files) + (cadr files) + (read-file-name + "file: " + (dired-dwim-target-directory))))) + (if (file-newer-than-file-p file1 file2) + (ediff-files file2 file1) + (ediff-files file1 file2)) + (add-hook 'ediff-after-quit-hook-internal + (lambda () + (setq ediff-after-quit-hook-internal nil) + (set-window-configuration wnd)))) + (error "no more than 2 files should be marked")))) + +(provide 'setup-ediff)