Questions tagged [diff-mode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

diff two files in two windows

After creating a split window and using dired in each, how do I run diff to compare two files? I have looked but haven't found any clear explanation.
balanga's user avatar
  • 115
0 votes
0 answers
10 views

splits the hunk in ediff mode

Is splitting the hunk in ediff mode possible? diff-mode provides diff-split-hunk which splits the hunk at the current line. You can then apply, or reverse it with (C-u) diff-apply-hunk. Can be very ...
xpt's user avatar
  • 457
1 vote
0 answers
66 views

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-...
John Doe's user avatar
  • 169
1 vote
0 answers
39 views

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 ...
John Doe's user avatar
  • 169
1 vote
0 answers
54 views

diff-text-hunk : Hunk text not found but patch -p0 works as intended with the same patch file

When I go to my hunk and use diff-text-hunk, I see in minibuffer and Messages : Hunk text not found or with another command : diff-apply-hunk: Can’t find the text to patch But if I try on terminal ...
John Doe's user avatar
  • 169
0 votes
1 answer
195 views

How to stage selected lines / hunks in diff-mode?

Is it possible to stage changes in diff-mode? Or is this only possible with magit+ediff?
ideasman42's user avatar
  • 8,556
1 vote
1 answer
113 views

Can magit stage a hunk / selected lines in 'diff-mode'?

Is it possible to stage the current hunk or selected lines of the hunk in diff-mode? For example, when in diff-mode, what command can I run to stage the current hunk?
ideasman42's user avatar
  • 8,556
6 votes
3 answers
1k views

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 ...
ideasman42's user avatar
  • 8,556
1 vote
1 answer
222 views

How to diff against a git branch?

I'm currently using (vc-root-diff nil) however, I'd like to spesify a branch. Calling (vc-root-diff t) prompts for the revision, and the path. Is there a way to diff against a branch without, ...
ideasman42's user avatar
  • 8,556
3 votes
1 answer
106 views

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 ...
link0ff's user avatar
  • 1,166
7 votes
1 answer
984 views

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 ...
Tom's user avatar
  • 1,190
5 votes
1 answer
175 views

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 ...
Benjamin Lindqvist's user avatar
1 vote
2 answers
1k views

Change colours for character differences for diff-mode

I've changed my diff-mode colours according to this article, but the character-based differences are shown in the original(?) and very bright colours, making them quite unreadable. How do I change ...
forthrin's user avatar
  • 451
4 votes
1 answer
881 views

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 ...
forthrin's user avatar
  • 451
1 vote
1 answer
73 views

Enable diff-mode for files with diff-ish content

How do I make Emacs automatically turn on diff-mode for any file with diff-looking content, eg. --- a.txt +++ b.txt @@ -1234,56 +1234,56 @@
forthrin's user avatar
  • 451
2 votes
1 answer
315 views

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 ...
jpkotta's user avatar
  • 508
0 votes
1 answer
106 views

How to delete a diff buffer, after running 'Jump to source'?

Id like to use a diff on my repository to quickly navigate changes, without keeping the buffer open. Is it possible to make a function that runs 'Jump to source', and deletes the diff buffer? (Am ...
ideasman42's user avatar
  • 8,556
1 vote
1 answer
389 views

diff-refine-hunk with unified diff

Problem Some versions of diff (notably, busybox diff in every build of BusyBox I've seen) only produce "unified" diff format output, they don't produce the output that GNU diff produces by default. ...
mtraceur's user avatar
  • 256
3 votes
2 answers
553 views

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 ...
xuhdev's user avatar
  • 1,869
3 votes
1 answer
134 views

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 ...
Gracjan Polak's user avatar
2 votes
2 answers
621 views

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 ...
TomRoche's user avatar
  • 612
3 votes
1 answer
316 views

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 ...
fommil's user avatar
  • 1,760
2 votes
2 answers
3k views

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-...
DmitrySemenov's user avatar
27 votes
2 answers
18k views

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 ...
modulitos's user avatar
  • 2,452
9 votes
2 answers
851 views

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 ...
b4hand's user avatar
  • 1,995