--- Begin Message ---
Subject: |
24.3.50; vc-ediff with prefix argument could be slightly better |
Date: |
Wed, 09 Oct 2013 10:06:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) |
Hello maintainters,
I noticed that, in a git repository, using C-u M-x vc-ediff on a single
file (a very useful command) could use a slight improvement.
You see, using C-u prompts the users for two revisions. I mostly choose
to use an ancient revision for A and the "current revision" for B. And
thats the default, which is fine.
But there is a catch. If I've not yet touched the file I'm vc-ediff'ing,
then buffer B will not be the actual buffer I'm working on, but a
read-only copy of it, which is not good for copying content over from A
to B using the ediff keys "A" and "B".
The workaround I and my colleagues currently use is to add some random
change to the file to make sure vc-ediff suggests "current source" as
the revision for B. But this is kinda akward.
I've found that the following patch fixes this behaviour, and still
makes sense to me.
João
z:/Vendor/cygwin/bin/diff.exe -c "--label"
"z:/Vendor/emacs-24.3.5/share/emacs/24.3.50/lisp/vc/vc.el" "--label" "#<buffer
vc.el>" "z:/Vendor/emacs-24.3.5/share/emacs/24.3.50/lisp/vc/vc.el"
"c:/temp/buffer-content-5840WVj"
*** z:/Vendor/emacs-24.3.5/share/emacs/24.3.50/lisp/vc/vc.el
--- #<buffer vc.el>
***************
*** 1735,1747 ****
;; if the file is not up-to-date, use working revision as older revision
((not (vc-up-to-date-p first))
(setq rev1-default (vc-working-revision first)))
! ;; if the file is not locked, use last and previous revisions as defaults
(t
(setq rev1-default (ignore-errors ;If `previous-revision' doesn't work.
(vc-call-backend backend 'previous-revision first
(vc-working-revision first))))
! (when (string= rev1-default "") (setq rev1-default nil))
! (setq rev2-default (vc-working-revision first))))
;; construct argument list
(let* ((rev1-prompt (if rev1-default
(concat "Older revision (default "
--- 1735,1746 ----
;; if the file is not up-to-date, use working revision as older revision
((not (vc-up-to-date-p first))
(setq rev1-default (vc-working-revision first)))
! ;; if the file is not locked, use last revision and current source as
defaults
(t
(setq rev1-default (ignore-errors ;If `previous-revision' doesn't work.
(vc-call-backend backend 'previous-revision first
(vc-working-revision first))))
! (when (string= rev1-default "") (setq rev1-default nil))))
;; construct argument list
(let* ((rev1-prompt (if rev1-default
(concat "Older revision (default "
Diff finished. Wed Oct 9 10:03:04 2013
--- End Message ---