;;; smerge-mode.el --- Minor mode for the Meson build system files -*- lexical-binding: t; -*- ;; 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: ;; This is a minor mode to resolve via diff3. ;; Important keybindings: ;; smerge-next bound to smerge-command-prefixn to move to next conflict. ;; smerge-previous bound to smerge-command-prefixp to move to previous conflict. ;; smerge-keep-current bound to smerge-command-prefixRET to keep the version the cursor is on. ;; smerge-keep-mine bound to smerge-command-prefixm to keep your changes. ;; smerge-keep-other bound to smerge-command-prefixo to keep other changes. ;; smerge-ediff bound to smerge-command-prefixE to start an ediff session to merge the conflicts. This is same as vc-resolve-conflicts (thanks @phils and @Malabarba for pointing this out). ;;; Code: ;; Default prefix ;; I find the default prefix for smerge-mode C-c^ cumbersome ;; next lines change it to to 'C-c v' (setq smerge-command-prefix "\C-cv") ;; Enabling smerge-mode automatically (defun my-enable-smerge-maybe () (when (and buffer-file-name (vc-backend buffer-file-name)) (save-excursion (goto-char (point-min)) (when (re-search-forward "^<<<<<<< " nil t) (smerge-mode +1))))) (add-hook 'buffer-list-update-hook #'my-enable-smerge-maybe) ;;; smerge-mode.el ends here ;;(progn (mapatoms (lambda (x) (when (string-prefix-p "smerge" (symbol-name x)) (makunbound x)))) (eval-buffer))