Coverage report: /home/ellis/comp/core/lib/organ/vars.lisp
Kind | Covered | All | % |
expression | 23 | 137 | 16.8 |
branch | 2 | 2 | 100.0 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
3
(defparameter *org-todo-keyword-types*
6
(defparameter *org-todo-keywords*
7
'(("TODO" . todo) ("DONE" . done) ("FIND" . todo) ("FOUND" . done)
8
("RESEARCH" . todo) ("RECORD" . todo) ("OUTLINE" . todo) ("DRAFT" . todo)
9
("REVIEW" . todo) ("FIX" . todo) ("IMPL" . todo) ("TEST" . todo) ("FIXED" . done)
10
("GOTO" . todo) ("HACK" . todo) ("NOTE" . todo) ("CODE" . todo) ("LINK" . todo))
11
"List of keywords accepted by `organ'. ")
13
(defun org-todo-keyword-map ()
14
(let ((kws (make-hash-table :size 20 :test #'equal)))
15
(loop for (k . v) in *org-todo-keywords*
16
do (setf (gethash k kws) v))
19
(defvar org-todo-keyword-map (org-todo-keyword-map))
21
(defun org-todo-keyword-p (kw)
22
"Search for symbol KW in `org-todo-keyword-map' returning the
23
associated value or nil if not found."
24
(gethash kw org-todo-keyword-map nil))
26
(defvar org-headline-rx (create-scanner "^([*]+)\\s+(.*)$"))
27
(defvar org-todo-keyword-rx (create-scanner "^(\\w+)\\s+(.*)$"))
28
(defvar org-file-property-rx (create-scanner "^[#][+](.*)[:]\\s+(.*)$"))
29
(defvar org-property-rx (create-scanner "^[:](.*)[:]\\s+(.*)$"))
30
(defvar org-priority-rx (create-scanner "^\\s*\\[#([A-Z0-9]+)\\]"))
31
(defvar org-property-start-rx (create-scanner "^[:]PROPERTIES[:]\\s*$"))
32
(defvar org-logbook-start-rx (create-scanner "^[:]LOGBOOK[:]\\s*$"))
33
(defvar org-end-rx (create-scanner "^[:]END[:]\\s*$"))
34
;; includes whitespace (need to trim-right)
35
(defvar org-planning-rx (create-scanner "^(SCHEDULED|DEADLINE|CLOSED)[:]\\s+(.*)\\s*$"))
36
(defvar org-scheduled-rx (create-scanner "\\<SCHEDULED:"))
37
(defvar org-deadline-rx (create-scanner "\\<DEADLINE:"))
38
(defvar org-src-block-rx (create-scanner "^\\([ ]*\\)#\\+begin_src[ ]+\\([^
46
\\)??[ ]*#\\+end_src"))
48
;; this doesn't consume leading whitespace. It could be useful in the
49
;; future to infer a value for org-tags-column but is contained in the
50
;; title slot of `org-headline' for now. The result of this scan is a
51
;; single string delimited by the ':' character. To get a list of tags
52
;; as strings, use `org-tag-split'.
53
(defvar org-tag-rx (create-scanner "(:[\\w_@#%:]+:)$"))
55
;; TODO 2023-12-21: for some reason CL-PPCRE:SPLIT isn't working as expected here.
56
(defun org-tag-split (tags)
57
(loop for tag in (uiop:split-string tags :separator '(#\: #\Space #\Tab))
58
unless (sequence:emptyp tag)
62
(create-scanner "\\(?:[_^][-{(*+.,[:alnum:]]\\)\\|[*+/=_~][^[:space:]]\\|\\<\\(?:b\\(?:bdb\\|ibtex\\)\\|d\\(?:enote\\|o\\(?:cview\\|i\\)\\)\\|e\\(?:l\\(?:feed\\|isp\\)\\|ww\\)\\|f\\(?:ile\\(?:\\+\\(?:\\(?:emac\\|sy\\)s\\)\\)?\\|tp\\)\\|gnus\\|h\\(?:elp\\|ttps?\\)\\|i\\(?:d\\|nfo\\|rc\\)\\|m\\(?:ai\\(?:lto\\|rix\\)\\|he\\)\\|n\\(?:ews\\|otmuch\\(?:-\\(?:search\\|tree\\)\\)?\\)\\|rmail\\|shell\\|w3m\\):\\|\\[\\(?:cite[:/]\\|fn:\\|\\(?:[0-9]\\|\\(?:%\\|/[0-9]*\\)\\]\\)\\|\\[\\)\\|@@\\|{{{\\|<\\(?:%%\\|<\\|[0-9]\\|\\(?:b\\(?:bdb\\|ibtex\\)\\|d\\(?:enote\\|o\\(?:cview\\|i\\)\\)\\|e\\(?:l\\(?:feed\\|isp\\)\\|ww\\)\\|f\\(?:ile\\(?:\\+\\(?:\\(?:emac\\|sy\\)s\\)\\)?\\|tp\\)\\|gnus\\|h\\(?:elp\\|ttps?\\)\\|i\\(?:d\\|nfo\\|rc\\)\\|m\\(?:ai\\(?:lto\\|rix\\)\\|he\\)\\|n\\(?:ews\\|otmuch\\(?:-\\(?:search\\|tree\\)\\)?\\)\\|rmail\\|shell\\|w3m\\)\\)\\|\\$\\|\\\\\\(?:[a-zA-Z[(]\\|\\\\[ ]*$\\|_ +\\)\\|\\(?:call\\|src\\)_"))
64
(defvar org-timestamp-rx
65
(create-scanner "[[<]\\([[:digit:]]\\{4\\}-[[:digit:]]\\{2\\}-[[:digit:]]\\{2\\}\\(?: .*?\\)?\\)[]>]\\|\\(?:<[0-9]+-[0-9]+-[0-9]+[^>
66
]+?\\+[0-9]+[dwmy]>\\)\\|\\(?:<%%\\(?:([^>
70
(create-scanner "<\\([[:digit:]]\\{4\\}-[[:digit:]]\\{2\\}-[[:digit:]]\\{2\\}\\(?: .*?\\)?\\)>")
71
"fast matching for timestamps")
73
(defvar org-table-any-line-rx (create-scanner "^[ \t]*\\(|\\|\\+-[-+]\\)"))
75
(defvar org-table-any-border-rx (create-scanner "^[ \t]*[^|+ \t]"))
77
(defvar org-tblfm-rx (create-scanner "^[ \t]*#\\+TBLFM: "))
79
(defvar org-footnote-definition-rx (create-scanner "^\\[fn:\\([-_[:word:]]+\\)\\]"))
81
(defvar org-list-full-item-rx
82
(create-scanner (concatenate 'string "^[ \t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)\\(?:[ \t]+\\|$\\)\\)"
83
"\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ \t]*\\)?"
84
"\\(?:\\(\\[[ X-]\\]\\)\\(?:[ \t]+\\|$\\)\\)?"
85
"\\(?:\\(.*\\)[ \t]+::\\(?:[ \t]+\\|$\\)\\)?"))
86
"Matches a list item and puts everything into groups:
90
group 4: description tag")
93
(create-scanner "^[ t]*\\(\\(?:[-+*]\\|\\(?:[0-9]+\\|[A-Za-z]\\)[.)]\\)\\(?:[ t]+\\|$\\)\\)\\(?:\\[@\\(?:start:\\)?\\([0-9]+\\|[A-Za-z]\\)\\][ t]*\\)?\\(?:\\(\\[[ X-]\\]\\)\\(?:[ t]+\\|$\\)\\)?\\(?:\\(.*\\)[ t]+::\\(?:[ t]+\\|$\\)\\)?")
94
"The correct regular expression for plain lists.")
96
(defvar *org-duration-hmm-rx* (create-scanner "\\`[ \t]*[0-9]+\\(?::[0-9]\\{2\\}\\)\\{1,2\\}[ \t]*\\'")
97
"Regexp matching a duration expressed with H:MM or H:MM:SS format.
98
See *org-duration-hmmss-rx* to only match the latter. Hours
99
can use any number of digits.")
101
(defvar *org-duration-hmmss-rx* (create-scanner "\\`[ \t]*[0-9]+\\(?::[0-9]\\{2\\}\\)\\{2\\}[ \t]*\\'")
102
"Regexp matching a duration expressed H:MM:SS format.
103
See *org-duration-hmm-rx* to also support H:MM format. Hours
104
can use any number of digits.")
106
(defvar *org-duration-full-rx*
107
(create-scanner "\\`\\(?:[ ]*\\([0-9]+\\(?:\\.[0-9]*\\)?\\)[ ]*\\(min\\|[dhmwy]\\)\\)+[ ]*\\'")
108
"Regexp matching a duration expressed with units.")
110
(defvar *org-duration-mixed-rx*
111
(create-scanner "\\`\\(?1:\\([ ]*\\([0-9]+\\(?:\\.[0-9]*\\)?\\)[ ]*\\(min\\|[dhmwy]\\)\\)+\\)[ ]*\\(?2:[0-9]+\\(?::[0-9][0-9]\\)\\{1,2\\}\\)[ ]*\\'")
112
"Regexp matching a duration with units and H:MM or H:MM:SS format.")
114
(defvar *org-duration-units*
115
'(("min" . 1) ("h" . 60) ("d" . 1440) ("w" . 10080) ("m" . 43200)
118
(defun org-duration-p (str)
119
(or (scan *org-duration-full-rx* str)
120
(scan *org-duration-mixed-rx* str)
121
(scan *org-duration-hmm-rx* str)))
123
(defvar org-element-types
124
'(babel-call center-block clock comment comment-block diary-sexp drawer
125
dynamic-block example-block export-block fixed-width footnote-definition
126
headline horizontal-rule inlinetask item keyword latex-environment
127
node-property paragraph plain-list planning property-drawer quote-block
128
section special-block src-block table table-row verse-block)
129
"List of all org-element types provided by org-element.el in 'org-element-all-elements'")
131
(defvar org-element-objects
132
'(bold citation citation-reference code entity export-snippet
133
footnote-ref inline-babel-call inline-src-block italic
134
line-break latex-fragment link macro radio-target stat-cookie
135
strike-through subscript superscript table-cell target timestamp underline verbatim)
136
"List of all org-element objects provided by org-element.el in 'org-element-all-objects'")
138
(sb-int:defconstant-eqx +org-element-keywords+ #("NAME" "RESULTS" "HEADER" "CAPTION" "PLOT")
141
;; entities, latex-frag, sscript
142
(sb-int:defconstant-eqx +org-minimal-objects+
143
#(plain-text bold italic underline verbatim code strike-through
144
latex-fragment entity superscript subscript)
147
;; all except table cells and citation-refs
148
(sb-int:defconstant-eqx +org-standard-objects+
149
(sequence:concatenate #() +org-minimal-objects+
150
#(footnote-ref active-timestamp active-timestamp-range
151
inactive-timestamp inactive-timestamp-range