[Top][All Lists]

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

Re: Highlighting word diffs

From: Suvayu Ali
Subject: Re: Highlighting word diffs
Date: Sat, 18 Apr 2015 18:07:20 +0200
User-agent: Mutt/ (2014-03-12)

Hi Stefan,

On Sat, Apr 18, 2015 at 09:25:51AM -0400, Stefan Monnier wrote:
> > I wanted to use word diffs for text-modes (i.e. Org, TeX, plain text,
> > etc).  So I change diff-switches in text-mode-hook, and the output looks
> > as expected.
> I don't know how you changed diff-switches, and I don't know what this
> expected output looks like, nor which command you used to get it.

This is how I set it:

  (setq vc-git-diff-switches (list "--word-diff"))

And I use vc-diff to generate the diff.  Here is a sample of how it

  diff --git a/ b/
  index 361a6ee..33fac7c 100644
  --- a/
  +++ b/
  @@ -1,35 +1,43 @@
  #+title: [-Decay time-]{+Decay-time+} dependent acceptance
  * WInP [-Decay time-]{+Decay-time+} dependent acceptance
    :CUSTOM_ID: ch:tacc
  An ideal event selection would accept all events that are true signal
  events, and reject the rest.  Reality is different however.  Since the
  flight distance and [-decay time-]{+decay-time+} are directly 
related{{{todo(Cite eqn
  from introduction)}}}, some selection requirements related to the
  flight distance of the B_{s} meson could bias the sample of accepted
  events in [-decay time.-]{+decay-time[fn:: One might even think of this as a 
  {+efficiency function.].+}  The {+most effective+} selection [-requirement 
responsible could be any-]{+requirements are+}
  {+often designed to reject displaced vertices not associated with a+}
  {+B_{s} meson.  Which is inevitably at odds with an unbiased decay-time.+}
... and so on.

> > However the highlighting in diff-mode does not seem to work.
> I don't know how it fails to work either.

I would expect the [-text-] bits to be coloured red, and {+text+} bits
to be coloured green.  That's what I get in the terminal with:

  $ git diff --word-diff

Does that help?  Is there support for this?  If not, would it be a valid
feature request?

Thanks for any comments.


Open source is the future. It sets us free.

reply via email to

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