-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathtelephone-line-separators.el
203 lines (181 loc) · 8.58 KB
/
telephone-line-separators.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
;;; telephone-line-separators.el --- Separators for Telephone Line
;; Copyright (C) 2015-2022 Daniel Bordak
;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program 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.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Separators for Telephone Line.
;; To create your own, look at the functions defined in telephone-line-utils.el
;;; Code:
(require 'color)
(require 'telephone-line-utils)
(defun telephone-line-row-pattern-solid-block (_ width)
"Create a block of 1s of WIDTH. _ is disregarded."
(make-list width 1))
(defvar telephone-line-flat
(make-instance 'telephone-line-separator
:axis-func #'identity
:forced-width 1
:pattern-func #'telephone-line-row-pattern-solid-block))
(defun telephone-line-row-pattern-fixed-gradient (_ width)
"Create a gradient bytestring of WIDTH. _ is disregarded."
(mapcar (lambda (num)
(/ num (float width)))
(number-sequence 1 width)))
(defvar telephone-line-gradient
(make-instance 'telephone-line-separator
:axis-func #'identity
:pattern-func #'telephone-line-row-pattern-fixed-gradient))
(defvar telephone-line-utf-abs-right
(make-instance 'telephone-line-unicode-separator
:char #xe0b2
:inverse-video nil))
(defvar telephone-line-utf-abs-left
(make-instance 'telephone-line-unicode-separator
:char #xe0b0))
(defvar telephone-line-utf-abs-hollow-right
(make-instance 'telephone-line-unicode-separator
:char #xe0b3))
(defvar telephone-line-utf-abs-hollow-left
(make-instance 'telephone-line-unicode-separator
:char #xe0b1))
(defvar telephone-line-abs-right
(make-instance 'telephone-line-separator
:axis-func #'abs
:alt-separator telephone-line-utf-abs-right))
(defvar telephone-line-abs-left
(make-instance 'telephone-line-separator
:axis-func (telephone-line-complement abs)
:alt-separator telephone-line-utf-abs-left))
(defvar telephone-line-abs-hollow-right
(make-instance 'telephone-line-subseparator
:axis-func #'abs
:alt-separator telephone-line-utf-abs-hollow-right))
(defvar telephone-line-abs-hollow-left
(make-instance 'telephone-line-subseparator
:axis-func (telephone-line-complement abs)
:alt-separator telephone-line-utf-abs-hollow-left))
(defvar telephone-line-cubed-right
(make-instance 'telephone-line-separator
:axis-func (lambda (x) (expt x 3))
:alt-separator telephone-line-utf-abs-right))
(defvar telephone-line-cubed-left
(make-instance 'telephone-line-separator
:axis-func (lambda (x) (- (expt x 3)))
:alt-separator telephone-line-utf-abs-left))
(defvar telephone-line-cubed-hollow-right
(make-instance 'telephone-line-subseparator
:axis-func (lambda (x) (expt x 3))
:alt-separator telephone-line-utf-abs-hollow-right))
(defvar telephone-line-cubed-hollow-left
(make-instance 'telephone-line-subseparator
:axis-func (lambda (x) (- (expt x 3)))
:alt-separator telephone-line-utf-abs-hollow-left))
(defvar telephone-line-sin-right
(make-instance 'telephone-line-separator
:axis-func (telephone-line-complement sin)
:alt-separator telephone-line-utf-abs-right))
(defvar telephone-line-sin-left
(make-instance 'telephone-line-separator
:axis-func #'sin
:alt-separator telephone-line-utf-abs-left))
(defvar telephone-line-sin-hollow-right
(make-instance 'telephone-line-subseparator
:axis-func (telephone-line-complement sin)
:alt-separator telephone-line-utf-abs-hollow-right))
(defvar telephone-line-sin-hollow-left
(make-instance 'telephone-line-subseparator
:axis-func #'sin
:alt-separator telephone-line-utf-abs-hollow-left))
(defvar telephone-line-halfsin-right
(make-instance 'telephone-line-separator
:axis-func (lambda (x) (- (sin (/ x 2))))
:alt-separator telephone-line-utf-abs-right))
(defvar telephone-line-halfsin-left
(make-instance 'telephone-line-separator
:axis-func (lambda (x) (sin (/ x 2)))
:alt-separator telephone-line-utf-abs-left))
(defvar telephone-line-halfsin-hollow-right
(make-instance 'telephone-line-subseparator
:axis-func (lambda (x) (- (sin (/ x 2))))
:alt-separator telephone-line-utf-abs-hollow-right))
(defvar telephone-line-halfsin-hollow-left
(make-instance 'telephone-line-subseparator
:axis-func (lambda (x) (sin (/ x 2)))
:alt-separator telephone-line-utf-abs-hollow-left))
(defvar telephone-line-cos-right
(make-instance 'telephone-line-separator
:axis-func (telephone-line-complement cos)
:alt-separator telephone-line-utf-abs-right))
(defvar telephone-line-cos-left
(make-instance 'telephone-line-separator
:axis-func #'cos
:alt-separator telephone-line-utf-abs-left))
(defvar telephone-line-cos-hollow-right
(make-instance 'telephone-line-subseparator
:axis-func (telephone-line-complement cos)
:alt-separator telephone-line-utf-abs-hollow-right))
(defvar telephone-line-cos-hollow-left
(make-instance 'telephone-line-subseparator
:axis-func #'cos
:alt-separator telephone-line-utf-abs-hollow-left))
(defvar telephone-line-halfcos-right
(make-instance 'telephone-line-separator
:axis-func (lambda (x) (- (cos (/ x 2))))
:alt-separator telephone-line-utf-abs-right))
(defvar telephone-line-halfcos-left
(make-instance 'telephone-line-separator
:axis-func (lambda (x) (cos (/ x 2)))
:alt-separator telephone-line-utf-abs-left))
(defvar telephone-line-halfcos-hollow-right
(make-instance 'telephone-line-subseparator
:axis-func (lambda (x) (- (cos (/ x 2))))
:alt-separator telephone-line-utf-abs-hollow-right))
(defvar telephone-line-halfcos-hollow-left
(make-instance 'telephone-line-subseparator
:axis-func (lambda (x) (cos (/ x 2)))
:alt-separator telephone-line-utf-abs-hollow-left))
(defvar telephone-line-tan-right
(make-instance 'telephone-line-separator
:axis-func (lambda (x) (- (tan (/ x 2.2))))
:alt-separator telephone-line-utf-abs-right))
(defvar telephone-line-tan-left
(make-instance 'telephone-line-separator
:axis-func (lambda (x) (tan (/ x 2.2)))
:alt-separator telephone-line-utf-abs-left))
(defvar telephone-line-tan-hollow-right
(make-instance 'telephone-line-subseparator
:axis-func (lambda (x) (- (tan (/ x 2.2))))
:alt-separator telephone-line-utf-abs-hollow-right))
(defvar telephone-line-tan-hollow-left
(make-instance 'telephone-line-subseparator
:axis-func (lambda (x) (tan (/ x 2.2)))
:alt-separator telephone-line-utf-abs-hollow-left))
(defvar telephone-line-identity-right
(make-instance 'telephone-line-separator
:axis-func #'identity
:alt-separator telephone-line-utf-abs-right))
(defvar telephone-line-identity-left
(make-instance 'telephone-line-separator
:axis-func #'-
:alt-separator telephone-line-utf-abs-left))
(defvar telephone-line-identity-hollow-right
(make-instance 'telephone-line-subseparator
:axis-func #'identity
:alt-separator telephone-line-utf-abs-hollow-right))
(defvar telephone-line-identity-hollow-left
(make-instance 'telephone-line-subseparator
:axis-func #'-
:alt-separator telephone-line-utf-abs-hollow-left))
(defvar telephone-line-nil
(make-instance 'telephone-line-nil-separator :forced-width 0))
(provide 'telephone-line-separators)
;;; telephone-line-separators.el ends here