;;; ravi-init-vc.el --- vc control ;; Copyright (C) 2013 ;; Author: ;; Keywords: vc ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; Version control initialization ;;; Code: ;; Git (use-package magit :bind (("" . magit-status)) :config (progn (setq-default magit-process-popup-time 10 magit-diff-refine-hunk t magit-completing-read-function (if ravi/use-helm-instead-of-ido 'helm--completing-read-default 'magit-ido-completing-read)) (setq magit-restore-window-configuration t) (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh) (defvar ravi/sync-top-level-host-extra-args "" "Extra arguments to rsync for `ravi/sync-top-level'") (defun ravi/sync-top-level () (when (and (boundp 'ravi/sync-top-level-host) (not (s-equals? (car (s-split-up-to "\\." (system-name) 1)) (car (s-split-up-to "\\." ravi/sync-top-level-host 1))))) (message "Synchronizing with %s" ravi/sync-top-level-host) (shell-command (concat "rsync -a " ravi/sync-top-level-host-extra-args " " (magit-toplevel) " " ravi/sync-top-level-host ":" (magit-toplevel))))) (add-hook 'magit-post-refresh-hook 'ravi/sync-top-level) (global-magit-file-mode 1) (unbind-key "C-x g" magit-file-mode-map) (use-package magit-svn :config (add-hook 'magit-mode-hook 'magit-svn-mode)) ) :ensure t) (use-package gitignore-mode) (use-package gitconfig-mode) (use-package git-messenger :bind ("C-x v p" . git-messenger:popup-message)) (use-package git-timemachine :bind ("C-x v t" . git-timemachine)) (use-package vc-git :bind ("C-x v f" . vc-git-grep) :ensure nil) (use-package diff-hl :config (global-diff-hl-mode)) ;; Stolen almost entirely from Fuco (Matus Goljer) (use-package ediff :config (progn (defvar my-ediff-before-config nil "Window configuration before ediff.") (defvar my-ediff-after-config nil "Window configuration after ediff.") (defun my-ediff-before-setup () "Function to be called before any buffers or window setup for ediff." (setq my-ediff-before-config (current-window-configuration)) (set-register ?b (list my-ediff-before-config (point-marker)))) (defun my-ediff-after-setup () "Function to be called after buffers and window setup for ediff." (setq my-ediff-after-config (current-window-configuration)) (set-register ?e (list my-ediff-after-config (point-marker)))) (defun my-ediff-quit () "Function to be called when ediff quits." (when my-ediff-before-config (set-window-configuration my-ediff-before-config)) ;; clean up ediff bullshit (->> (buffer-list) (-map 'buffer-name) (--select (string-match-p "\\*[Ee]diff" it)) (-map 'kill-buffer))) (add-hook 'ediff-before-setup-hook 'my-ediff-before-setup) (add-hook 'ediff-after-setup-windows-hook 'my-ediff-after-setup 'append) (add-hook 'ediff-quit-hook 'my-ediff-quit))) (provide 'ravi-init-vc) ;;; ravi-init-vc.el ends here