changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > org > meta / ulang.org

changeset 9: 995df3d48af0
parent: 4728f14839e4
author: Richard Westhaver <ellis@rwest.io>
date: Sat, 07 Sep 2024 22:38:02 -0400
permissions: -rw-r--r--
description: ulang
1 #+title: Universal Language
2 #+author: Richard Westhaver
3 #+email: ellis@rwest.io
4 #+setupfile: ../clean.theme
5 * Introduction
6 :PROPERTIES:
7 :ID: e63d129f-9024-4cd8-9e2c-77f4bc614663
8 :END:
9 
10 This document is for contributors and curious readers. It is a loose
11 specification which describes the fundamental rules of how we write in
12 prose, documentation, and other contexts.
13 
14 All sources we write attempt to comply to this specification but it is
15 never /strictly/ enforced. If there is a reason to not comply with a
16 rule, it is already broken.
17 
18 #+begin_quote
19 Every investigation, including the present one, has to be communicated
20 from one person to another by means of language. It is expedient to
21 begin our study by calling attention to this obvious fact, by giving a
22 name to the language being used, and by being explicit about a few of
23 its features. We shall call the language being used the
24 U-Language. [...] There would be no point in calling attention to it,
25 if it were not for the fact that language is more intimately related
26 to our job than of most others. -- [[https://iep.utm.edu/haskell-brooks-curry/][Haskell Curry]]
27 #+end_quote
28 
29 In this document, we will be calling attention to our own
30 language - examining it, and describing how it works.
31 
32 Our job is to solve problems. Hard problems preferred. So we ought to
33 pay close attention to the language we use because it brings the
34 reader and writer /closer/ to the problem at hand.
35 
36 We are primarily concerned with /written languages/ like the one
37 you're reading now. We will skip past the obvious details - English is
38 our primary form of communication for example. The line you are
39 reading currently is a sentence which is part of a paragraph.
40 
41 ** Org Mode
42 :PROPERTIES:
43 :ID: 98a02bb2-3f39-49c6-898a-68ccd8f3cbe1
44 :END:
45 [[https://www.gnu.org/software/emacs/][GNU Emacs]] is our text editor, so naturally [[https://orgmode.org/][Org Mode]] is our word
46 processor.
47 
48 If you are already familiar with Emacs and Org-Mode, I recommend
49 opening the source of this document in Emacs and following along.
50 
51 If not, I recommend browsing through the [[https://orgmode.org/worg/][Worg resources]], but we won't
52 be getting too deep into tribal hacker knowledge of Emacs.
53 
54 * ulang
55 :PROPERTIES:
56 :CUSTOM_ID: ulang
57 :ID: 236227a5-b30c-4548-8cad-360428d74d67
58 :END:
59 Our *U-Language* is colloquially termed *ulang*. Each section of this
60 document describes an Org syntax component and how it is used in our
61 writing.
62 ** Emphasis
63 :PROPERTIES:
64 :ID: 88bf1177-b5b7-4945-8bdc-5229803e617e
65 :END:
66 [[https://orgmode.org/manual/Emphasis-and-Monospace.html][Text Emphasis]] in Org covers the range you would expect from any other
67 markup:
68 #+name: org-emphasis
69 #+begin_src org :results replace
70  - *bold*
71  - /italic/
72  - _underlined_
73  - =verbatim=
74  - ~code~
75  - +strike-through+
76 #+end_src
77 
78 #+RESULTS: org-emphasis
79 - *bold*
80 - /italic/
81 - _underlined_
82 - =verbatim=
83 - ~code~
84 - +strike-through+
85 \
86 - Text emphasis markers /may/ appear in code comments as long as they do
87  not cause any conflicts with the host language, although they /should/
88  be restricted to the =Commentary= section.
89 - ~code~ may sometimes be written instead with =verbatim= emphasis -
90  the distinction is only important for specific export backends which
91  support it - see [[https://emacs.stackexchange.com/a/77822][this thread]] for details.
92 ** Links
93 :PROPERTIES:
94 :ID: 7ecaec5d-c656-44e1-8fad-185915655cee
95 :END:
96 Org [[https://orgmode.org/guide/Hyperlinks.html][Links]] are wrapped in brackets like so:
97 
98 #+name: org-links
99 #+begin_src org
100  [[LINK][DESCRIPTION]]
101  ;; or without description
102  [[LINK]]
103 #+end_src
104 
105 - LINK is a URI like https://google.com
106 - DESCRIPTION is optional
107 
108 *** Internal Links
109 :PROPERTIES:
110 :ID: a867de82-8558-4277-b9d6-b5d3226f73d1
111 :END:
112 [[https://orgmode.org/manual/Internal-Links.html][Internal Links]]
113 *** External Links
114 :PROPERTIES:
115 :ID: 6aedc026-36d0-4763-adc8-8ae1a79f1b3e
116 :END:
117 Org has built-in support for many different types of [[https://orgmode.org/guide/Hyperlinks.html#External-Links-1][External Links]],
118 which are URL-like locators. We also define some custom link types
119 which are used throughout our documentation /and/ code.
120 
121 ** Headings
122 :PROPERTIES:
123 :ID: ed035298-f7fa-4726-ad58-2d542323bb61
124 :END:
125 In Org, headings can be summarize as any line starting with a star: =*
126 H1=. Headings can be nested or 'demoted' by prepending another star:
127 =** H2=.
128 
129 #+name: org-headings
130 #+begin_src org
131 ,* H1
132 ,** H2
133 ,*** H3
134 ,** H2
135 ,* H1
136 #+end_src
137 
138 This is a useful pattern which we apply outside of Org - most commonly
139 in our code comments.
140 
141 In our source code, we use the comment character instead of a star:
142 #+name: lisp-headings
143 #+begin_src lisp
144 ;;; foo
145 (print "H1") ;; just an inline comment
146 ;;;; bar
147 (print "H2")
148 ;;; baz
149 (print "H1")
150 #+end_src
151 
152 #+name: rust-headings
153 #+begin_src rust
154  /// foo
155  println!("H1");
156  //// bar
157  println!("H2");
158  /// baz
159  println!("H1");
160 #+end_src
161 
162 ** Todo Keywords
163 :PROPERTIES:
164 :ID: 2cadda9a-22a3-4b42-ad4e-d7a774f74cba
165 :END:
166 
167 TODO keywords are often used to keep track of the state of a [[https://orgmode.org/manual/TODO-Items.html][TODO
168 Item]], but may also be [[https://orgmode.org/manual/TODO-Extensions.html][extended]] to support a variety of stateful item
169 types beyond just simple tasks.
170 
171 We /do not/ specify any
172 
173 The following keywords form the simple set of task states.
174 
175 - TBD
176 - TODO
177 - WIP
178 - HOLD
179 - WAIT
180 - DONE
181 - NOPE
182 
183 #+begin_src org
184  ,* PROJECT project
185  ,** DONE foo
186  ,** TODO bar
187  ,** TBD baz
188  ,** WIP test foo
189 #+end_src
190 
191 ** Tags
192 :PROPERTIES:
193 :ID: a7ae1b2a-559e-46e9-8cab-33e39a218288
194 :END:
195 [[https://orgmode.org/manual/Tags.html][Tags]] are used liberally throughout our documents. They are simple
196 strings usually following a headline as a =:=-separated list.
197 
198 A tag can be any text without newlines, although it is recommended to
199 treat them as unique identifiers and usage of whitespace is
200 discouraged (but not disallowed).
201 
202 #+begin_src org
203  ,* foobar :tag1:tag2:@home:!today
204 #+end_src
205 *** Tag Prefixes
206 :PROPERTIES:
207 :ID: b686dbc5-3505-49d7-b66a-0772bcf1a726
208 :END:
209 Some of ourtags are prefixed with a character which indicates a
210 special tag category:
211 - =@= :: location-tag \\
212  A /location tag/ refers to some context-dependent named point in
213  space, such as a user's home address, a popular fast food
214  restaurant, or a specific room found in most houses.
215  - =@home=, =@taco-bell=, =@bedroom=
216 - =!= :: timestamp-tag \\
217  /Timestamp tags/ refer to some point in time, often named for
218  convenience. You may use literal [[https://orgmode.org/manual/Timestamps.html][Timestamps]] too. Timestamp tags
219  should not /directly reference/ scheduling information, doing so is
220  often a code-smell.
221  - =!now=, =!christmas=, =!someday=
222 - =#= :: anchor-tag \\
223  An /anchor tag/ implies a link to the object identified by some [[id:3944c851-e46c-4d75-b8f5-07b5c052177a][ID]].
224  - =#readme=, =#a7ae1b2a-559e-46e9-8cab-33e39a218288=, =#custom-id=
225 ** Properties
226 :PROPERTIES:
227 :ID: 174a993b-a5dc-4324-b4f8-dda8101a55b7
228 :END:
229 [[https://orgmode.org/manual/Properties-and-Columns.html][Properties]] are key:value pairs which are associated with a heading or
230 file and stored in a dedicated [[https://orgmode.org/manual/Drawers.html][Drawer]].
231 
232 #+begin_src org
233  ,* WIP do stuff :@lab:
234  :PROPERTIES:
235  :CREATED: <2024-08-24 Sat 19:09>
236  :ID: 62da3982-7a83-4b27-ab7e-55949fd3e2a3
237  :EFFORT: 24:00
238  :END:
239 #+end_src
240 *** ID
241 :PROPERTIES:
242 :ID: 3944c851-e46c-4d75-b8f5-07b5c052177a
243 :END:
244 Org supports two built-in identifier properties:
245 - ID :: Unique, machine-generated
246 - CUSTOM_ID :: User-defined
247 
248 These IDs don't add any information for the reader - the IDs are used
249 to index and associate headings. All headings are assigned an ID
250 automatically which should never be changed.
251 
252 CUSTOM_IDs are for convenience and extensions, but are rarely
253 necessary given the many ways of identifying a headline.
254 ** File Keywords
255 :PROPERTIES:
256 :ID: 27141c7a-e903-4909-890f-b496716a48ba
257 :END:
258 File keywords, also known as [[https://orgmode.org/manual/In_002dbuffer-Settings.html][In-Buffer Settings]] are similar to
259 properties in the sense that they are key/value pairs, but they only
260 appear at the top of a file before any content and use a different
261 syntax.
262 
263 #+begin_src org
264  ,#+title: some file title
265  ,#+author: some user
266  ,#+PROPERTY DESCRIPTION assigning a property via file keyword
267  some content
268  ,* a headline
269  :PROPERTIES:
270  :DESCRIPTION: just a property, not a file keyword
271  :END:
272 #+end_src
273 
274 ** Tables
275 :PROPERTIES:
276 :ID: be4c4c52-4353-45df-b2ab-1e72f392008d
277 :END:
278 Org [[https://orgmode.org/manual/Tables.html][Tables]] offer some pretty advanced spreadsheet capabilities which
279 we won't delve into here. Plain tables can be identified in documents by lines
280 starting with the =|= character:
281 #+begin_src org :results replace
282  | col1 | col2 | col3 |
283  |------+------+------|
284  | 1 | foo | bar |
285 #+end_src
286 
287 #+RESULTS:
288 | col1 | col2 | col3 |
289 |------+------+------|
290 | 1 | foo | bar |
291 
292 ** Blocks
293 :PROPERTIES:
294 :ID: d5a09bc6-07de-4812-ab2e-f5ead1e0d8a7
295 :END:
296 Org [[https://orgmode.org/manual/Blocks.html][Blocks]] consist of a body wrapped in a pair of lines which look
297 like [[id:27141c7a-e903-4909-890f-b496716a48ba][File Keywords]] prepended with =BEGIN_= and =END_=.
298 
299 Simple blocks such as =example= and =center= only have a special
300 meaning during publishing:
301 #+begin_src org :results replace drawer
302  ,#+begin_example
303  this is an example block
304  ,#+end_example
305 
306  ,#+begin_center
307  this is a centered block
308  ,#+end_center
309 #+end_src
310 
311 #+RESULTS:
312 :results:
313 #+begin_example
314 this is an example block
315 #+end_example
316 
317 #+begin_center
318 this is a centered block
319 #+end_center
320 :end:
321 *** Code Blocks
322 :PROPERTIES:
323 :ID: 0784d230-95b0-4135-a52f-6be4e2d5d80a
324 :END:
325 [[https://orgmode.org/manual/Working-with-Source-Code.html][Code Blocks]] are used to embed source code into a document. They always
326 start with =#+BEGIN_SRC= and end with =#+END_SRC=:
327 
328 #+begin_src org :results replace drawer
329  ,#+begin_src emacs-lisp
330  (message "an emacs-lisp code block inside an org document")
331  ,#+end_src
332 #+end_src
333 
334 #+RESULTS:
335 :results:
336 #+begin_src emacs-lisp
337  (message "an emacs-lisp code block inside an org document")
338 #+end_src
339 :end:
340 
341 You can embed virtually any type of source code in side a code block,
342 execute it in-place, and control how both the source code and results
343 are presented in the document. Source code blocks may also be
344 collected in a [[file:babel.org][Library of Babel]] and re-used across many documents.
345 
346 *** Dynamic Blocks
347 :PROPERTIES:
348 :ID: 8898387c-2c84-4f56-80ee-d03daebd0990
349 :END:
350 [[https://orgmode.org/manual/Dynamic-Blocks.html][Dynamic Blocks]] as the name implies are blocks with contents that are
351 dynamically updated. These blocks always begin with =#+BEGIN:=
352 followed by a space, the name of the dynamic block and any parameter
353 values, and end with =#+END:=. The dynamic block name is taken from
354 the name of a function which matches =org-dblock-write:NAME=. This
355 function is called with the parameter values and replaces the body of
356 the block.
357 
358 The only built-in dynamic block is the =clocktable=:
359 #+begin_src org :results replace drawer
360  ,#+BEGIN: clocktable
361  ,#+CAPTION: Clock summary at [2024-09-06 Fri 15:23]
362  | Headline | Time |
363  |--------------+--------|
364  | *Total time* | *0:00* |
365  ,#+END:
366 #+end_src
367 
368 #+RESULTS:
369 :results:
370 #+BEGIN: clocktable
371 #+CAPTION: Clock summary at [2024-09-06 Fri 15:23]
372 | Headline | Time |
373 |--------------+--------|
374 | *Total time* | *0:00* |
375 #+END:
376 :end:
377 
378 Dynamic blocks are designed for user extension and are a powerful tool
379 to programatically summarize information.