]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge pull request #50 from PythonNut/master
authorDmitry Gutov <dgutov@yandex.ru>
Sat, 5 Sep 2015 03:33:22 +0000 (06:33 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 5 Sep 2015 03:33:22 +0000 (06:33 +0300)
[WIP] Allow diffing on-the-fly

README.md
diff-hl.el

index 4a71d5e0db6d696b14d0a5ce286ed66c4c2cc2ac..20274bbc122269dda6bc33fc5c0c779c8c77229b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -59,6 +59,9 @@ Notes
 \r
 * Frame-local and buffer-local values of `line-spacing` are not supported.\r
 \r
+* Fringe width up to 16 works best (because we can't define a bitmap\r
+  with width above that number).\r
+\r
 * [emacs-git-gutter](https://github.com/syohex/emacs-git-gutter) shows\r
   indicators in the margin by default, allows you to customize how the\r
   indicators look more easily, and has a "stage hunk" command.\r
index 1677798eac4034cc0a44076c424a459f66c4538f..50714b2e3d05c0a24fd312f4b23fcc5e21da7cd8 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)
@@ -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