From e7506f4e5d5e2d270280675d4f866eb33a32dca2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 4 Sep 2024 14:04:04 -0400 Subject: Always try to open files in smerge mode --- emacs/.emacs.d/init.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 95ea94b..c14287b 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -142,6 +142,16 @@ (add-hook 'magit-pre-refresh-hook 'diff-hl-magit-pre-refresh) (add-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh) +;; Always try to open files in smerge mode if they seem to have conflicts +(defun smerge-try-smerge () + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^<<<<<<< " nil t) + (require 'smerge-mode) + (smerge-mode 1)))) +(add-hook 'find-file-hook 'smerge-try-smerge t) +(add-hook 'after-revert-hook 'smerge-try-smerge t) + ;;; Variables (custom-set-variables -- cgit v1.2.1