Commit 6be9197e authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/vc/diff-mode.el (diff--auto-refine-data): New var.

(diff-hunk): Use it to delay refinement.
(diff-mode): Remove overlays when we turn off font-lock.
parent e79186e5
2012-10-02 Stefan Monnier <monnier@iro.umontreal.ca>
 
* vc/diff-mode.el (diff--auto-refine-data): New var.
(diff-hunk): Use it to delay refinement.
(diff-mode): Remove overlays when we turn off font-lock.
* textmodes/table.el: Use lexical-binding, dolist, define-minor-mode.
(table-initialize-table-fixed-width-mode)
(table-set-table-fixed-width-mode): Remove functions.
......
......@@ -565,11 +565,24 @@ next hunk if TRY-HARDER is non-nil; otherwise signal an error."
(goto-char (match-beginning 1))
(beginning-of-line)))
(defvar diff--auto-refine-data nil)
;; 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-mode
(condition-case-unless-debug nil (diff-refine-hunk) (error nil))))
(when diff-auto-refine-mode
(setq diff--auto-refine-data (cons (current-buffer) (point-marker)))
(run-at-time 0.0 nil
(lambda ()
(when diff--auto-refine-data
(let ((buffer (car diff--auto-refine-data))
(point (cdr diff--auto-refine-data)))
(setq diff--auto-refine-data nil)
(with-local-quit
(when (buffer-live-p buffer)
(with-current-buffer buffer
(goto-char point)
(diff-refine-hunk))))))))))
(easy-mmode-define-navigation
diff-file diff-file-header-re "file" diff-end-of-file)
......@@ -1317,6 +1330,9 @@ a diff with \\[diff-reverse-direction].
\\{diff-mode-map}"
(set (make-local-variable 'font-lock-defaults) diff-font-lock-defaults)
(add-hook 'font-lock-mode-hook
(lambda () (remove-overlays nil nil 'diff-mode 'fine))
nil 'local)
(set (make-local-variable 'outline-regexp) diff-outline-regexp)
(set (make-local-variable 'imenu-generic-expression)
diff-imenu-generic-expression)
......@@ -1390,6 +1406,8 @@ modified lines of the diff."
(set (make-local-variable 'whitespace-style) '(face trailing))
(let ((style (save-excursion
(goto-char (point-min))
;; FIXME: For buffers filled from async processes, this search
;; will simply fail because the buffer is still empty :-(
(when (re-search-forward diff-hunk-header-re nil t)
(goto-char (match-beginning 0))
(diff-hunk-style)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment