Skip to content

Commit b5f9b7d

Browse files
author
vg
committed
Help text + "rainbow2" option
1 parent dd08673 commit b5f9b7d

File tree

2 files changed

+48
-12
lines changed

2 files changed

+48
-12
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,37 @@ screen space as possible
77

88
![Example code view](https://gv.github.io/stuff/images/includes.png)
99

10+
Keys
11+
---
12+
13+
`[` Decrease tag length limit
14+
`]` Increase tag length limit
15+
`9` Decrease color saturation
16+
`0` Increase color saturation
17+
`=` Go to diff for current file
18+
`/` Got to commit
19+
`Enter` Turn compact-blame-mode off
20+
21+
Config
22+
---
23+
24+
`compact-blame-bg1` Main tag background. Could be "#RRGGBB" or
25+
"rainbow" or "rainbow2" to generate color from commit id. Default: "#E0FFE0"
26+
27+
`compact-blame-bg2` Background for "month" part. Default: "#FFFFC0"
28+
29+
`compact-blame-format` Tag format string (default: "%Y%0%.%#"):
30+
- `%Y` The full year
31+
- `%0` Month number
32+
- `%m` Month number in Unicode superscript characters
33+
- `%x` Month number in hex
34+
- `%.` Author email name
35+
- `%#` Number of lines in hunk if >=10
36+
1037
Bugs
1138
---
1239

13-
- is a minor mode (and will be as long as we need to use major modes
40+
- Only current buffer updated when tuning color/length
41+
- No Windows support
42+
- Is a minor mode (and will be as long as we need to use major modes
1443
highlighting) but remaps character keys

compact-blame.el

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
(put 'Compact-blame-progress-percentage-str 'risky-local-variable t)
3434
(defvar-local Compact-blame-max-author-length 0)
3535

36-
(defun Compact-blame-get-light-coeff () "TODO")
37-
3836
(defun Compact-blame-get-bg-color (id config)
39-
(if (not (string-equal "rainbow" config))
40-
config (Compact-blame-bg-color-from-id id)))
37+
(if (string-equal "rainbow2" config)
38+
(Compact-blame-bg-color-from-id (substring id 6 12))
39+
(if (string-equal "rainbow" config)
40+
(Compact-blame-bg-color-from-id id)
41+
config)))
4142

4243
(defun Compact-blame-bg-color-from-id (id)
4344
(let* ((r (string-to-number (substring id 0 2) 16))
@@ -55,8 +56,13 @@
5556

5657
(defmacro Compact-blame-defun-subst
5758
(name arglist docstring additional-lists form)
58-
"Insert variable lists into function defs. That should allow us to
59-
pass object contexts around or store them to variables as a single unit"
59+
"Insert variable lists into function defs and/or arg lists. Equivalent C:
60+
61+
#define COMMIT_VARS time, author, id
62+
...
63+
64+
That should allow us to pass object contexts around or store them
65+
to variables as a single unit"
6066
(let ((lex-env '((commit-vars time author id)
6167
(region-vars ov number length))))
6268
(setq lex-env (nconc (eval additional-lists lex-env) lex-env))
@@ -94,8 +100,7 @@ pass object contexts around or store them to variables as a single unit"
94100
`(let* ((str compact-blame-format)
95101
(id (overlay-get ov 'Compact-blame-rev))
96102
(b (Compact-blame-get-bg-color id compact-blame-bg1))
97-
(b2 (Compact-blame-get-bg-color
98-
(substring id 6) compact-blame-bg2))
103+
(b2 (Compact-blame-get-bg-color id compact-blame-bg2))
99104
(f (Compact-blame-fg-color-from-id id))
100105
(f2 (Compact-blame-fg-color-from-id id)))
101106
(setq length-indication
@@ -132,7 +137,7 @@ pass object contexts around or store them to variables as a single unit"
132137
:background b2 :foreground f2 :box '(:line-width -1)))) str))
133138
(setq str (replace-regexp-in-string "^\s+\\|\s+$" "" str))
134139
(setq str
135-
(concat (propertize " \x25c4" 'face (list :foreground b)) str))
140+
(concat (propertize " \x25c0" 'face (list :foreground b)) str))
136141
(overlay-put ov 'before-string str)))
137142

138143
;;(format "---\n\n%s" (symbol-function 'Compact-blame-update-overlay-local))
@@ -446,14 +451,16 @@ pass object contexts around or store them to variables as a single unit"
446451
;; compact-blame-name-limit (- (float-time) take-off))
447452
)
448453

454+
(defun compact-blame-go-to-next-not-committed () (interactive)
455+
)
449456

450457
(defconst Compact-blame-keymap (make-sparse-keymap))
451458
(define-key Compact-blame-keymap (kbd "RET") 'compact-blame-mode)
452459
(define-key Compact-blame-keymap "=" 'compact-blame-show-diff)
453460
(define-key Compact-blame-keymap "/" 'compact-blame-show-commit)
454461
(define-key Compact-blame-keymap "s" 'compact-blame-toggle-separators)
455-
(define-key Compact-blame-keymap "-" 'compact-blame-light-up)
456-
(define-key Compact-blame-keymap "+" 'compact-blame-light-down)
462+
(define-key Compact-blame-keymap "9" 'compact-blame-light-up)
463+
(define-key Compact-blame-keymap "0" 'compact-blame-light-down)
457464
(define-key Compact-blame-keymap "[" 'compact-blame-decrease-name-limit)
458465
(define-key Compact-blame-keymap "]" 'compact-blame-increase-name-limit)
459466

0 commit comments

Comments
 (0)