-
Notifications
You must be signed in to change notification settings - Fork 1
/
wombag-options.el
223 lines (177 loc) · 5.39 KB
/
wombag-options.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
;;; wombag-options.el --- Customization options for Wombag -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Karthik Chikmagalur
;; Author: Karthik Chikmagalur <[email protected]>
;; 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 <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Customization options for Wombag.
;;; Code:
(require 'shr)
;;; Groups
(defgroup wombag nil
"Wombag client group."
:group 'comm)
(defgroup w-db nil
"Wombag database group."
:group 'wombag)
(defgroup w-search nil
"Wombag search buffer group."
:group 'wombag)
(defgroup w-show nil
"Wombag search buffer group."
:group 'wombag)
(defgroup w-faces nil
"Wombag faces group."
:group 'wombag)
(define-obsolete-variable-alias
'w-clientid 'w-client-id "0.1.0")
(define-obsolete-variable-alias
'w-secret 'w-client-secret "0.1.0")
;;; Remote and authentication
(defcustom w-host ""
"Wombag host."
:type 'string
:group 'wombag)
(defcustom w-username nil
"User name for Wombag."
:type 'string
:group 'wombag)
(defcustom w-password ""
"Password for Wombag"
:type '(choice
(string :tag "Password")
(function :tag "Function that returns the password."))
:group 'wombag)
(defcustom w-client-id ""
"Client ID for Wombag."
:type 'string
:group 'wombag)
(defcustom w-client-secret ""
"Client secret for Wombag."
:type 'string
:group 'wombag)
;;; Local database
(defcustom w-dir (file-name-concat
(or (getenv "XDG_CACHE_HOME") user-emacs-directory)
"wombag")
"Wombag data directory."
:type 'directory
:set (lambda (sym val)
(condition-case nil
(progn
(unless (file-directory-p val)
(make-directory val :parents))
(set-default-toplevel-value sym val))
(error (user-error "Could not create directory: %s" val))))
:group 'w-db)
(defcustom w-db-file
(file-name-concat w-dir "wombag.sqlite")
"Sqlite database used to store Wombag data."
:type 'file
:group 'w-db)
;;; Wombag search
(defcustom w-search-buffer-name "*wombag-search*"
"Buffer name for the Wombag search buffer."
:type 'string
:group 'w-search)
(defcustom w-search-filter "#30 "
"Default search filter for Wombag."
:type 'string
:group 'w-search)
(defcustom w-search-filter-help nil
"When non-nil, pop up a help window showing Wombag's search filter syntax.
This window can be toggled manually using \\`?'."
:type 'boolean
:group 'w-search)
;;; Wombag show
(defcustom w-show-entry-switch #'pop-to-buffer-same-window
"Function used to display Wombag entry window."
:type 'function
:group 'w-show)
(defcustom w-browse-url-function #'browse-url
"Function called with URLs to open."
:type 'function
:group 'w-show)
(defcustom w-pre-html-render-hook nil
"Hook run before rendering Wombag articles."
:type 'hook
:group 'w-show)
(defcustom w-post-html-render-hook nil
"Hook run after rendering Wombag articles."
:type 'hook
:group 'w-show)
(defcustom w-show-buffer-name "*wombag-entry*"
"Buffer name for the Wombag search buffer."
:type 'string
:group 'w-show)
;;; Faces
(defface w-title-face '((t :inherit bold))
"Face used for title on compact view."
:group 'w-faces)
(defface w-tag-face
'((((class color) (background light))
:foreground "brown")
(((class color) (background dark))
:foreground "#EBCB8B")
(t :inherit default))
"Face used for tag."
:group 'w-faces)
(defface w-domain-face
'((((class color) (background light))
:foreground "#3B6EA8")
(((class color) (background dark))
:foreground "#d9c6d6")
(t :inherit default))
"Face used for author."
:group 'w-faces)
(defface w-reading-time-face
'((((class color) (background light))
:foreground "#8b94a5")
(((class color) (background dark))
:foreground "#6f7787")
(t :inherit default))
"Face used for size."
:group 'w-faces)
(defface w-date-face
'((((class color) (background light))
:foreground "#29838D")
(((class color) (background dark))
:foreground "#8FBCBB")
(t :inherit default))
"Face for the date (last_modified)."
:group 'w-faces)
(defface w-show-title-face
'((t (:inherit (shr-h1 variable-pitch))))
"Face used for title."
:group 'w-faces)
(defface w-archive-face
'((((class color) (background light))
:foreground "grey"
:weight light)
(((class color) (background dark))
:foreground "dim grey"
:weight light)
(t :inherit default))
"Face used for archive."
:group 'w-faces)
(defface w-starred-face
'((((class color) (background light))
:foreground "red3")
(((class color) (background dark))
:foreground "yellow")
(t :inherit default))
"Face used for title."
:group 'w-faces)
(provide 'wombag-options)
;;; wombag-options.el ends here
;; Local Variables:
;; read-symbol-shorthands: (("w-" . "wombag-"))
;; End: