[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 934fef0 11/42: Promote diff-hl-margin-side to diff-hl-side
From: |
Dmitry Gutov |
Subject: |
[elpa] master 934fef0 11/42: Promote diff-hl-margin-side to diff-hl-side |
Date: |
Wed, 09 Sep 2015 19:03:30 +0000 |
branch: master
commit 934fef05ce831bf4d3d87308be830080b77339c0
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Promote diff-hl-margin-side to diff-hl-side
Closes #45
---
diff-hl-margin.el | 16 +++-------------
diff-hl.el | 32 +++++++++++++++++++++++---------
2 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/diff-hl-margin.el b/diff-hl-margin.el
index c040ae7..32aa123 100644
--- a/diff-hl-margin.el
+++ b/diff-hl-margin.el
@@ -38,8 +38,6 @@
(require 'diff-hl)
(require 'diff-hl-dired)
-(defvar diff-hl-margin-side)
-
(defvar diff-hl-margin-old-highlight-function nil)
(defgroup diff-hl-margin nil
@@ -74,7 +72,7 @@
"Toggle displaying `diff-hl-mode' highlights on the margin locally.
You probably shouldn't use this function directly."
:lighter ""
- (let ((width-var (intern (format "%s-margin-width" diff-hl-margin-side))))
+ (let ((width-var (intern (format "%s-margin-width" diff-hl-side))))
(if diff-hl-margin-minor-mode
(progn
(set (make-local-variable 'diff-hl-margin-old-highlight-function)
@@ -88,15 +86,7 @@ You probably shouldn't use this function directly."
(dolist (win (get-buffer-window-list))
(set-window-buffer win (current-buffer))))
-(defcustom diff-hl-margin-side 'left
- "Which margin to use for indicators."
- :type '(choice (const left)
- (const right))
- :set (lambda (var value)
- (let ((on diff-hl-margin-mode))
- (when on (diff-hl-margin-mode -1))
- (set-default var value)
- (when on (diff-hl-margin-mode 1)))))
+(define-obsolete-variable-alias 'diff-hl-margin-side 'diff-hl-side "1.7.1")
(defun diff-hl-margin-minor-mode-off ()
(diff-hl-margin-minor-mode -1))
@@ -116,7 +106,7 @@ You probably shouldn't use this function directly."
(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)
+ (let ((spec (cdr (assoc (cons type diff-hl-side)
diff-hl-margin-spec-cache))))
(overlay-put ovl 'before-string spec)))
diff --git a/diff-hl.el b/diff-hl.el
index b0e360c..8057833 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -5,7 +5,7 @@
;; Author: Dmitry Gutov <address@hidden>
;; URL: https://github.com/dgutov/diff-hl
;; Keywords: vc, diff
-;; Version: 1.7.0
+;; Version: 1.7.1
;; Package-Requires: ((cl-lib "0.2"))
;; This file is part of GNU Emacs.
@@ -25,9 +25,9 @@
;;; Commentary:
-;; `diff-hl-mode' highlights uncommitted changes on the left side of
-;; the window (using the fringe, by default), allows you to jump
-;; between the hunks and revert them selectively.
+;; `diff-hl-mode' highlights uncommitted changes on the side of the
+;; window (using the fringe, by default), allows you to jump between
+;; the hunks and revert them selectively.
;; Provided commands:
;;
@@ -117,6 +117,16 @@
:group 'diff-hl
:type 'function)
+(defcustom diff-hl-side 'left
+ "Which side to use for indicators."
+ :type '(choice (const left)
+ (const right))
+ :set (lambda (var value)
+ (let ((on (bound-and-true-p global-diff-hl-mode)))
+ (when on (global-diff-hl-mode -1))
+ (set-default var value)
+ (when on (global-diff-hl-mode 1)))))
+
(defvar diff-hl-reference-revision nil
"Revision to diff against. nil means the most recent one.")
@@ -130,7 +140,7 @@
(if (floatp spacing)
(truncate (* (frame-char-height) spacing))
spacing)))
- (w (frame-parameter nil 'left-fringe))
+ (w (frame-parameter nil (intern (format "%s-fringe" diff-hl-side))))
(middle (make-vector h (expt 2 (1- w))))
(ones (1- (expt 2 w)))
(top (copy-sequence middle))
@@ -169,13 +179,16 @@
(defvar diff-hl-spec-cache (make-hash-table :test 'equal))
-(defun diff-hl-fringe-spec (type pos)
- (let* ((key (list type pos diff-hl-fringe-bmp-function))
+(defun diff-hl-fringe-spec (type pos side)
+ (let* ((key (list type pos side
+ diff-hl-fringe-face-function
+ diff-hl-fringe-bmp-function))
(val (gethash key diff-hl-spec-cache)))
(unless val
(let* ((face-sym (funcall diff-hl-fringe-face-function type pos))
(bmp-sym (funcall diff-hl-fringe-bmp-function type pos)))
- (setq val (propertize " " 'display `((left-fringe ,bmp-sym
,face-sym))))
+ (setq val (propertize " " 'display `((,(intern (format "%s-fringe"
side))
+ ,bmp-sym ,face-sym))))
(puthash key val diff-hl-spec-cache)))
val))
@@ -285,7 +298,8 @@
o))
(defun diff-hl-highlight-on-fringe (ovl type shape)
- (overlay-put ovl 'before-string (diff-hl-fringe-spec type shape)))
+ (overlay-put ovl 'before-string (diff-hl-fringe-spec type shape
+ diff-hl-side)))
(defun diff-hl-remove-overlays ()
(dolist (o (overlays-in (point-min) (point-max)))
- [elpa] master updated (cde5d9a -> a454a24), Dmitry Gutov, 2015/09/09
- [elpa] master 38a83db 01/42: Add documentation for diff-hl-dired-status-files., Dmitry Gutov, 2015/09/09
- [elpa] master 5bfb314 03/42: Move diff-hl-margin-side after diff-hl-margin-mode definition, Dmitry Gutov, 2015/09/09
- [elpa] master 1743a80 07/42: Merge pull request #42 from tarsius/silentio, Dmitry Gutov, 2015/09/09
- [elpa] master eb92f0e 04/42: Merge pull request #39 from jamessan/diff-hl-margin-load-error, Dmitry Gutov, 2015/09/09
- [elpa] master d188525 02/42: Merge pull request #37 from holocronweaver/documentation, Dmitry Gutov, 2015/09/09
- [elpa] master 4959c6e 10/42: Autoload diff-hl-dired-mode-unless-remote, Dmitry Gutov, 2015/09/09
- [elpa] master d6b7d82 05/42: Support the "next" Magit version, Dmitry Gutov, 2015/09/09
- [elpa] master 934fef0 11/42: Promote diff-hl-margin-side to diff-hl-side,
Dmitry Gutov <=
- [elpa] master 28263c7 12/42: Handle narrowing (fixes #48), Dmitry Gutov, 2015/09/09
- [elpa] master 84d5110 09/42: Bump the copyright years, Dmitry Gutov, 2015/09/09
- [elpa] master 12def16 14/42: Allow bitmap width only up to 16 (#49), Dmitry Gutov, 2015/09/09
- [elpa] master bf27c41 15/42: vc-disable-async-diff: Don't bind when it's undefined, Dmitry Gutov, 2015/09/09
- [elpa] master 7ea8159 16/42: Define diff-hl-command-map without destroying existing bindings, Dmitry Gutov, 2015/09/09
- [elpa] master 733ad33 06/42: silence byte-compiler, Dmitry Gutov, 2015/09/09
- [elpa] master 028b2bf 17/42: Merge pull request #51 from tarsius/keep-bindings, Dmitry Gutov, 2015/09/09
- [elpa] master 327e01c 20/42: Add commentary to diff-hl-flydiff, Dmitry Gutov, 2015/09/09
- [elpa] master 75d4bdc 08/42: Remove CR characters, Dmitry Gutov, 2015/09/09
- [elpa] master 0db7160 21/42: Change version predicate for vc-git polyfilling, Dmitry Gutov, 2015/09/09