Mercurial > emacs
diff lisp/diff-mode.el @ 96854:b9de9e7dceed
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.
| author | Thien-Thi Nguyen <ttn@gnuvola.org> |
|---|---|
| date | Mon, 21 Jul 2008 14:20:24 +0000 |
| parents | e5a55b8c9892 |
| children | c80b0289ddf5 |
line wrap: on
line diff
--- a/lisp/diff-mode.el Mon Jul 21 07:27:52 2008 +0000 +++ b/lisp/diff-mode.el Mon Jul 21 14:20:24 2008 +0000 @@ -91,11 +91,6 @@ :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 @@ `((,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 @@ ;; 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
