branch: externals/vc-got commit c151c257bb0f660fb7b52a1b7823c0831d320a2c Author: Omar Polo <o...@omarpolo.com> Commit: Omar Polo <o...@omarpolo.com>
implement vc-got-find-file-hook automatically activate smerge-mode when visiting a got-controlled file with conflicts. --- vc-got.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/vc-got.el b/vc-got.el index 3986a31..6bf63b7 100755 --- a/vc-got.el +++ b/vc-got.el @@ -102,7 +102,7 @@ ;; - check-headers NOT NEEDED, `got' does not use headers ;; - delete-file DONE ;; - rename-file NOT NEEDED, `delete' + `register' is enough -;; - find-file-hook NOT NEEDED, no need for hooks yet +;; - find-file-hook DONE ;; - extra-menu NOT IMPLEMENTED, add `import', `integrate', `stage'? ;; - extra-dir-menu NOT IMPLEMENTED, same as above ;; - conflicted-files DONE @@ -766,6 +766,17 @@ Value is returned as floating point fractional number of days." "Delete FILE locally and mark it deleted in work tree." (vc-got--remove file t)) +(defun vc-got-find-file-hook () + "Activate `smerge-mode' if there is a conflict." + ;; just like vc-git-find-file-hook + (when (and buffer-file-name + (eq (vc-state buffer-file-name 'Got) 'conflict) + (save-excursion + (goto-char (point-min)) + (re-search-forward "^<<<<<<< " nil 'noerror))) + (smerge-start-session) + (vc-message-unresolved-conflicts buffer-file-name))) + (defun vc-got-conflicted-files (dir) "Return the list of files with conflicts in directory DIR." (let* ((root (vc-got-root dir))