Created
October 11, 2012 20:55
-
-
Save amalloy/3875422 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(defvar reenable-paredit-modes | |
'(emacs-lisp-mode clojure-mode lisp-mode) | |
"Modes to automatically re-enable paredit for after fixing version-control conflict markers") | |
(put 'unresolved-conflict 'error-conditions '(unresolved-conflict error)) | |
(put 'unresolved-conflict 'error-message "Unresolved conflict markers in file") | |
(defun mark-git-conflict-resolved () | |
(interactive) | |
(when (apply #'derived-mode-p reenable-paredit-modes) | |
(paredit-mode t)) ;; will fail and abort if parens are unbalanced | |
(if (save-excursion | |
(beginning-of-buffer) | |
(re-search-forward "[<=>]\\{7\\}" nil t)) | |
(let ((error-location (match-beginning 0))) | |
(goto-char error-location) | |
(signal 'unresolved-conflict (list error-location))) | |
(save-buffer) | |
(shell-command (concat "git add " (buffer-file-name))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment