File: diff-mode.el.html

Provides support for font-lock, outline, navigation commands, editing and various conversions as well as jumping to the corresponding source file.

Inspired by Pavel Machek's patch-mode.el (<pavel@@atrey.karlin.mff.cuni.cz>) Some efforts were spent to have it somewhat compatible with compilation-minor-mode(var)/compilation-minor-mode(fun).

Bugs:

- Reverse doesn't work with normal diffs.

Todo:

- Improve diff-add-change-log-entries-other-window,
  it is very simplistic now.

- Add a delete-after-apply so C-c C-a automatically deletes hunks.
  Also allow C-c C-a to delete already-applied hunks.

- Try diff <file> <hunk> to try and fuzzily discover the source location
  of a hunk. Show then the changes between <file> and <hunk> and make it
  possible to apply them to <file>, <hunk-src>, or <hunk-dst>.
  Or maybe just make it into a ".rej to diff3-markers converter".
  Maybe just use wiggle (by Neil Brown) to do it for us.

- in diff-apply-hunk, strip context in replace-match to better
  preserve markers and spacing.
- Handle diff -b output in context->unified.

Defined variables (33)

diff--cached-revision-buffersList of ((FILE . REVISION) . BUFFER) in MRU order.
diff-add-log-use-relative-namesUse relative file names when generating ChangeLog skeletons.
diff-advance-after-apply-hunkNon-nil means ‘diff-apply-hunk’ will move to the next hunk after applying.
diff-ask-before-revert-and-kill-hunkIf non-nil, ‘diff-revert-and-kill-hunk’ will ask for confirmation.
diff-auto-refine-modeNon-nil if Diff-Auto-Refine mode is enabled.
diff-auto-refine-mode-hookHook run after entering or leaving ‘diff-auto-refine-mode’.
diff-default-directoryThe default directory where the current Diff buffer was created.
diff-default-read-onlyIf non-nil, ‘diff-mode’ buffers default to being read-only.
diff-font-lock-prettifyIf non-nil, font-lock will try and make the format prettier.
diff-font-lock-syntaxIf non-nil, diff hunk font-lock includes source language syntax highlighting.
diff-ignore-whitespace-switchesSwitch or list of diff switches to use when ignoring whitespace.
diff-jump-to-old-fileNon-nil means ‘diff-goto-source’ jumps to the old file.
diff-minor-modeNon-nil if Diff minor mode is enabled.
diff-minor-mode-hookHook run after entering or leaving ‘diff-minor-mode’.
diff-minor-mode-mapKeymap for ‘diff-minor-mode’. See also ‘diff-mode-shared-map’.
diff-minor-mode-prefixPrefix key for ‘diff-minor-mode’ commands.
diff-mode-abbrev-tableAbbrev table for ‘diff-mode’.
diff-mode-hookRun after setting up the ‘diff-mode’ major mode.
diff-mode-mapKeymap for ‘diff-mode’. See also ‘diff-mode-shared-map’.
diff-mode-menuMenu for ‘diff-mode’.
diff-mode-read-onlyNon-nil when read-only diff buffer uses short keys.
diff-mode-shared-mapAdditional bindings for read-only ‘diff-mode’ buffers.
diff-mode-syntax-tableSyntax table for ‘diff-mode’.
diff-read-only-mapAdditional bindings for read-only ‘diff-mode’ buffers.
diff-refineIf non-nil, enable hunk refinement.
diff-refine-nonmodifiedIf non-nil, also highlight the added/removed lines as "refined".
diff-refine-thresholdMaximum size of diff hunk that can be automatically refined.
diff-update-on-the-flyNon-nil means hunk headers are kept up-to-date on-the-fly.
diff-use-changed-faceControls how changed lines are fontified in context diffs.
diff-valid-unified-empty-lineIf non-nil, empty lines are valid in unified diffs.
diff-vc-backendThe VC backend that created the current Diff buffer, if any.
diff-vc-revisionsThe VC revisions compared in the current Diff buffer, if any.
diff-whitespace-styleSpecify ‘whitespace-style’ variable for ‘diff-mode’ buffers.

Defined functions (87)

