Skip to content

Commit

Permalink
Squashed 'site-lisp/git-gutter-fringe-plus/' changes from ce9d594..7a…
Browse files Browse the repository at this point in the history
…2f49d

7a2f49d Readme: Fix symbol quote
3857d48 Make faces inherit from git-gutter+
a44fcfa Fix required version of 'fringe-helper'
8a431a0 Version 0.0.2
07fb3c2 Add 'git-gutter+-toggle-fringe'

git-subtree-dir: site-lisp/git-gutter-fringe-plus
git-subtree-split: 7a2f49d2455a3a872e90e5f7dd4e6b27f1d96cfc
  • Loading branch information
jwiegley committed Sep 24, 2015
1 parent f800b29 commit 32ab2c7
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 11 deletions.
19 changes: 17 additions & 2 deletions README.md
Expand Up @@ -23,7 +23,13 @@ It uses the buffer fringe instead of the buffer margin.

* Add this to your .emacs file:

(require git-gutter-fringe+)
(require 'git-gutter-fringe+)

The fringe display mode is automatically activated.

## Disabling/Enabling

Run `M-x git-gutter+-toggle-fringe` to disable/enable the fringe display mode.

## Minimal skin

Expand All @@ -39,8 +45,17 @@ Features smaller, greyscale diff symbols. Activate it with

![git-gutter-fringe-customize](images/git-gutter-fringe-customize.png)

You can change faces like following.
You can customize the colors of modified, added, and deleted fringe marks either by
modifying the faces from git-gutter+ or directly using the git-gutter-fr+ faces.

Using the fact git-gutter-fr+ faces are inherited from git-gutter+:
```elisp
(set-face-foreground 'git-gutter+-modified "yellow")
(set-face-foreground 'git-gutter+-added "blue")
(set-face-foreground 'git-gutter+-deleted "white")
```

Or directly, to allow different colors for git-gutter-fr+ and git-gutter+:
```elisp
(set-face-foreground 'git-gutter-fr+-modified "yellow")
(set-face-foreground 'git-gutter-fr+-added "blue")
Expand Down
40 changes: 31 additions & 9 deletions git-gutter-fringe+.el
Expand Up @@ -4,8 +4,8 @@

;; Author: Syohei YOSHIDA <syohex@gmail.com> and contributors
;; URL: https://github.com/nonsequitur/git-gutter-fringe-plus
;; Version: 0.01
;; Package-Requires: ((git-gutter+ "0.01") (fringe-helper "20130519.1641"))
;; Version: 0.0.2
;; Package-Requires: ((git-gutter+ "0.1") (fringe-helper "1.0.1"))

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
Expand All @@ -31,17 +31,17 @@
(require 'fringe-helper)

(defface git-gutter-fr+-modified
'((t (:foreground "magenta" :weight bold)))
'((t (:inherit git-gutter+-modified)))
"Face of modified"
:group 'git-gutter+)

(defface git-gutter-fr+-added
'((t (:foreground "green" :weight bold)))
'((t (:inherit git-gutter+-added)))
"Face of added"
:group 'git-gutter+)

(defface git-gutter-fr+-deleted
'((t (:foreground "red" :weight bold)))
'((t (:inherit git-gutter+-deleted)))
"Face of deleted"
:group 'git-gutter+)

Expand Down Expand Up @@ -125,10 +125,6 @@
(mapc 'git-gutter-fr+-clear-overlay git-gutter-fr+-bitmap-references)
(setq git-gutter-fr+-bitmap-references nil))

(setq git-gutter+-view-diff-function 'git-gutter-fr+-view-diff-infos
git-gutter+-clear-function 'git-gutter-fr+-clear
git-gutter+-window-config-change-function nil)

(defun git-gutter-fr+-minimal ()
(fringe-helper-define 'git-gutter-fr+-added nil
"........"
Expand Down Expand Up @@ -168,6 +164,32 @@
(set-face-attribute 'git-gutter-fr+-deleted nil :foreground "grey50")
(set-face-attribute 'git-gutter-fr+-modified nil :foreground "grey50"))

(defun git-gutter+-enable-fringe-display-mode ()
(setq git-gutter+-view-diff-function 'git-gutter-fr+-view-diff-infos
git-gutter+-clear-function 'git-gutter-fr+-clear
git-gutter+-window-config-change-function nil))

(defun git-gutter+-toggle-fringe ()
(interactive)
(let ((old-clear-fn git-gutter+-clear-function))
(if (eq old-clear-fn 'git-gutter-fr+-clear)
(git-gutter+-enable-default-display-mode)
(git-gutter+-enable-fringe-display-mode))

(git-gutter+-in-all-buffers
(when git-gutter+-mode
(git-gutter+-set-window-margin 0)
(remove-hook 'window-configuration-change-hook 'git-gutter+-show-gutter t)

(funcall old-clear-fn)
(funcall git-gutter+-view-diff-function git-gutter+-diffinfos)

(if git-gutter+-window-config-change-function
(add-hook 'window-configuration-change-hook
git-gutter+-window-config-change-function nil t))))))

(git-gutter+-enable-fringe-display-mode)

(provide 'git-gutter-fringe+)

;;; git-gutter-fringe+.el ends here

0 comments on commit 32ab2c7

Please sign in to comment.