]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge commit 'd0e6660ee501efea3e9b0936ed64fff09e66df02' from diff-hl
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 10 Jan 2016 15:47:16 +0000 (18:47 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 10 Jan 2016 15:47:16 +0000 (18:47 +0300)
1  2 
packages/diff-hl/diff-hl-flydiff.el
packages/diff-hl/diff-hl.el

index 53d31f7496655102ea608164adf28f096470104a,94dbbd7f6d9e89f68536d9a37ccd86884d18e3b3..94dbbd7f6d9e89f68536d9a37ccd86884d18e3b3
@@@ -1,4 -1,4 +1,4 @@@
- ;; Copyright (C) 2015 Free Software Foundation, Inc.
+ ;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
  
  ;; Author:   Jonathan Hayase <PythonNut@gmail.com>
  ;; URL:      https://github.com/dgutov/diff-hl
@@@ -105,19 -105,18 +105,18 @@@ the user should be returned.
        (if (file-exists-p automatic-backup)
            (rename-file automatic-backup filename nil)
          (with-current-buffer filebuf
-           (let ((failed t)
-                 (coding-system-for-read 'no-conversion)
+           (let ((coding-system-for-read 'no-conversion)
                  (coding-system-for-write 'no-conversion))
-             (unwind-protect
+             (condition-case nil
                  (with-temp-file filename
                    (let ((outbuf (current-buffer)))
                      ;; Change buffer to get local value of
                      ;; vc-checkout-switches.
                      (with-current-buffer filebuf
                        (vc-call find-revision file revision outbuf))))
-               (setq failed nil)
-               (when (and failed (file-exists-p filename))
-                 (delete-file filename)))))))
+               (error
+                (when (file-exists-p filename)
+                  (delete-file filename))))))))
      filename))
  
  (defun diff-hl-flydiff-buffer-with-head (file &optional backend)
  This requires the external program `diff' to be in your `exec-path'."
    (interactive)
    (vc-ensure-vc-buffer)
-   (with-current-buffer (get-buffer (current-buffer))
+   (setq diff-hl-flydiff-modified-tick (buffer-modified-tick))
+   (save-current-buffer
      (let* ((temporary-file-directory
              (if (file-directory-p "/dev/shm/")
                  "/dev/shm/"
        (diff-no-select rev (current-buffer) "-U 0 --strip-trailing-cr" 'noasync
                        (get-buffer-create " *diff-hl-diff*")))))
  
- (defun diff-hl-flydiff/update (old-fun &optional auto)
-   (unless (and auto
-                (or
-                 (= diff-hl-flydiff-modified-tick (buffer-modified-tick))
-                 (file-remote-p default-directory)
-                 (not (buffer-modified-p))))
-     (funcall old-fun)))
+ (defun diff-hl-flydiff-update ()
+   (unless (or
+            (not diff-hl-mode)
+            (= diff-hl-flydiff-modified-tick (buffer-modified-tick))
+            (file-remote-p default-directory))
+     (diff-hl-update)))
  
  (defun diff-hl-flydiff/modified-p (state)
    (buffer-modified-p))
  
- (defun diff-hl-flydiff/update-modified-tick (&rest args)
-   (setq diff-hl-flydiff-modified-tick (buffer-modified-tick)))
  ;;;###autoload
  (define-minor-mode diff-hl-flydiff-mode
    "Highlight diffs on-the-fly"
    :global t
    (if diff-hl-flydiff-mode
        (progn
-         (advice-add 'diff-hl-update :around #'diff-hl-flydiff/update)
          (advice-add 'diff-hl-overlay-modified :override #'ignore)
  
          (advice-add 'diff-hl-modified-p :before-until
                      #'diff-hl-flydiff/modified-p)
          (advice-add 'diff-hl-changes-buffer :override
                      #'diff-hl-flydiff-buffer-with-head)
-         (advice-add 'diff-hl-change :after
-                     #'diff-hl-flydiff/update-modified-tick)
          (setq diff-hl-flydiff-timer
-               (run-with-idle-timer diff-hl-flydiff-delay t #'diff-hl-update t)))
+               (run-with-idle-timer diff-hl-flydiff-delay t #'diff-hl-flydiff-update)))
  
-     (advice-remove 'diff-hl-update #'diff-hl-flydiff/update)
      (advice-remove 'diff-hl-overlay-modified #'ignore)
  
      (advice-remove 'diff-hl-modified-p #'diff-hl-flydiff/modified-p)
      (advice-remove 'diff-hl-changes-buffer #'diff-hl-flydiff-buffer-with-head)
-     (advice-remove 'diff-hl-change #'diff-hl-flydiff/update-modified-tick)
  
      (cancel-timer diff-hl-flydiff-timer)))
  
index cd3d017487c74214be9b7346b47be5fb80becaca,b8407884e384b5ec9fc617eb27f2d495b7b84912..b8407884e384b5ec9fc617eb27f2d495b7b84912
@@@ -1,11 -1,11 +1,11 @@@
- ;;; diff-hl.el --- Highlight uncommitted changes -*- lexical-binding: t -*-
+ ;;; diff-hl.el --- Highlight uncommitted changes using VC -*- lexical-binding: t -*-
  
- ;; Copyright (C) 2012-2015  Free Software Foundation, Inc.
+ ;; Copyright (C) 2012-2016  Free Software Foundation, Inc.
  
  ;; Author:   Dmitry Gutov <dgutov@yandex.ru>
  ;; URL:      https://github.com/dgutov/diff-hl
  ;; Keywords: vc, diff
- ;; Version:  1.8.1
+ ;; Version:  1.8.2
  ;; Package-Requires: ((cl-lib "0.2"))
  
  ;; This file is part of GNU Emacs.
@@@ -417,7 -417,7 +417,7 @@@ in the source file, or the last line o
                (with-current-buffer ,buffer
                  (save-buffer))
                (message "Hunk reverted"))))
-       (quit-windows-on diff-buffer))))
+       (quit-windows-on diff-buffer t))))
  
  (defun diff-hl-hunk-overlay-at (pos)
    (cl-loop for o in (overlays-in pos (1+ pos))