emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master b5b0e05: Call `smerge-start-session' even when deal


From: Dmitry Gutov
Subject: [Emacs-diffs] master b5b0e05: Call `smerge-start-session' even when dealing with a stash conflict
Date: Sun, 19 Apr 2015 19:27:34 +0000

branch: master
commit b5b0e0500eb6fac1b0b2e9ca4da08826225b010b
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Call `smerge-start-session' even when dealing with a stash conflict
    
    * lisp/vc/vc-git.el (vc-git-find-file-hook):
    Call `smerge-start-session' even when dealing with a stash
    conflict (bug#20292).
---
 lisp/vc/vc-git.el |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 8f7015e..bec36fd 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -792,21 +792,26 @@ This prompts for a branch to merge from."
 
 (defun vc-git-find-file-hook ()
   "Activate `smerge-mode' if there is a conflict."
-  (when (and buffer-file-name
-             ;; FIXME
-             ;; 1) the net result is to call git twice per file.
-             ;; 2) v-g-c-f is documented to take a directory.
-             ;; 
http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01126.html
-             (vc-git-conflicted-files buffer-file-name)
-             (save-excursion
-               (goto-char (point-min))
-               (and (re-search-forward "^>>>>>>> " nil 'noerror)
-                    ;; Stashes are tricky (bug#20292).
-                    (not (looking-at "Stashed changes")))))
-    (vc-file-setprop buffer-file-name 'vc-state 'conflict)
-    (smerge-start-session)
-    (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local)
-    (message "There are unresolved conflicts in this file")))
+  (let (stashed)
+    (when (and buffer-file-name
+               ;; FIXME
+               ;; 1) the net result is to call git twice per file.
+               ;; 2) v-g-c-f is documented to take a directory.
+               ;; 
http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01126.html
+               ;; XXX: Should we first look for the markers, and only
+               ;; call this function when see some?
+               (vc-git-conflicted-files buffer-file-name)
+               (save-excursion
+                 (goto-char (point-min))
+                 (when (re-search-forward "^>>>>>>> " nil 'noerror)
+                   (setq stashed (looking-at "Stashed changes"))
+                   t)))
+      (vc-file-setprop buffer-file-name 'vc-state 'conflict)
+      (smerge-start-session)
+      (unless stashed
+        ;; Stashes are tricky (bug#20292).
+        (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local))
+      (message "There are unresolved conflicts in this file"))))
 
 ;;; HISTORY FUNCTIONS
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]