diff options
author | Thien-Thi Nguyen <ttn@gnuvola.org> | 2008-07-21 14:20:24 +0000 |
---|---|---|
committer | Thien-Thi Nguyen <ttn@gnuvola.org> | 2008-07-21 14:20:24 +0000 |
commit | 00546c7f3c6fd4fc8e438ce8ce55f534656baf87 (patch) | |
tree | 7811ef0b314fd410b968ab498b70c5582c80f948 /lisp/diff-mode.el | |
parent | 3d988af3c347eb1c8be251432c3a55c14dd49bc3 (diff) | |
download | emacs-00546c7f3c6fd4fc8e438ce8ce55f534656baf87.tar.gz |
Make auto-refining a minor mode, and diff- and smerge- use it.
* diff-mode.el (diff-auto-refine): Delete defcustom.
(diff-auto-refine-mode): New func/var via define-minor-mode.
Update var ref to use diff-auto-refine-mode.
* smerge-mode.el (diff-mode): Require when compiling.
(smerge-auto-refine): Delete defcustom.
Update smerge-auto-refine ref to use diff-auto-refine-mode.
Diffstat (limited to 'lisp/diff-mode.el')
-rw-r--r-- | lisp/diff-mode.el | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index 864d74b4e30..da1cd30198f 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -91,11 +91,6 @@ when editing big diffs)." :type 'boolean :group 'diff-mode) -(defcustom diff-auto-refine t - "Automatically highlight changes in detail as the user visits hunks." - :type 'boolean - :group 'diff-mode) - (defcustom diff-mode-hook nil "Run after setting up the `diff-mode' major mode." :type 'hook @@ -220,6 +215,13 @@ when editing big diffs)." `((,diff-minor-mode-prefix . ,diff-mode-shared-map)) "Keymap for `diff-minor-mode'. See also `diff-mode-shared-map'.") +(define-minor-mode diff-auto-refine-mode + "Automatically highlight changes in detail as the user visits hunks. +When transitioning from disabled to enabled, +try to refine the current hunk, as well." + :group 'diff-mode :init-value t :lighter " Auto-Refine" + (when diff-auto-refine-mode + (condition-case-no-debug nil (diff-refine-hunk) (error nil)))) ;;;; ;;;; font-lock support @@ -528,7 +530,7 @@ but in the file header instead, in which case move forward to the first hunk." ;; Define diff-{hunk,file}-{prev,next} (easy-mmode-define-navigation diff-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view - (if diff-auto-refine + (if diff-auto-refine-mode (condition-case-no-debug nil (diff-refine-hunk) (error nil)))) (easy-mmode-define-navigation |