unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 23.0.60; Suggestion for vc-git.el: allow me to specify options to vc-git
@ 2008-02-03  0:51 Eric Hanchrow
  2008-02-03  4:07 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Hanchrow @ 2008-02-03  0:51 UTC (permalink / raw)
  To: emacs-pretest-bug

I just did C-x v = on some (git-controlled) file on which I'd lightly
hacked, and was surprised to see a lot of output, most of it displaying
sections of the file that I didn't recall touching.  Turns out I've told
Emacs to strip trailing whitespace upon saving, and that's what I was
seeing.  But I wanted to just see the edits I made intentionally, so I
easily enough found the --ignore-space-change option to git-diff.  What
I didn't find was a way to get Emacs to _use_ that option.  What I
finally did was

    diff --git a/lisp/vc-git.el b/lisp/vc-git.el
    index 7920fec..3d4197f 100644
    --- a/lisp/vc-git.el
    +++ b/lisp/vc-git.el
    @@ -324,9 +324,9 @@ or BRANCH^ (where \"^\" can be repeated)."
     (defun vc-git-diff (files &optional rev1 rev2 buffer)
       (let ((buf (or buffer "*vc-diff*")))
         (if (and rev1 rev2)
    -        (vc-git-command buf 1 files "diff-tree" "--exit-code" "-p"
    +        (vc-git-command buf 1 files "diff-tree" "--exit-code" "--ignore-space-change" "-p"
                             rev1 rev2 "--")
    -      (vc-git-command buf 1 files "diff-index" "--exit-code" "-p"
    +      (vc-git-command buf 1 files "diff-index" "--exit-code" "--ignore-space-change" "-p"
                           (or rev1 "HEAD") "--"))))

     (defun vc-git-revision-table (files)

... which of course is a total crock, despite it happening to please me
at the moment.

So: if there isn't already some way I can customize Emacs to do this,
could you add such a way?  (I still haven't figured out if there's a way
to simply tell "git" to always pass the --ignore-space-change option to
the diff-tree command).

Thanks.

    Eric: your commit logs appear to be coming from 
            Author: esr <esr>
    I assume that means you need to configure some dot file somewhere.

-- 
None of the ... actors do anything we couldn't do if we looked
like them.
        -- Roger Ebert, reviewing "The Chronicles Of Riddick"




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 23.0.60; Suggestion for vc-git.el: allow me to specify options to vc-git
  2008-02-03  0:51 23.0.60; Suggestion for vc-git.el: allow me to specify options to vc-git Eric Hanchrow
@ 2008-02-03  4:07 ` Thien-Thi Nguyen
  2008-02-03  7:31   ` Dan Nicolaescu
  0 siblings, 1 reply; 3+ messages in thread
From: Thien-Thi Nguyen @ 2008-02-03  4:07 UTC (permalink / raw)
  To: Eric Hanchrow; +Cc: emacs-pretest-bug

() Eric Hanchrow <offby1@blarg.net>
() Sat, 02 Feb 2008 16:51:39 -0800

   So: if there isn't already some way I can customize Emacs to do
   this, could you add such a way?  (I still haven't figured out
   if there's a way to simply tell "git" to always pass the
   --ignore-space-change option to the diff-tree command).

Below is a revised vc-git-diff from:
http://www.gnuvola.org/wip/ (see vc-git-hacking)

I use it in together w/ the ~/.emacs form:
(setq vc-git-diff-switches "--stat")

Please try it out and let me know how/where it breaks.
You will probably want to use something like:
(setq vc-git-diff-switches '("--stat" "--ignore-space-change"))

If we can get it to behave in many cases, i will install it.

thi

_____________________________________________________________
(defun vc-git-diff (files &optional rev1 rev2 buffer)
  "Backend to `vc-diff' for Git.
This respects `vc-git-diff-switches'."
  (let ((twop (and rev1 rev2)))
    (apply 'vc-git-command (or buffer "*vc-diff*") 1 files
           (if twop "diff-tree" "diff-index")
           `(,@(vc-switches 'git 'diff)
             "--exit-code" "-p"
             ,@(if twop
                   (list rev1 rev2)
                 (list (or rev1 "HEAD")))
             "--"))))




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 23.0.60; Suggestion for vc-git.el: allow me to specify options to vc-git
  2008-02-03  4:07 ` Thien-Thi Nguyen
@ 2008-02-03  7:31   ` Dan Nicolaescu
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Nicolaescu @ 2008-02-03  7:31 UTC (permalink / raw)
  To: Thien-Thi Nguyen; +Cc: Eric Hanchrow, emacs-pretest-bug

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

  > () Eric Hanchrow <offby1@blarg.net>
  > () Sat, 02 Feb 2008 16:51:39 -0800
  > 
  >    So: if there isn't already some way I can customize Emacs to do
  >    this, could you add such a way?  (I still haven't figured out
  >    if there's a way to simply tell "git" to always pass the
  >    --ignore-space-change option to the diff-tree command).
  > 
  > Below is a revised vc-git-diff from:
  > http://www.gnuvola.org/wip/ (see vc-git-hacking)
  > 
  > I use it in together w/ the ~/.emacs form:
  > (setq vc-git-diff-switches "--stat")
  > 
  > Please try it out and let me know how/where it breaks.
  > You will probably want to use something like:
  > (setq vc-git-diff-switches '("--stat" "--ignore-space-change"))
  > 
  > If we can get it to behave in many cases, i will install it.

Please forward these things to the vc-git.el author, he is super quick
to answer to all vc-git issues.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-03  7:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-03  0:51 23.0.60; Suggestion for vc-git.el: allow me to specify options to vc-git Eric Hanchrow
2008-02-03  4:07 ` Thien-Thi Nguyen
2008-02-03  7:31   ` Dan Nicolaescu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).