diff options
| author | Thien-Thi Nguyen | 2008-07-21 14:20:24 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2008-07-21 14:20:24 +0000 |
| commit | 7381be9dcb83efae4f0645d49a55cc38f13cb9c8 (patch) | |
| tree | 4baf43e83b8ace9329e25b3c6ccf622e5641553d /lisp/diff-mode.el | |
| parent | b737c3d96807ae991ab90808d5c090f41a202e3d (diff) | |
| download | emacs-7381be9dcb83efae4f0645d49a55cc38f13cb9c8.tar.gz emacs-7381be9dcb83efae4f0645d49a55cc38f13cb9c8.zip | |
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)." | |||
| 91 | :type 'boolean | 91 | :type 'boolean |
| 92 | :group 'diff-mode) | 92 | :group 'diff-mode) |
| 93 | 93 | ||
| 94 | (defcustom diff-auto-refine t | ||
| 95 | "Automatically highlight changes in detail as the user visits hunks." | ||
| 96 | :type 'boolean | ||
| 97 | :group 'diff-mode) | ||
| 98 | |||
| 99 | (defcustom diff-mode-hook nil | 94 | (defcustom diff-mode-hook nil |
| 100 | "Run after setting up the `diff-mode' major mode." | 95 | "Run after setting up the `diff-mode' major mode." |
| 101 | :type 'hook | 96 | :type 'hook |
| @@ -220,6 +215,13 @@ when editing big diffs)." | |||
| 220 | `((,diff-minor-mode-prefix . ,diff-mode-shared-map)) | 215 | `((,diff-minor-mode-prefix . ,diff-mode-shared-map)) |
| 221 | "Keymap for `diff-minor-mode'. See also `diff-mode-shared-map'.") | 216 | "Keymap for `diff-minor-mode'. See also `diff-mode-shared-map'.") |
| 222 | 217 | ||
| 218 | (define-minor-mode diff-auto-refine-mode | ||
| 219 | "Automatically highlight changes in detail as the user visits hunks. | ||
| 220 | When transitioning from disabled to enabled, | ||
| 221 | try to refine the current hunk, as well." | ||
| 222 | :group 'diff-mode :init-value t :lighter " Auto-Refine" | ||
| 223 | (when diff-auto-refine-mode | ||
| 224 | (condition-case-no-debug nil (diff-refine-hunk) (error nil)))) | ||
| 223 | 225 | ||
| 224 | ;;;; | 226 | ;;;; |
| 225 | ;;;; font-lock support | 227 | ;;;; font-lock support |
| @@ -528,7 +530,7 @@ but in the file header instead, in which case move forward to the first hunk." | |||
| 528 | ;; Define diff-{hunk,file}-{prev,next} | 530 | ;; Define diff-{hunk,file}-{prev,next} |
| 529 | (easy-mmode-define-navigation | 531 | (easy-mmode-define-navigation |
| 530 | diff-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view | 532 | diff-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view |
| 531 | (if diff-auto-refine | 533 | (if diff-auto-refine-mode |
| 532 | (condition-case-no-debug nil (diff-refine-hunk) (error nil)))) | 534 | (condition-case-no-debug nil (diff-refine-hunk) (error nil)))) |
| 533 | 535 | ||
| 534 | (easy-mmode-define-navigation | 536 | (easy-mmode-define-navigation |