]> code.delx.au - gnu-emacs-elpa/blobdiff - diff-hl.el
Make diff-hl-flydiff-delay customizable
[gnu-emacs-elpa] / diff-hl.el
index 1677798eac4034cc0a44076c424a459f66c4538f..ec3d4351fb10780ebe8bcbec8cb10dc049273278 100644 (file)
                (if (floatp spacing)
                    (truncate (* (frame-char-height) spacing))
                  spacing)))
-         (w (frame-parameter nil (intern (format "%s-fringe" diff-hl-side))))
+         (w (min (frame-parameter nil (intern (format "%s-fringe" diff-hl-side)))
+                 16))
          (middle (make-vector h (expt 2 (1- w))))
          (ones (1- (expt 2 w)))
          (top (copy-sequence middle))
          (vc-hg-diff-switches nil)
          (vc-svn-diff-switches nil)
          (vc-diff-switches '("-U0"))
-         (vc-disable-async-diff t))
+         ,@(when (boundp 'vc-disable-async-diff)
+             '((vc-disable-async-diff t))))
      ,body))
 
 (defun diff-hl-modified-p (state)
   (or (eq state 'edited)
-    (and (eq state 'up-to-date)
-      ;; VC state is stale in after-revert-hook.
-      (or revert-buffer-in-progress-p
-        ;; Diffing against an older revision.
-        diff-hl-reference-revision))))
+      (and (eq state 'up-to-date)
+           ;; VC state is stale in after-revert-hook.
+           (or revert-buffer-in-progress-p
+               ;; Diffing against an older revision.
+               diff-hl-reference-revision))))
 
 (defun diff-hl-changes-buffer (file backend)
   (let ((buf-name " *diff-hl* "))
     (diff-hl-with-diff-switches
-      (vc-call-backend backend 'diff (list file)
-        diff-hl-reference-revision nil
-        buf-name))
+     (vc-call-backend backend 'diff (list file)
+                      diff-hl-reference-revision nil
+                      buf-name))
     buf-name))
 
 (defun diff-hl-changes ()
             (let ((hunk-beg (point)))
               (while (cl-plusp len)
                 (diff-hl-add-highlighting
-                  type
+                 type
                  (cond
                   ((not diff-hl-draw-borders) 'empty)
                   ((and (= len 1) (= line current-line)) 'single)
@@ -440,13 +442,13 @@ in the source file, or the last line of the hunk above it."
   (interactive)
   (diff-hl-next-hunk t))
 
-(define-prefix-command 'diff-hl-command-map)
-
-(let ((map diff-hl-command-map))
-  (define-key map "n" 'diff-hl-revert-hunk)
-  (define-key map "[" 'diff-hl-previous-hunk)
-  (define-key map "]" 'diff-hl-next-hunk)
-  map)
+(defvar diff-hl-command-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "n" 'diff-hl-revert-hunk)
+    (define-key map "[" 'diff-hl-previous-hunk)
+    (define-key map "]" 'diff-hl-next-hunk)
+    map))
+(fset 'diff-hl-command-map diff-hl-command-map)
 
 ;;;###autoload
 (define-minor-mode diff-hl-mode