]> code.delx.au - gnu-emacs-elpa/commitdiff
Prefix all cl functions, add cl-lib dependency
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 27 Jan 2013 09:04:30 +0000 (13:04 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 27 Jan 2013 09:04:30 +0000 (13:04 +0400)
The latter should make it work in Emacs 24.{1,2}, as long as this is installed
from a package repository.

diff-hl.el

index 8ea8623b113dc26720acb1796ef668747e1bf0be..4973b20eed88f98d48a1f0f02bac5cc7f519fe83 100644 (file)
@@ -3,7 +3,8 @@
 ;; Author:   Dmitry Gutov <dgutov@yandex.ru>\r
 ;; URL:      https://github.com/dgutov/diff-hl\r
 ;; Keywords: vc, diff\r
-;; Version:  1.3.5\r
+;; Version:  1.3.6\r
+;; Package-Depends: ((cl-lib "0.2"))\r
 \r
 ;; This file is not part of GNU Emacs.\r
 \r
@@ -51,7 +52,7 @@
 (require 'vc)\r
 (require 'vc-dir)\r
 (eval-when-compile\r
-  (require 'cl)\r
+  (require 'cl-lib)\r
   (require 'vc-git)\r
   (require 'vc-hg)\r
   (require 'face-remap))\r
@@ -87,7 +88,7 @@
 \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
     (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
-            (incf line))\r
+            (cl-incf line))\r
           (forward-line (- line current-line))\r
           (setq current-line line)\r
           (let ((hunk-beg (point)))\r
-            (while (plusp len)\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
                                ((= 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
@@ -247,10 +248,10 @@ in the source file, or the last line of the hunk above it."
               ;; Retreat to the previous hunk.\r
               (forward-line -1)\r
             (let ((to-go (1+ (- line hunk-line))))\r
-              (while (plusp to-go)\r
+              (while (cl-plusp to-go)\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
@@ -287,7 +288,7 @@ in the source file, or the last line of the hunk above it."
                     (recenter (/ (+ wbh (- beg-line end-line) 2) 2))\r
                   (recenter 1)))\r
               (unless (yes-or-no-p (format "Revert current hunk in %s?"\r
-                                           ,(caadr fileset)))\r
+                                           ,(cl-caadr fileset)))\r
                 (error "Revert canceled"))\r
               (let ((diff-advance-after-apply-hunk nil))\r
                 (diff-apply-hunk t))\r
@@ -297,9 +298,9 @@ in the source file, or the last line of the hunk above it."
       (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