diff--at-diff-header-p()
diff--cache-clean()
diff--filter-substring(STR)
diff--font-lock-prettify(LIMIT)
diff--font-lock-refined(MAX)
diff--font-lock-syntax(MAX)
diff--forward-while-leading-char(CHAR BOUND)
diff--get-revision-properties(FILE REVISION TEXT LINE-NB)
diff--ignore-whitespace-all-hunks()
diff--indicator-added-matcher(LIMIT)
diff--indicator-matcher-helper(LIMIT REGEXP)
diff--indicator-removed-matcher(LIMIT)
diff--iterate-hunks(MAX FUN)
diff--overlay-auto-delete(OL AFTER BEG END &optional LEN)
diff--refine-hunk(START END &optional SKIP-IF-LARGE)
diff--refine-propertize(BEG END FACE)
diff--track-changes-function(BEG END BEFORE)
diff--track-changes-signal(TRACKER)
diff-add-change-log-entries-other-window()
diff-add-log-current-defuns()
diff-apply-buffer(&optional BEG END REVERSE TEST-OR-NO-SAVE)
diff-apply-hunk(&optional REVERSE BEG END)
diff-auto-refine-mode(&optional ARG)
diff-beginning-of-file-and-junk()
diff-beginning-of-hunk(&optional TRY-HARDER)
diff-bounds-of-file()
diff-bounds-of-hunk()
diff-buffer-file-names(&optional OLD NOPROMPT)
diff-context->unified(START END &optional TO-CONTEXT)
diff-count-matches(RE START END)
diff-current-defun()
diff-delete-empty-files()
diff-delete-other-hunks(&optional BEG END)
diff-delete-trailing-whitespace(&optional OTHER-FILE)
diff-ediff-patch()
diff-end-of-hunk(&optional STYLE DONTTRUSTHEADER)
diff-file-kill(&optional DELETE)
diff-file-next(&optional COUNT)
diff-file-prev(&optional COUNT)
diff-filename-drop-dir(FILE)
diff-find-approx-text(TEXT)
diff-find-file-name(&optional OLD NOPROMPT PREFIX)
diff-find-source-location(&optional OTHER-FILE REVERSE NOPROMPT)
diff-find-text(TEXT)
diff-fixup-modifs(START END)
diff-goto-source(&optional OTHER-FILE EVENT)
diff-hunk-file-names(&optional OLD)
diff-hunk-kill()
diff-hunk-next(&optional COUNT)
diff-hunk-prev(&optional COUNT)
diff-hunk-status-msg(LINE-OFFSET REVERSED DRY-RUN)
diff-hunk-style(&optional STYLE)
diff-hunk-text(HUNK DESTP CHAR-OFFSET)
diff-ignore-whitespace-hunk(&optional WHOLE-BUFFER)
diff-kill-applied-hunks()
diff-kill-creations-deletions(&optional DELETE)
diff-kill-junk()
diff-kill-ring-save(BEG END &optional REVERSE)
diff-make-unified()
diff-merge-strings(ANCESTOR FROM TO)
diff-minor-mode(&optional ARG)
diff-mode()
diff-mode-menu(ARG1)
diff-mouse-goto-source(&optional OTHER-FILE EVENT)
diff-next-complex-hunk()
diff-next-error(ARG RESET)
diff-prev-line-if-patch-separator()
diff-refine-hunk(&optional SKIP-IF-LARGE)
diff-refresh-hunk(&optional IGNORE-WHITESPACE)
diff-restrict-view(&optional ARG)
diff-reverse-direction(START END)
diff-revert-and-kill-hunk(&optional BEG END)
diff-sanity-check-context-hunk-half(LINES)
diff-setup-buffer-type()
diff-setup-whitespace()
diff-split-hunk()
diff-syntax-fontify(BEG END)
diff-syntax-fontify-hunk(BEG END OLD)
diff-syntax-fontify-props(FILE TEXT LINE-NB &optional HUNK-ONLY)
diff-tell-file-name(OLD NAME)
diff-test-hunk(&optional REVERSE)
diff-undo(&optional ARG)
diff-unified->context(START END)
diff-wiggle()
diff-write-contents-hooks()
diff-xor(COND1 COND2)
diff-yank-function(TEXT)

Defined faces (18)

diff-added‘diff-mode’ face used to highlight added lines.
diff-changed‘diff-mode’ face used to highlight changed lines.
diff-changed-unspecified‘diff-mode’ face used to highlight changed lines.
diff-context‘diff-mode’ face used to highlight context and other side-information.
diff-error‘diff-mode’ face for error messages from diff.
diff-file-header‘diff-mode’ face used to highlight file header lines.
diff-function‘diff-mode’ face used to highlight function names produced by "diff -p".
diff-header‘diff-mode’ face inherited by hunk and index header faces.
diff-hunk-header‘diff-mode’ face used to highlight hunk header lines.
diff-index‘diff-mode’ face used to highlight index header lines.
diff-indicator-added‘diff-mode’ face used to highlight indicator of added lines (+, >).
diff-indicator-changed‘diff-mode’ face used to highlight indicator of changed lines.
diff-indicator-removed‘diff-mode’ face used to highlight indicator of removed lines (-, <).
diff-nonexistent‘diff-mode’ face used to highlight nonexistent files in recursive diffs.
diff-refine-addedFace used for added characters shown by ‘diff-refine-hunk’.
diff-refine-changedFace used for char-based changes shown by ‘diff-refine-hunk’.
diff-refine-removedFace used for removed characters shown by ‘diff-refine-hunk’.
diff-removed‘diff-mode’ face used to highlight removed lines.