From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Christoph Scholtes <cschol2112@googlemail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: New function: vc-ediff
Date: Sun, 27 Mar 2011 16:58:23 -0400 [thread overview]
Message-ID: <jwvpqpce1c8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <86ipvbdaoq.fsf@gmail.com> (Christoph Scholtes's message of "Mon, 21 Mar 2011 22:46:29 -0600")
> I cleaned up the patch and also updated Changelogs, NEWS and manual.
> +@findex vc-ediff
> +The function @code{vc-ediff} works similar to @code{vc-diff} and
> +provides a way to visually compare two revisions of a file an Ediff
^^^
in?
> +2011-03-22 Christoph Scholtes <cschol2112@googlemail.com>
> +
> + * vc/ediff-vers.el (ediff-revision-internal): New
> + function. Factored out interface to ediff-revision without user
> + interaction.
> +
> + * vc/ediff.el: Require ediff-vers (for ediff-revision-internal).
> + (ediff-revision): Use new function ediff-revision-internal.
> +
> + * vc/vc.el (vc-ediff): New function. Provides functionality
> + similar to vc-diff using ediff backend.
No need to give any detail about a new function's purpose, just "New
function" is enough: the source code should explain the purpose (either
self-evidently or via comments&docstrings).
Also, remove the empty lines to make it clear that those three file-changes
go together.
> +(defun ediff-revision-internal (rev1 rev2 &optional startup-hook)
> + ;; Call backend-specific ediff function. Uses `vc.el' or `rcs.el'
> + ;; depending on `ediff-version-control-package'."
> + (funcall
> + (intern (format "ediff-%S-internal" ediff-version-control-package))
> + rev1 rev2 startup-hook))
I think this is not needed.
> === modified file 'lisp/vc/ediff.el'
> --- lisp/vc/ediff.el 2011-01-25 04:08:28 +0000
> +++ lisp/vc/ediff.el 2011-03-22 03:08:42 +0000
> @@ -120,7 +120,8 @@
> (eval-when-compile
> (require 'dired)
> (require 'ediff-util)
> - (require 'ediff-ptch))
> + (require 'ediff-ptch)
> + (require 'ediff-vers))
> ;; end pacifier
> (require 'ediff-init)
> @@ -1435,10 +1436,7 @@
> (format "Revision 2 to compare (default %s's current state): "
> (file-name-nondirectory file))))
> (ediff-load-version-control)
> - (funcall
> - (intern (format "ediff-%S-internal" ediff-version-control-package))
> - rev1 rev2 startup-hooks)
> - ))
> + (ediff-revision-internal rev1 rev2 startup-hooks)))
If we don't need ediff-revision-internal then I think the above changes
can also be dropped.
> +(defun vc-ediff (historic &optional not-urgent)
> + "Display diffs between revisions of a file using ediff.
> +Normally this compares the currently selected file with its
> +working revision. With the prefix argument HISTORIC, it reads two revision
> +designators specifying which revisions to compare.
> +
> +The optional argument NOT-URGENT non-nil means it is ok to say no
> +to saving the buffer."
> + (interactive (list current-prefix-arg t))
> + (when buffer-file-name (vc-buffer-sync not-urgent))
> + (let* ((vc-fileset (vc-deduce-fileset not-urgent))
> + (files (cadr vc-fileset))
> + (first (car files)))
> + (cond
> + ;; FIXME: Only supports one selected file (for now?).
> + ;; Alternatively, we could spin off a separate ediff session
> + ;; for each of the selected files.
> + ((= (length files) 1)
> + (if historic
> + ;; Let user select revisions to compare.
> + (ediff-revision first)
Problem with this code is that you depend on ediff-revision to get
the revision arguments. E.g. this doesn't provide completion.
IOW we should use more of vc-diff's code here.
> + (find-file first)
> + ;; With empty arguments, function compares latest version of
> + ;; current buffer's file with current buffer.
> + (ediff-revision-internal "" "")))
Call ediff-vc-internal here.
Stefan
next prev parent reply other threads:[~2011-03-27 20:58 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-10 4:20 New function: vc-ediff Christoph Scholtes
2011-03-10 16:00 ` Stefan Monnier
2011-03-11 4:38 ` Christoph Scholtes
2011-03-11 20:15 ` Stefan Monnier
2011-03-12 8:38 ` Eli Zaretskii
2011-03-12 15:05 ` Christoph Scholtes
2011-03-12 17:49 ` Eli Zaretskii
2011-03-12 20:44 ` Stefan Monnier
2011-03-12 20:48 ` Eli Zaretskii
2011-03-12 21:27 ` Stefan Monnier
2011-03-19 2:24 ` Christoph Scholtes
2011-03-20 2:45 ` Stefan Monnier
2011-03-22 4:46 ` Christoph Scholtes
2011-03-27 16:03 ` Christoph Scholtes
2011-03-27 20:58 ` Stefan Monnier [this message]
2011-03-29 2:42 ` Christoph Scholtes
2011-03-29 13:46 ` Stefan Monnier
2011-03-30 3:02 ` Christoph Scholtes
2011-04-08 1:16 ` Christoph Scholtes
2011-04-17 19:04 ` Christoph Scholtes
2011-04-20 17:39 ` Stefan Monnier
2011-04-20 22:20 ` Christoph Scholtes
2011-03-13 16:16 ` Uday S Reddy
2011-03-13 18:01 ` Eli Zaretskii
2011-03-13 21:35 ` Stefan Monnier
2011-03-13 22:58 ` Christoph Scholtes
2011-03-12 15:11 ` Christoph Scholtes
2011-03-12 21:25 ` Stefan Monnier
2011-03-11 4:12 ` Michael Welsh Duggan
2011-03-11 4:44 ` Christoph Scholtes
2011-03-11 7:46 ` Uday S Reddy
2011-03-11 8:16 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvpqpce1c8.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=cschol2112@googlemail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.