Questions tagged [diff-mode]

23 questions
27
votes
2 answers

How to show a diff between two buffers with "character-level" diffs

When two buffers are compared for differences, M-x ediff-buffers does not indicate the specific characters that have changed within a word (ie "character-level" diffs). Most modern diff tools will show the diffs within a word. Emacs seems to be…
modulitos
  • 2,432
  • 1
  • 18
  • 36
9
votes
2 answers

Override `show-trailing-whitespace` in `diff-mode`

I have show-trailing-whitespace set to t globally in my .emacs file, and this is generally not a problem except for when I'm in diff-mode looking at a patch which has mandatory trailing white space for blank context lines. One solution would be to…
b4hand
  • 1,995
  • 1
  • 19
  • 31
7
votes
1 answer

Is there a way to revert only certain lines from a diff hunk?

I use the builtin VC package and it's very nice that when I do a diff of changes in the current file then I can revert any hunk in the diff quickly with C-a But sometimes I don't want to revert the whole hunk, only certain lines and keep other…
Tom
  • 1,190
  • 7
  • 16
5
votes
3 answers

Is it possible to revert a hunk in diff-mode?

With viewing a diff for a modified working copy, is there a way to revert the hunk under the cursor? That is, reverse the change shown in the diff, making the changes to source-file the diff refers to. Ideally it would refresh the diff too, although…
ideasman42
  • 8,375
  • 1
  • 28
  • 105
5
votes
1 answer

diff-mode use fringes

So currently diff-mode outputs standard git patches, something like @@ -8,6 +8,8 @@ -foo bar +baz I.e. the + and - are part of the buffer text. Sometimes I would find it convenient if the +/- was displayed in the left FRINGE instead of as part of…
4
votes
1 answer

Jump to file and line number in grep file

$ grep -nrH would . | tee file.txt $ emacs file.txt If I have a buffer with grep search results, how can I make Emacs jump to the file and line number on the cursor line, similar to diff-goto-source in diff-mode? ./path/to/my/one.txt:1234 RMS and…
forthrin
  • 451
  • 2
  • 10
3
votes
2 answers

diff-mode: refine all hunks when opening a diff file?

diff-mode provides diff-refine-hunk function to refine the highlighting of the current hunk. However, by default, only diff-hunk-next or explicit diff-refine-hunk calls will do this job -- hunks will not be refined by default. I wrote the following…
xuhdev
  • 1,839
  • 13
  • 26
3
votes
1 answer

Sexp-diff like mode for elisp source diffing

diff-mode shows differences by lines. I'm looking for a mode that could show a diff knowing that the diffed files are elisp sources, so they are full of sexps and therefore more specialized diff highlight could be used. Is there a mode to show a…
Gracjan Polak
  • 1,082
  • 6
  • 21
3
votes
1 answer

apply full diff in Diff-Mode?

Emacs has a really nice mode for applying and navigating hunks of a diff file: Diff-Mode However, there doesn't seem to be a way to apply the full diff when in this mode. Is this just so obvious that I missed it?
fommil
  • 1,750
  • 11
  • 24
2
votes
1 answer

Syntactic fontification of diff hunks

I'm looking for a multiple-major-modes package that doesn't remove fontification of the host mode from its inner submodes? I tried MMM Mode and Polymode, but they remove the initial fontification and put own faces with own background colors in…
link0ff
  • 1,081
  • 5
  • 14
2
votes
1 answer

how to deal with mixed line endings in diff-mode

Say I have several files with different line endings (i.e. some have LF and others have CR+LF). If I somehow run diff on them and load the diff into Emacs (e.g. with C-x v D, or just dumping the diff to a file and visiting it), I get mixed line…
jpkotta
  • 498
  • 2
  • 11
2
votes
2 answers

how to properly capture `diff` output in buffer (without first opening a file)?

summary If one captures diff output to a file name=*.diff and opens that file in a buffer, one gets nicely-formatted mode=Diff. How to get that directly, without first capturing to a file? details I use diff a lot, not only via ediff-buffers (which…
TomRoche
  • 592
  • 3
  • 20
2
votes
2 answers

ediff - change colors and how to merge code

first question: is how to adjust colors of ediff-revision output, tried various versions - no luck: ;; Customizing colors used in diff mode (load-library "ediff") (setq ediff-window-setup-function 'ediff-setup-windows-plain) (setq…
DmitrySemenov
  • 271
  • 3
  • 9
1
vote
0 answers

diff-mode: how to highlight whitespace characters?

with emacs -Q, I can use M-x whitespace-mode : But in diff-mode, if I use M-x whitespace-mode this is what I get: you can see the tabs/space/newlines aren't shown (highlighted). How can I make diff-mode show whitespace like first image?
John Doe
  • 159
  • 6
1
vote
0 answers

whitespace-mode does not display hidden characters in a patch file

I have a patch file on which if I do cat -A , I get : if (zif->rtadv.AdvIntervalOption)$ {$ struct nd_opt_adv_interval *ndopt_adv = $ ^I(struct nd_opt_adv_interval *)(buf + len);$ But on emacs with whitespace-mode enabled I do not see…
John Doe
  • 159
  • 6
1
2