How do I highlight CVS changes in Emacs?
Asked Answered
S

4

6

I'm using emacs with cvs and have cvs mode enabled. I'd like to get line-by-line highlighting of changes from the latest version in CVS. I've seen this done in intellij where there is a green indication for lines added and another indication for lines modified and a third symbol for lines deleted.

Is there a cvs highlighting mode for emacs to show changes from the latest version of cvs? I'm not looking for a cvs diff type functionality that would open in a new buffer, but something that would indicate in my current buffer what lines have been modified.

In the following image there is a blue rectangle on the left side in what Intellij calls the "gutter" to indicate that the code is different than what is in source control.

intellij example
(source: jetbrains.com)

I'm looking for similar functionality in emacs.

Smelly answered 25/2, 2009 at 21:39 Comment(1)
please s/cvs/vcs so we get an answer for any git/bzr/hg/svn...Heinous
S
3

You can now check out diff-hl, which provides highlighting on the left window fringe.

So far I've tested it only on a few modern DVCSes, but if you're still using CVS, and it doesn't work as well, please file an issue.

Stavanger answered 26/6, 2012 at 11:45 Comment(0)
S
2

Here's another answer that doesn't do what you want either, but may be useful.

C-x v g 

runs the command vc-annotate.

That'll pop up a new buffer (I know, you didn't want one), but it'll have all the lines marked with who touched them when. And, bonus, they're color coded with a heatmap (red is most recent, blue is least), for easy identification of recent changes.

Of course the built-in version of vc-annotate doesn't scroll the buffer appropriately, so you'll want this advice:

(defadvice vc-annotate (around vc-annotate-and-scroll)
  "scroll buffer to view current line in the annotated buffer"
  (let ((pos (count-lines (point-min) (point))))
    ad-do-it
    (let ((orig-window (selected-window))
          (window (other-window-for-scrolling)))
      (select-window window)
      (goto-line pos)
      (select-window orig-window))))

(ad-activate 'vc-annotate)
Sauls answered 26/2, 2009 at 0:21 Comment(1)
It has been usefull at least to me :)Phony
E
1

You want vc-diff, which is on C-x v = by default. This gives you raw diff output in a temp buffer. The buffer uses diff-mode, which has a few neat tricks ... for example, you can use C-c C-e to apply the diff as a patch to another file. Use describe-mode (C-h m by default) in the diff buffer to find the other tricks.

Earphone answered 26/2, 2009 at 2:38 Comment(0)
A
0

Perhaps you'd like Ediff, which appears to do exactly what you want.

Accelerator answered 25/2, 2009 at 23:6 Comment(2)
Not exactly what I am looking for. I want a minor mode so it can always be on when editing code. I also want to compare directly against CVS without getting a second local copy of the original version.Smelly
How does IntelliJ handle this? It seems like what you're asking is awfully expensive...Accelerator

© 2022 - 2024 — McMap. All rights reserved.