]> code.delx.au - gnu-emacs-elpa/blobdiff - diff-hl-margin.el
Use magit-revert-buffer-hook
[gnu-emacs-elpa] / diff-hl-margin.el
index 22674e64c4952a81742a5c302b0199765ea24011..dac0b853d64ed25187e0b60f5450dcd4ad4c36b3 100644 (file)
@@ -1,13 +1,15 @@
 ;;; diff-hl-margin.el --- Highlight buffer changes on margins -*- lexical-binding: t -*-
 
-;; This file is not part of GNU Emacs.
+;; Copyright (C) 2012-2014  Free Software Foundation, Inc.
 
-;; This file is free software: you can redistribute it and/or modify
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; the Free Software Foundation, either version 3 of the License, or
 ;; (at your option) any later version.
 
-;; This file is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
@@ -17,7 +19,7 @@
 
 ;;; Commentary:
 
-;; This is a global mode, it modified `diff-hl-mode' to use the margin
+;; This is a global mode, it modifies `diff-hl-mode' to use the margin
 ;; instead of the fringe. To toggle, type `M-x diff-hl-margin-mode'.
 ;;
 ;; Compared to the default behavior, this makes `diff-hl-mode'
@@ -32,6 +34,7 @@
 ;;
 ;; (unless (window-system) (diff-hl-margin-mode))
 
+(require 'cl-lib)
 (require 'diff-hl)
 (require 'diff-hl-dired)
 
   (walk-windows (lambda (win) (set-window-buffer win (window-buffer win)))))
 
 (defvar diff-hl-margin-spec-cache
-  (loop for (type . char) in '((insert . "+") (delete . "-")
-                               (change . "|") (unknown . "?"))
+  (cl-loop for (type . char) in '((insert . "+") (delete . "-")
+                                  (change . "|") (unknown . "?"))
         nconc
-        (loop for side in '(left right)
-              collect
-              (cons (cons type side)
-                    (propertize
-                     " " 'display
-                     `((margin ,(intern (format "%s-margin" side)))
-                       ,(propertize char 'face
-                                    (intern (format "diff-hl-%s" type)))))))))
+        (cl-loop for side in '(left right)
+                 collect
+                 (cons (cons type side)
+                       (propertize
+                        " " 'display
+                        `((margin ,(intern (format "%s-margin" side)))
+                          ,(propertize char 'face
+                                       (intern (format "diff-hl-%s" type)))))))))
 
 (defun diff-hl-highlight-on-margin (ovl type _shape)
   (let ((spec (cdr (assoc (cons type diff-hl-margin-side)