-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathocc-obj.el
More file actions
318 lines (264 loc) · 10.3 KB
/
occ-obj.el
File metadata and controls
318 lines (264 loc) · 10.3 KB
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
;;; occ-obj.el --- occ-api -*- lexical-binding: t; -*-
;; Copyright (C) 2016 sharad
;; Author: sharad <sh4r4d _at_ _G-mail_>
;; Keywords: convenience
;; 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:
;;
;;; Code:
(provide 'occ-obj)
;; * cl-macs
;; https://nullprogram.com/blog/2018/02/14/
;;
;; * TODO org-base-buffer
;;
;; https://stackoverflow.com/questions/12262220/add-created-date-property-to-todos-in-org-mode
;;
;; https://stackoverflow.com/questions/40884764/lisp-get-all-slot-names-from-an-class-instance
;;
;; https://www.gnu.org/software/emacs/manual/html_node/eieio/Quick-Start.html#Quick-Start
;;
;; Static method
;; https://www.gnu.org/software/emacs/manual/html_node/eieio/Static-Methods.html
;;
;; https://elpa.gnu.org/packages/cl-generic.html
;;
;; https://www.gnu.org/software/emacs/manual/html_node/eieio/Quick-Start.html#Quick-Start
;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Generic-Functions.html
;; The type specializer, (arg type), can specify one of the system types in the
;; following list. When a parent type is specified, an argument whose type is
;; any of its more specific child types, as well as grand-children,
;; grand-grand-children, etc. will also be compatible.
;;
;; integer (Parent type: number.)
;; number
;; null (Parent type: symbol.)
;; symbol
;; string (Parent type: array.)
;; array (Parent type: sequence.)
;; cons (Parent type: list.)
;; list (Parent type: sequence.)
;; marker
;; overlay
;; float (Parent type: number.)
;; window-configuration
;; process
;; window
;; subr
;; compiled-function
;; buffer
;; char-table (Parent type: array.)
;; bool-vector (Parent type: array.)
;; vector (Parent type: array.)
;; frame
;; hash-table
;; font-spec
;; font-entity
;; font-object
(defvar occ-verbose 0)
;;
;; obj
;; |
;; +--------------------------------------------------------+--------------------------------------------------------+---------------------------------------+-------------------------+-----------------------------------------------+
;; | | | | | |
;; obj-tsk obj-prop obj-ctx stat action agent
;; | | | | |
;; +----------------------------+----------------------------+ prop +-----------------------+-----------------------+ +----------+-----------+ +----------+-----------+
;; | | | | | | | |
;; obj-ctx-tsk tsk obj-collection ctx direct transformer user emacs
;; | | |
;; ctsk +----------+----------+ +----------+----------+
;; | | | | |
;; ctxual-tsk tree-tsk list-tsk list-collection tree-collection
;;
(cl-defstruct occ-obj
(name "occ-obj"))
(cl-defstruct (occ-obj-tsk (:include occ-obj))
"Object to hold tsk ctx obj-ctx-tsk"
;; prop-ranks-plist
(selectable nil)
filter-rank-plist)
(cl-defstruct (occ-obj-ctx-tsk (:include occ-obj-tsk))
"Object to hold ctsk occ-ctxual-tsk")
;; (cl-defstruct (occ-obj-prop (:include occ-obj))
;; "Will hold prop")
(cl-defstruct (occ-stat (:include occ-obj))
"occ-stat"
average
stddev
variance)
(cl-defstruct (occ-obj-ctx (:include occ-obj))
"Will hold ctx"
stat-plist)
(cl-defstruct (occ-obj-collection (:include occ-obj-ctx))
"Will hold collection"
(desc "occ-obj-collection")
spec
(roots nil)
(files nil)
(depth 0)
(limit 0)
;; BUG: TODO: implement it for occ-obj-helm-build-collection-source issue
(rank 0)
(level :optional)
;; TODO: implement it
(file-lcp nil))
(cl-defstruct (occ-collection (:include occ-obj-collection))
"occ-collection")
(cl-defstruct (occ-list-collection (:include occ-collection))
"occ-list-collection"
(list nil))
(cl-defstruct (occ-tree-collection (:include occ-list-collection))
"occ-tree-collection"
(tree nil))
;; (cl-defmethod occ-collection-dyn ()
;; collection)
;; (cl-defstruct (occ-prop (:include occ-obj-prop))
;; value)
(cl-defstruct (occ-ranktbl (:include occ-obj))
plist
value
inheritable
nonheritable
max-decendent)
;; acquired
;; NOTE: Remember when adding new attributes, nned to destroy existing object, else it will cause miss-match.
(cl-defstruct (occ-tsk (:include occ-obj-tsk))
"occ-tsk"
;; [[file:~/.repos/git/main/resource/info/doc/orgs/private/doc/contents/org/tasks/personal/works/emacs/todo.org::*Each%20task%20should%20have%20different%20types%20of%20actions%20associated%20to%20it,%20default%20is%20to%20clock-in%20to%20it][Each task should have different types of actions associated to it, default is to clock-in to it]]
dummy
collection
parent
action
;; *** Each task should have different types of actions associated to it, default is to clock-in to it
;; - rest could be
;; to ignore this task continue where already clockin or not
;; which could be used to avoid non-interesting buffers
;; - etc many different could be thought
heading
heading-prop
marker
file
point
clock-sum
level
subtree-level
file-level
cat
format-file
format-string
sibling-count
children-count
descendant-count
descendant-weight
plist
(ranktbl (occ-make-ranktbl)))
;; rank-inheritable
;; rank-nonheritable
;; rank-acquired
;; plist
(cl-defstruct (occ-tree-tsk (:include occ-tsk))
"occ-tree-tsk"
subtree)
(cl-defstruct (occ-list-tsk (:include occ-tsk))
"occ-list-tsk")
(cl-defstruct (occ-ctx (:include occ-obj-ctx))
"occ-ctx"
buffer
file
;; tsk-aplist
tsk-ranktbl-list)
(cl-defstruct (occ-ctsk (:include occ-obj-ctx-tsk))
"occ-ctsk"
;; Reason to have one more occ-ctsk along with occ-ctxual-tsk to avoid calculating rank.
ctx
tsk)
(cl-defstruct (occ-ctxual-tsk (:include occ-ctsk)))
;; rank-inheritable
;; rank-nonheritable
;; rank-acquired
;; TODO: need to add ability to be proxy object
;; to pass all method to underlying object in
;; Menu
;; "Set debug obj"
;; "Call with obj"
;; occ-return getting passed
(cl-defstruct occ-return
"occ-return"
label
value)
(cl-defstruct (occ-callable (:include occ-obj))
"occ-callable"
keyword
fun)
(cl-defstruct (occ-callable-normal (:include occ-callable))
"occ-callable-normal")
(cl-defstruct (occ-callable-generator (:include occ-callable))
"occ-callable-generator")
(cl-defstruct (occ-static-filter (:include occ-obj))
"occ-static-filter"
keyword
;; fun
points-gen-fn
compare-fn
default-pivot-fn
rank-display-fn
rank-select-fn)
(cl-defstruct (occ-obj-dyn-filter (:include occ-obj))
"occ-obj-dyn-filter"
init-closure-fn
seq-closure-fn
display-filter-closure-fn
selectable-filter-closure-fn
;; points-closure-fn
;; pivot
increment-closure-fn
decrement-closure-fn
reset-closure-fn)
(cl-defstruct (occ-dyn-filter (:include occ-obj-dyn-filter))
"occ-dyn-filter"
prev)
(cl-defstruct (occ-combined-dyn-filter (:include occ-obj-dyn-filter))
"occ-combined-dyn-filter"
curr-closure-fn
prev-closure-fn
next-closure-fn)
(cl-defstruct (occ-ap (:include occ-obj))
"AP stand for `actions pack'"
tree-keybranch)
(cl-defstruct (occ-ap-normal (:include occ-ap))
"AP stand for `actions pack'"
callables)
(cl-defstruct (occ-ap-transf (:include occ-ap-normal))
"AP stand for `actions pack'"
transform)
;; BUG: TODO - use other name then occ-hsrc-... like occ-hselect-... as select is verb, while I need noun
(cl-defstruct (occ-hsrc (:include occ-obj))
"helm select obj or source"
obj
(rank 0)
(level :optional))
(cl-defstruct (occ-hsrc-null (:include occ-hsrc))
"helm select object")
(cl-defstruct (occ-hsrc-candidate (:include occ-hsrc))
"helm select object")
(cl-defstruct (occ-hsrc-source (:include occ-hsrc))
"helm select source")
(cl-defstruct (occ-obj-agent (:include occ-obj))
"Will hold dummy agent")
(cl-defstruct (occ-user-agent (:include occ-obj-agent))
"Will hold dummy user agent")
(cl-defstruct (occ-org-agent (:include occ-obj-agent))
"Will hold dummy org agent")
(cl-defstruct (occ-emacs-agent (:include occ-obj-agent))
"Will hold dummy org agent")
;;; occ-obj.el ends here