UniDiffMode

Last edit

Summary: added CategoryComparing

Added:

> CategoryComparing


This package is used to edit unified format patches, like those generated by diff -u or the CVS diff command.

You can use it to review your patch after you have created it, to remove unwanted portions, to regenerate other portions, reverse them, etc.

Note: there is a more generic mode and with a better integration with Emacs, diff-mode, that also handles unified format patches. That is probably what you really want to use unless you need some specific feature of unidiff-mode, like patch regeneration.

Emacs lisp code: Lisp:unidiff.el.

To install it, add the following to your .emacs:

  (setq auto-mode-alist (cons '("\\.diff$" . unidiff-mode)
                              auto-mode-alist))

and make sure to load this source file.

To have it autoloaded any time unidiff-mode is requested:

  (autoload 'unidiff-mode "/path/to/unidiff.el" nil t)

I’m not sure I understand why you compare it to ediff but not to diff-mode.el which comes with Emacs-21 as well and seems eminently related (and which I incidentally wrote ;-). – StefanMonnier

I did not know about the existence of a diff-mode at the time i wrote the package. Later I noticed the existence of a diff-mode but i wrongly assumed it did not handle the unified format (my fault).

Browsing your package I see that I have made some duplicate effort (well, at least I had some good time coding). New functionality unidiff.el seem to introduce are the restoring of the contextual position of the point (keeping the TextCursor ‘in place’) when moving from the patch to one of its source files or when applying global changes to the patch, the regeneration of the patch from the updated content of the sources and more hunk-oriented functions (reverse, canonicalize). These are probably not the most commonly requested features but I needed them when I wrote the package.

MicheleBini


See also DiffMode.


CategoryModes CategoryProgrammerUtils CategoryComparing