Coverage report: /home/ellis/comp/core/lib/organ/vars.lisp

KindCoveredAll%
expression23137 16.8
branch22100.0
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 (in-package :organ)
2
 
3
 (defparameter *org-todo-keyword-types*
4
   '(todo wip done))
5
 
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'. ")
12
 
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))
17
     kws))
18
 
19
 (defvar org-todo-keyword-map (org-todo-keyword-map))
20
 
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))
25
 
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[     ]+\\([^         
39
  ]+\\)[        ]*\\([^\":
40
 ]*\"[^\"
41
 *]*\"[^\":
42
 ]*\\|[^\":
43
 ]*\\)\\([^
44
 ]*\\)
45
 \\([^�]*?
46
 \\)??[  ]*#\\+end_src"))
47
 
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_@#%:]+:)$"))
54
 
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)
59
           collect tag))
60
 
61
 (defvar org-object-rx 
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\\)_"))
63
 
64
 (defvar org-timestamp-rx
65
   (create-scanner "[[<]\\([[:digit:]]\\{4\\}-[[:digit:]]\\{2\\}-[[:digit:]]\\{2\\}\\(?: .*?\\)?\\)[]>]\\|\\(?:<[0-9]+-[0-9]+-[0-9]+[^>
66
 ]+?\\+[0-9]+[dwmy]>\\)\\|\\(?:<%%\\(?:([^>
67
 ]+)\\)>\\)"))
68
 
69
 (defvar org-ts-rx
70
   (create-scanner "<\\([[:digit:]]\\{4\\}-[[:digit:]]\\{2\\}-[[:digit:]]\\{2\\}\\(?: .*?\\)?\\)>")
71
   "fast matching for timestamps")
72
 
73
 (defvar org-table-any-line-rx (create-scanner "^[ \t]*\\(|\\|\\+-[-+]\\)"))
74
 
75
 (defvar org-table-any-border-rx (create-scanner "^[ \t]*[^|+ \t]"))
76
 
77
 (defvar org-tblfm-rx (create-scanner "^[ \t]*#\\+TBLFM: "))
78
 
79
 (defvar org-footnote-definition-rx (create-scanner "^\\[fn:\\([-_[:word:]]+\\)\\]"))
80
 
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:
87
 group 1: bullet
88
 group 2: counter
89
 group 3: checkbox
90
 group 4: description tag")
91
 
92
 (defvar org-item-rx
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.")
95
 
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.")
100
 
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.")
105
 
106
 (defvar *org-duration-full-rx*
107
   (create-scanner "\\`\\(?:[    ]*\\([0-9]+\\(?:\\.[0-9]*\\)?\\)[       ]*\\(min\\|[dhmwy]\\)\\)+[      ]*\\'")
108
   "Regexp matching a duration expressed with units.")
109
 
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.")
113
 
114
 (defvar *org-duration-units*
115
   '(("min" . 1) ("h" . 60) ("d" . 1440) ("w" . 10080) ("m" . 43200)
116
     ("y" . 525960.0)))
117
 
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)))
122
 
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'")
130
 
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'")
137
 
138
 (sb-int:defconstant-eqx +org-element-keywords+ #("NAME" "RESULTS" "HEADER" "CAPTION" "PLOT")
139
   #'equalp)
140
 
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)
145
   #'equalp)
146
 
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
152
                           stat-cookie))
153
   #'equalp)