Files
emacs.d/site-lisp/smerge.el
Ralf Zerres dfd4317d2d emacs.d: initial config version
- starting init.el
  just basics (package, use-package, path-handlin)
- include my-site-start.el
  that includes site-start.d directory and imports
  all *.el files in lexical order
- functionality is imported via use-package inside
  the *.el file
  (first run: internet connection is needed to MELPA)
2020-06-03 22:24:55 +02:00

49 lines
2.0 KiB
EmacsLisp

;;; 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 <http://www.gnu.org/licenses/>.
;;; 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))