emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 08c36be 8/8: Merge commit '84a5fe1900af2e5cc522f02749804f0


From: Dmitry Gutov
Subject: [elpa] master 08c36be 8/8: Merge commit '84a5fe1900af2e5cc522f02749804f0d9f094bbf' from diff-hl
Date: Sat, 23 Feb 2019 18:35:45 -0500 (EST)

branch: master
commit 08c36bee94ae3715211beb2a5b5d0034e9fbdc5e
Merge: 5249e54 84a5fe1
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Merge commit '84a5fe1900af2e5cc522f02749804f0d9f094bbf' from diff-hl
---
 packages/diff-hl/README.md          | 14 +++++++++++---
 packages/diff-hl/diff-hl-flydiff.el |  8 ++++----
 packages/diff-hl/diff-hl.el         | 31 ++++++++++++++++++++++---------
 3 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/packages/diff-hl/README.md b/packages/diff-hl/README.md
index 0ed1bdf..de07ffe 100644
--- a/packages/diff-hl/README.md
+++ b/packages/diff-hl/README.md
@@ -18,7 +18,16 @@ The package also contains auxiliary modes:
 * `diff-hl-flydiff-mode` implements highlighting changes on the fly.
   It requires Emacs 24.4 or newer.
 
-Check out the Commentary section in each respective file for the usage
+Usage
+=====
+
+Put this into your init script:
+
+```lisp
+(global-diff-hl-mode)
+```
+
+Check out the Commentary section in each file for more detailed usage
 instructions.
 
 Screenshots
@@ -93,8 +102,7 @@ psvn
 -----
 
 ```lisp
-(defadvice svn-status-update-modeline (after svn-update-diff-hl activate)
-  (diff-hl-update))
+(advice-add 'svn-status-update-modeline :after #'diff-hl-update)
 ```
 
 Magit
diff --git a/packages/diff-hl/diff-hl-flydiff.el 
b/packages/diff-hl/diff-hl-flydiff.el
index 33cbfbd..9de22a9 100644
--- a/packages/diff-hl/diff-hl-flydiff.el
+++ b/packages/diff-hl/diff-hl-flydiff.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
 
 ;; Author:   Jonathan Hayase <address@hidden>
 ;; URL:      https://github.com/dgutov/diff-hl
@@ -38,7 +38,7 @@
   "The idle delay in seconds before highlighting is updated."
   :type 'number)
 
-(defvar diff-hl-flydiff-modified-tick 0)
+(defvar diff-hl-flydiff-modified-tick nil)
 (defvar diff-hl-flydiff-timer nil)
 (make-variable-buffer-local 'diff-hl-flydiff-modified-tick)
 
@@ -124,7 +124,7 @@ the user should be returned."
 This requires the external program `diff' to be in your `exec-path'."
   (interactive)
   (vc-ensure-vc-buffer)
-  (setq diff-hl-flydiff-modified-tick (buffer-modified-tick))
+  (setq diff-hl-flydiff-modified-tick (buffer-chars-modified-tick))
   (save-current-buffer
     (let* ((temporary-file-directory
             (if (file-directory-p "/dev/shm/")
@@ -140,7 +140,7 @@ This requires the external program `diff' to be in your 
`exec-path'."
 (defun diff-hl-flydiff-update ()
   (unless (or
            (not diff-hl-mode)
-           (= diff-hl-flydiff-modified-tick (buffer-modified-tick))
+           (eq diff-hl-flydiff-modified-tick (buffer-chars-modified-tick))
            (not buffer-file-name)
            (not (file-exists-p buffer-file-name))
            (file-remote-p default-directory))
diff --git a/packages/diff-hl/diff-hl.el b/packages/diff-hl/diff-hl.el
index 5ef4f88..c467729 100644
--- a/packages/diff-hl/diff-hl.el
+++ b/packages/diff-hl/diff-hl.el
@@ -1,11 +1,11 @@
 ;;; diff-hl.el --- Highlight uncommitted changes using VC -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2012-2018  Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019  Free Software Foundation, Inc.
 
 ;; Author:   Dmitry Gutov <address@hidden>
 ;; URL:      https://github.com/dgutov/diff-hl
 ;; Keywords: vc, diff
-;; Version:  1.8.5
+;; Version:  1.8.6
 ;; Package-Requires: ((cl-lib "0.2") (emacs "24.3"))
 
 ;; This file is part of GNU Emacs.
@@ -187,6 +187,10 @@ the end position as its only argument."
       (diff-hl-define-bitmaps)
       (define-fringe-bitmap 'diff-hl-bmp-empty [0] 1 1 'center))))
 
+(defun diff-hl-maybe-redefine-bitmaps ()
+  (when (window-system)
+    (diff-hl-define-bitmaps)))
+
 (defvar diff-hl-spec-cache (make-hash-table :test 'equal))
 
 (defun diff-hl-fringe-spec (type pos side)
@@ -245,11 +249,20 @@ the end position as its only argument."
 
 (defun diff-hl-changes-buffer (file backend)
   (let ((buf-name " *diff-hl* "))
-    (diff-hl-with-diff-switches
-     ;; FIXME: To diff against the staging area, call 'git diff-files -p'.
-     (vc-call-backend backend 'diff (list file)
-                      diff-hl-reference-revision nil
-                      buf-name))
+    (condition-case err
+        (diff-hl-with-diff-switches
+         ;; FIXME: To diff against the staging area, call 'git diff-files -p'.
+         (vc-call-backend backend 'diff (list file)
+                          diff-hl-reference-revision nil
+                          buf-name))
+      (error
+       (when (string-match-p "\\`Failed (status 128)" (error-message-string 
err))
+         (diff-hl-with-diff-switches
+          ;; FIXME: To diff against the staging area, call 'git diff-files -p'.
+          (vc-call-backend backend 'diff (list file)
+                           "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
+                           nil
+                           buf-name)))))
     buf-name))
 
 (defun diff-hl-changes ()
@@ -534,7 +547,7 @@ The value of this variable is a mode line template as in
         ;; instead, but only when they dosn't call `revert-buffer':
         (add-hook 'magit-not-reverted-hook 'diff-hl-update nil t)
         (add-hook 'auto-revert-mode-hook 'diff-hl-update nil t)
-        (add-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps nil t))
+        (add-hook 'text-scale-mode-hook 'diff-hl-maybe-redefine-bitmaps nil t))
     (remove-hook 'after-save-hook 'diff-hl-update t)
     (remove-hook 'after-change-functions 'diff-hl-edit t)
     (remove-hook 'find-file-hook 'diff-hl-update t)
@@ -543,7 +556,7 @@ The value of this variable is a mode line template as in
     (remove-hook 'magit-revert-buffer-hook 'diff-hl-update t)
     (remove-hook 'magit-not-reverted-hook 'diff-hl-update t)
     (remove-hook 'auto-revert-mode-hook 'diff-hl-update t)
-    (remove-hook 'text-scale-mode-hook 'diff-hl-define-bitmaps t)
+    (remove-hook 'text-scale-mode-hook 'diff-hl-maybe-redefine-bitmaps t)
     (diff-hl-remove-overlays)))
 
 (when (require 'smartrep nil t)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]