13

(setq-default ediff-forward-word-function 'forward-char)


7

If you C-cC-a (diff-apply-hunk) on a hunk which has already been applied, diff-mode will detect this and ask whether you wish to reverse that change. You can also request this directly by passing a prefix argument to the command. In cases where the context is insufficient to tell whether or not the patch has been applied, the latter method would be ...


6

This feature is called "refining" in Ediff. You can hit * to refine the current hunk, or @ to turn on automatic refining whenever you move to a different hunk.


5

Magit can do this by limiting the revert action to the region. With the built-in diff-mode you can get the same kind of effect by splitting the hunk into portions using diff-split-hunk which is bound to C-c C-s by default.


4

The grep parameters you are using should be adequate. Just do M-x grep-mode after opening your results file and you should get the links you desire. You could also skip writing the grep results to a file and use a command like grep-find directly. In grep mode, n/p are bound to next-error-no-select/previous-error-no-select respectively (open the file and ...


4

There are R in diff-mode. R runs the command diff-reverse-direction Reverse the direction of the diffs. So first R and then C-c C-a to apply reversed diff. It is possible to revert individual hunk without reversing whole diff by invoking diff-aply-hunk with prefix argument. So another solution is C-u C-c C-a.


3

This is implemented now in Emacs 27 and available by default using the variable diff-font-lock-syntax.


3

The actual problem is the following form in the definition of diff-mode-hook. It removes all the refinement overlays that you created with your function my-diff-hunks-highlight-all immediately after starting up diff-mode and initializing font-lock-mode. (declare-function 'diff-hunk-next "diff-mode") (defun my-diff-refine-all () "Refine all diffs." (...


3

Sounds like a great addition, to diff-mode. It should be pretty easy to do that in the font-lock-keywords by adding some appropriate display text property which would both hide the "+" from the buffer and add it to the fringe. Contrary to @lawlist I wouldn't expect any serious performance issue. EDIT: this has since been added to Emacs-27's development ...


3

You can always write a function to do all the repeated steps for you. This should get you started: (defun diff-generic(command) (interactive "sDiff command:") (let ((buffer (generate-new-buffer "*diff-generic*"))) (with-current-buffer buffer (diff-mode)) (call-process-shell-command command nil buffer 0) (switch-to-buffer buffer))) In ...


3

Move to the coloured text you're interested in, and type C-uC-x= to view details of the character at point, including any faces. Select the face you're interested in, then select "customize this face", make the desired changes, and save.


2

The value of show-trailing-whitespace becomes buffer local when set so you can just set it in the relevant hook: (add-hook 'diff-mode-hook (lambda () (setq show-trailing-whitespace nil))) To check the documentation for show-trailing-whitespace: C-h v show-trailing-whitespace.


2

Try M-! <your diff command/> C-x b *Shell Command Output* (where the output of M-!==M-x shell-command goes by default) M-x diff-mode


2

first question: You can custom a face like this: (custom-set-faces '(ediff-current-diff-A ((t (:foreground "White" :background "brown"))))) the ediff faces are: ediff-current-diff-A ediff-current-diff-Ancestor ediff-current-diff-B ediff-current-diff-C ediff-even-diff-A ediff-even-diff-Ancestor ediff-even-diff-B ediff-even-diff-C ediff-fine-diff-A ...


2

C-h v magic-mode-alist says this: magic-mode-alist is a variable defined in files.el. Its value is nil This variable can be risky when used as a file-local variable. Documentation: Alist of buffer beginnings vs. corresponding major mode functions. Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION). After ...


2

Here are 2 functions I came up with that open a fullscreen diff and close it when jumping to the line. ;; Override pop-up-windows (defun diff-goto-source-and-close () "Go to the source and close the current diff buffer." (interactive) (let ((buf (current-buffer)) (pop-up-windows nil)) (diff-goto-source) (kill-buffer buf))) (defun vc-...


2

There are more faces involved than the ones mentioned in the link you pointed to. The answer is to use C-u C-x = to find out what faces are involved. Those are the ones you need to customize. Use M-x customize-face to customize the faces you are interested in. If you don't know which faces they are, put the cursor on that highlighted text and use C-u C-x =...


2

The following works for me when I test on two small files (i.e., there are not many diffs). (defun my-diff-hunks-highlight-all () "Highlight all hunks in diff-mode." (interactive) (run-at-time 0.1 nil (lambda () (save-excursion (goto-char (point-min)) (while (not (eobp)) ...


2

No, it is not possible. diff-mode is just for showing and editing diffs; VersionControl what gets committed, and works only with files or sets of files: [some] version control systems [...] are file-based: each file has its own [...] history [...]. [...] changeset-based [systems' commits] may include changes to several files, and the entire set of changes ...


1

Adding own answer, since diff-apply-hunk didn't do exactly what I wanted. This is a stripped down diff-apply-hunk with some modified behavior, to revert hunks without changing the context. The buffer is saved after reverting. The hunk is removed. No new windows open. It allows for quickly navigating over a diff and reverting hunks, without having to ...


1

I find that the built-in ediff serves great for diffing sexps. As soon as you ignore whitespace, the changes in sexps become very clear. (setq ediff-diff-options "-w --text") A nice command to start with is ediff-regions-wordwise, which can be used to narrow the bounds of the stuff you diff. If you want to diff two sexps very quickly in terms of keys ...


1

With diff-refine faces: (defun update-diff-refine-colors () "update the colors for diff faces" (set-face-attribute 'diff-refine-added nil :foreground "white" :background "darkgreen") (set-face-attribute 'diff-refine-removed nil :foreground "white" :background "darkred") (set-face-attribute 'diff-refine-...


1

Documenting my own crude solution for now, in case it helps anyone. I'll happily accept another answer with a better solution. My solution took the form of two parts: Wrapper shell script around BusyBox's diff, converting its unified output into traditional/"normal" output. (It's now in one of the directories in my PATH as bnudiff. I put it on GitHub it ...


1

There doesn't seem to be a function that does that. You can get that functionality by using a macro. First, hit F3 C-c C-a F4 to define a macro that applies a hunk, and then type C-u 0 M-x kmacro-call-macro to repeatedly call that macro until an error occurs (probably at the end of the diff file).


1

One solution is to turn off Trailing whitespace mode in Diff mode, and instead define your own custom font lock rules for the trailing whitespace that you don't want to see. (defvar diff-trailing-whitespace-keywords '(("^[+-<>]\\(.*\\S \\)?\\(\\s +\\)$" (2 'trailing-whitespace t)))) (defun diff-mode-font-lock-add-trailing-whitespace () (setq diff-...


Only top voted, non community-wiki answers of a minimum length are eligible