emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Add smerge-mode, conflicted-files support to vc-git.


From: Stefan Monnier
Subject: Re: [PATCH] Add smerge-mode, conflicted-files support to vc-git.
Date: Sat, 11 Jan 2014 21:52:23 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> +(defun vc-git-find-file-hook ()
> +  "Activate `smerge-mode' if there is a conflict."
> +  (when (and buffer-file-name
> +             (vc-git-conflicted-files buffer-file-name)
> +             (save-excursion
> +               (goto-char (point-min))
> +               (re-search-forward "^<<<<<<< " nil 'noerror)))

This is the main problem, of course.  It means running git twice per
file rather than once.  We could probably improve this by only calling
vc-git-conflicted-files if the file is under Git's control and only if
it's locally modified.  If you can think of some other check we could do
to call the file even less frequently, that'd be even better.

Also, I think the check shouldn't be in find-file-hook but in
vc-git-state (so as to return `conflicted' state).

I haven't looked in detail at the patch but did notice also that
vc-git-conflicted-files is documented to take a `directory' as argument
whereas here you call it with a file name.


        Stefan



reply via email to

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