From: Junio C Hamano <gitster@pobox.com>
To: Alexandre Julliard <julliard@winehq.org>
Cc: "David Kågedal" <davidk@lysator.liu.se>,
"Git Mailing List" <git@vger.kernel.org>
Subject: Re: [PATCH] git.el: Diff only file at point by default
Date: Sat, 23 Aug 2008 18:02:36 -0700 [thread overview]
Message-ID: <7v3akvw7gz.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <87vdxtpjkd.fsf@lysator.liu.se> (David Kågedal's message of "Fri, 22 Aug 2008 09:58:42 +0200")
David Kågedal <davidk@lysator.liu.se> writes:
> Use prefix (C-u) to diff all marked files instead.
>
> Signed-off-by: David Kågedal <davidk@lysator.liu.se>
> ---
> contrib/emacs/git.el | 13 +++++++++----
> 1 files changed, 9 insertions(+), 4 deletions(-)
>
> For anyone who has used pcvs (or dsvn) this makes much more sense. The
Looks sensible to me; Alexandre?
> typical usage scenario is that you want to mark the files that are
> relevant, and you do it incrementally by checking if file A is
> relevant and has no strange changes by pressing = and then marking it,
> proceeding to check file B by pressing = on it and potentially marking
> it as well and so on.
>
> The current way that = works means that you have to check each file
> first and remember which one you want to mark. Or diff everything and
> then read through the whole diff and find match the output against the
> files to mark. It is possible to do it like that as well, but it is
> much more convenient to do it as described above, and there is a
> strong precedent in emacs frontends to make the diff command only diff
> the current file by default.
>
> The old behaviour can be restored by using C-u =.
>
> diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
> index c30d20a..a3477a4 100644
> --- a/contrib/emacs/git.el
> +++ b/contrib/emacs/git.el
> @@ -772,6 +772,11 @@ Return the list of files that haven't been handled."
> (setq file (pop files))
> (setq node (ewoc-next status node))))))))
>
> +(defun git-current-file ()
> + "Return the file at point."
> + (unless git-status (error "Not in git-status buffer."))
> + (ewoc-data (ewoc-locate git-status)))
> +
> (defun git-marked-files ()
> "Return a list of all marked files, or if none a list containing just the file at cursor position."
> (unless git-status (error "Not in git-status buffer."))
> @@ -1138,10 +1143,10 @@ Return the list of files that haven't been handled."
> (when (eq (window-buffer) (current-buffer))
> (shrink-window-if-larger-than-buffer)))
>
> -(defun git-diff-file ()
> - "Diff the marked file(s) against HEAD."
> - (interactive)
> - (let ((files (git-marked-files)))
> +(defun git-diff-file (arg)
> + "Diff the marked file(s) against HEAD, or the marked files if a prefix arg is given."
> + (interactive "P")
> + (let ((files (if arg (git-marked-files) (list (git-current-file)))))
> (git-setup-diff-buffer
> (apply #'git-run-command-buffer "*git-diff*" "diff-index" "-p" "-M" "HEAD" "--" (git-get-filenames files)))))
>
> --
> 1.6.0.rc2.7.gbf8a
>
>
> --
> David Kågedal
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-08-24 1:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 7:58 [PATCH] git.el: Diff only file at point by default David Kågedal
2008-08-24 1:02 ` Junio C Hamano [this message]
2008-08-25 9:30 ` Alexandre Julliard
2008-08-25 13:21 ` David Kågedal
2008-08-26 22:22 ` David Kågedal
2008-08-27 19:36 ` Junio C Hamano
2008-08-30 18:29 ` Alexandre Julliard
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=7v3akvw7gz.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=davidk@lysator.liu.se \
--cc=git@vger.kernel.org \
--cc=julliard@winehq.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).