[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 03531f2 04/22: Add and use fringe faces specific to diff-h
From: |
Dmitry Gutov |
Subject: |
[elpa] master 03531f2 04/22: Add and use fringe faces specific to diff-hl-dired |
Date: |
Fri, 02 Jan 2015 23:46:26 +0000 |
branch: master
commit 03531f2ac8199b8b07f480f785fa68c580845020
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Add and use fringe faces specific to diff-hl-dired
#25
---
diff-hl-dired.el | 24 ++++++++++++++++++++++++
diff-hl.el | 15 ++++++++++-----
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/diff-hl-dired.el b/diff-hl-dired.el
index a94be03..928bb9c 100644
--- a/diff-hl-dired.el
+++ b/diff-hl-dired.el
@@ -29,6 +29,26 @@
(defvar diff-hl-dired-process-buffer nil)
+(defgroup diff-hl-dired nil
+ "VC diff highlighting on the side of a Dired window."
+ :group 'diff-hl)
+
+(defface diff-hl-dired-insert
+ '((default :inherit diff-hl-insert))
+ "Face used to highlight added files.")
+
+(defface diff-hl-dired-delete
+ '((default :inherit diff-hl-delete))
+ "Face used to highlight directories with deleted files.")
+
+(defface diff-hl-dired-change
+ '((default :inherit diff-hl-change))
+ "Face used to highlight changed files.")
+
+(defface diff-hl-dired-unknown
+ '((default :inherit diff-header))
+ "Face used to highlight unregistered files.")
+
;;;###autoload
(define-minor-mode diff-hl-dired-mode
"Toggle VC diff highlighting on the side of a Dired window."
@@ -91,10 +111,14 @@
(when (and type (dired-goto-file-1
file (expand-file-name file) nil))
(let* ((diff-hl-fringe-bmp-function 'diff-hl-fringe-bmp-from-type)
+ (diff-hl-fringe-face-function 'diff-hl-dired-face-from-type)
(o (diff-hl-add-highlighting type 'single)))
(overlay-put o 'modification-hooks '(diff-hl-overlay-modified))
))))))
+(defun diff-hl-dired-face-from-type (type _pos)
+ (intern (format "diff-hl-dired-%s" type)))
+
(defalias 'diff-hl-dired-clear 'diff-hl-remove-overlays)
(provide 'diff-hl-dired)
diff --git a/diff-hl.el b/diff-hl.el
index d208ccb..258e48a 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -86,10 +86,6 @@
"Face used to highlight changed lines."
:group 'diff-hl)
-(defface diff-hl-unknown
- '((default :inherit diff-header))
- "Face used to highlight unregistered files.")
-
(defcustom diff-hl-command-prefix (kbd "C-x v")
"The prefix for all `diff-hl' commands."
:group 'diff-hl
@@ -114,6 +110,12 @@
(const diff-hl-fringe-bmp-from-type)
function))
+(defcustom diff-hl-fringe-face-function 'diff-hl-fringe-face-from-type
+ "Function to choose the fringe face for a given change type
+ and position within a hunk. Should accept two arguments."
+ :group 'diff-hl
+ :type 'function)
+
(defvar diff-hl-reference-revision nil
"Revision to diff against. nil means the most recent one.")
@@ -166,12 +168,15 @@
(let* ((key (list type pos diff-hl-fringe-bmp-function))
(val (gethash key diff-hl-spec-cache)))
(unless val
- (let* ((face-sym (intern (format "diff-hl-%s" type)))
+ (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))))
(puthash key val diff-hl-spec-cache)))
val))
+(defun diff-hl-fringe-face-from-type (type _pos)
+ (intern (format "diff-hl-%s" type)))
+
(defun diff-hl-fringe-bmp-from-pos (_type pos)
(intern (format "diff-hl-bmp-%s" pos)))
- [elpa] master updated (c9c9f55 -> 8cec226), Dmitry Gutov, 2015/01/02
- [elpa] master c246d44 02/22: diff-hl-define-bitmaps: Handle text scaling and line spacing better, Dmitry Gutov, 2015/01/02
- [elpa] master ecc7fc3 03/22: diff-hl-fringe-bmp-from-type: Use `exclamation-mark', Dmitry Gutov, 2015/01/02
- [elpa] master 03531f2 04/22: Add and use fringe faces specific to diff-hl-dired,
Dmitry Gutov <=
- [elpa] master a6f3b89 05/22: diff-hl-dired: Highlight ignored files, Dmitry Gutov, 2015/01/02
- [elpa] master 27b3adb 06/22: Check if the original Dired buffer is still alive, Dmitry Gutov, 2015/01/02
- [elpa] master 50e88c2 07/22: Work around debbugs.gnu.org/18605, Dmitry Gutov, 2015/01/02
- [elpa] master 7466986 08/22: Update copyright year, Dmitry Gutov, 2015/01/02
- [elpa] master f2546ca 09/22: diff-hl-changes: Handle diffs where only file mode changed, Dmitry Gutov, 2015/01/02
- [elpa] master 58615cd 10/22: auto-revert-mode integration, Dmitry Gutov, 2015/01/02
- [elpa] master 8dd7d96 12/22: Don't error out when fringe is disabled, Dmitry Gutov, 2015/01/02
- [elpa] master ccaca25 11/22: Merge pull request #30 from sunesimonsen/master, Dmitry Gutov, 2015/01/02
- [elpa] master 9c5004e 13/22: diff-hl-dired-{unknown, ignored}: inherit from dired-ignored instead, Dmitry Gutov, 2015/01/02
- [elpa] master 32951f0 01/22: Add link to an issue, Dmitry Gutov, 2015/01/02