The latter should make it work in Emacs 24.{1,2}, as long as this is installed
from a package repository.
;; Author: Dmitry Gutov <dgutov@yandex.ru>\r
;; URL: https://github.com/dgutov/diff-hl\r
;; Keywords: vc, diff\r
;; Author: Dmitry Gutov <dgutov@yandex.ru>\r
;; URL: https://github.com/dgutov/diff-hl\r
;; Keywords: vc, diff\r
+;; Version: 1.3.6\r
+;; Package-Depends: ((cl-lib "0.2"))\r
\r
;; This file is not part of GNU Emacs.\r
\r
\r
;; This file is not part of GNU Emacs.\r
\r
(require 'vc)\r
(require 'vc-dir)\r
(eval-when-compile\r
(require 'vc)\r
(require 'vc-dir)\r
(eval-when-compile\r
(require 'vc-git)\r
(require 'vc-hg)\r
(require 'face-remap))\r
(require 'vc-git)\r
(require 'vc-hg)\r
(require 'face-remap))\r
\r
(defun diff-hl-define-bitmaps ()\r
(let* ((scale (if (and (boundp 'text-scale-mode-amount)\r
\r
(defun diff-hl-define-bitmaps ()\r
(let* ((scale (if (and (boundp 'text-scale-mode-amount)\r
- (plusp text-scale-mode-amount))\r
+ (cl-plusp text-scale-mode-amount))\r
(expt text-scale-mode-step text-scale-mode-amount)\r
1))\r
(h (round (* (frame-char-height) scale)))\r
(expt text-scale-mode-step text-scale-mode-amount)\r
1))\r
(h (round (* (frame-char-height) scale)))\r
(save-excursion\r
(goto-char (point-min))\r
(dolist (c changes)\r
(save-excursion\r
(goto-char (point-min))\r
(dolist (c changes)\r
- (destructuring-bind (line len type) c\r
+ (cl-destructuring-bind (line len type) c\r
(when (eq type 'delete)\r
(setq len 1)\r
(when (eq type 'delete)\r
(setq len 1)\r
(forward-line (- line current-line))\r
(setq current-line line)\r
(let ((hunk-beg (point)))\r
(forward-line (- line current-line))\r
(setq current-line line)\r
(let ((hunk-beg (point)))\r
+ (while (cl-plusp len)\r
(let ((o (make-overlay (point) (line-end-position))))\r
(overlay-put o 'diff-hl t)\r
(overlay-put o 'before-string\r
(let ((o (make-overlay (point) (line-end-position))))\r
(overlay-put o 'diff-hl t)\r
(overlay-put o 'before-string\r
((= line current-line) 'top)\r
(t 'middle)))))\r
(forward-line 1)\r
((= line current-line) 'top)\r
(t 'middle)))))\r
(forward-line 1)\r
- (incf current-line)\r
- (decf len))\r
+ (cl-incf current-line)\r
+ (cl-decf len))\r
(let ((h (make-overlay hunk-beg (point)))\r
(hook '(diff-hl-overlay-modified)))\r
(overlay-put h 'diff-hl t)\r
(let ((h (make-overlay hunk-beg (point)))\r
(hook '(diff-hl-overlay-modified)))\r
(overlay-put h 'diff-hl t)\r
;; Retreat to the previous hunk.\r
(forward-line -1)\r
(let ((to-go (1+ (- line hunk-line))))\r
;; Retreat to the previous hunk.\r
(forward-line -1)\r
(let ((to-go (1+ (- line hunk-line))))\r
+ (while (cl-plusp to-go)\r
(forward-line 1)\r
(unless (looking-at "^-")\r
(forward-line 1)\r
(unless (looking-at "^-")\r
- (decf to-go))))))))))\r
+ (cl-decf to-go))))))))))\r
\r
(defun diff-hl-revert-hunk ()\r
"Revert the diff hunk with changes at or above the point."\r
\r
(defun diff-hl-revert-hunk ()\r
"Revert the diff hunk with changes at or above the point."\r
(recenter (/ (+ wbh (- beg-line end-line) 2) 2))\r
(recenter 1)))\r
(unless (yes-or-no-p (format "Revert current hunk in %s?"\r
(recenter (/ (+ wbh (- beg-line end-line) 2) 2))\r
(recenter 1)))\r
(unless (yes-or-no-p (format "Revert current hunk in %s?"\r
+ ,(cl-caadr fileset)))\r
(error "Revert canceled"))\r
(let ((diff-advance-after-apply-hunk nil))\r
(diff-apply-hunk t))\r
(error "Revert canceled"))\r
(let ((diff-advance-after-apply-hunk nil))\r
(diff-apply-hunk t))\r
(quit-windows-on diff-buffer))))\r
\r
(defun diff-hl-hunk-overlay-at (pos)\r
(quit-windows-on diff-buffer))))\r
\r
(defun diff-hl-hunk-overlay-at (pos)\r
- (loop for o in (overlays-at pos)\r
- when (overlay-get o 'diff-hl-hunk)\r
- return o))\r
+ (cl-loop for o in (overlays-at pos)\r
+ when (overlay-get o 'diff-hl-hunk)\r
+ return o))\r
\r
(defun diff-hl-next-hunk (&optional backward)\r
"Go to the beginning of the next hunk in the current buffer."\r
\r
(defun diff-hl-next-hunk (&optional backward)\r
"Go to the beginning of the next hunk in the current buffer."\r