Commit 523e1cbdc9

523e1cbdc91190f9d71b501be9999fb754c76c67

parent: 1c5acfa411

Unsigned

cmc <hello@cleberg.net> · 2024-08-12 17:48 UTC

add org-mode-features post

Layout: unified · split

content/blog/2024-08-11-org-mode-features.org added +351
@@ -0,0 +1,351 @@
1#+date: <2024-08-12 Mon 12:48:00>
2#+title: My Top 8 Most Used Org-Mode Features
3#+description: Read about my personal favorite org-mode features and how I use them.
4#+filetags: :org-mode:
5#+slug: org-mode-features
6
7* Cycling (Folding)
8
9#+begin_quote
10[[https://git.sr.ht/~cyborg/cleberg.net/tree/main/item/content/blog/2024-08-11-org-mode-features.org#L7][View this section]] in org-mode.
11#+end_quote
12
13My absolute top-used feature is [[https://orgmode.org/manual/Global-and-local-cycling.html][global and local cycling]] and it's not even
14close. Being able to hit =S-TAB= and collapse all headings when opening a file
15or needing to see a file's headings is an under appreciated trait.
16
17** Local Cycling
18
19When focused on a heading, you can press =TAB= (=org-cycle=) to cycle that
20subtree among the states =folded=, =children=, and =subtree=.
21
22#+begin_src txt
23,-> FOLDED -> CHILDREN -> SUBTREE --.
24'-----------------------------------'
25#+end_src
26
27** Global Cycling
28
29If you're looking to cycle more than one subtree or heading at a time, you can
30press =S-TAB= or =C-u TAB= to cycle the entire buffer among the states
31=overview=, =contents=, and =show all=.
32
33#+begin_src txt
34,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
35'--------------------------------------'
36#+end_src
37
38** Default Views
39
40If you need to set a default view for a certain file, you can run =C-u C-u TAB=
41to set the =org-set-startup-visibility=. Alternatively, just put the following
42at the top of the buffer:
43
44#+begin_src org
45#+STARTUP: overview
46#+STARTUP: content
47#+STARTUP: showall
48#+STARTUP: show2levels
49#+STARTUP: show3levels
50#+STARTUP: show4levels
51#+STARTUP: show5levels
52#+STARTUP: showeverything
53#+end_src
54
55* TODO Lists
56
57#+begin_quote
58[[https://git.sr.ht/~cyborg/cleberg.net/tree/main/item/content/blog/2024-08-11-org-mode-features.org#L58][View this section]] in org-mode.
59#+end_quote
60
61Next up on in this post are [[https://orgmode.org/manual/TODO-Items.html][TODO Lists]]. Being able to combine note taking and
62reminders was the primary reason I switched to org-mode in the first place.
63
64TODO lists are more than just the Markdown equivalent of =- [ ] Task=. Instead,
65you can utilize org-mode's native functionality to dynamically create TODO
66items, have fast access to TODO states, log progress on tasks, clocking work
67time, prioritization, breaking down tasks into subtasks, and even using checkbox
68formatting as well.
69
70** Prioritizing Tasks
71
72One of my favorite ways to separate my tasks are to assign priorities. You can
73do this by placing a priority cookie into the headline of a TODO item.
74
75#+begin_src org
76,*** TODO [#A] My Task
77,*** TODO [#C] My Other Task
78#+end_src
79
80You can quickly shift priorities with =S-UP= and =S-DOWN=, as well as set the
81allowed priorities for a buffer with the following syntax:
82
83#+begin_src org
84#+PRIORITIES: A C B
85#+PRIORITIES: 1 10 5
86#+end_src
87
88** Deadlines
89
90Plans can be set per task by settings special keywords with a date. You can set
91a =DEADLINE= to note when the task will appear in the agenda or set the
92=SCHEDULED= variable to note when you plan to start working on the task.
93
94#+begin_src org
95,* TODO My Task
96DEADLINE: <2004-02-29 Sun>
97
98,* My Other Task
99SCHEDULED: <2004-12-25 Sat>
100#+end_src
101
102As a side note, I use [[https://www.beorgapp.com/][Beorg]] on iOS to sync and edit my org-mode files on the go.
103Within this app, I use the =SCHEDULED= variable by default and rely heavily on
104that variable to alert me of tasks with iOS native notifications.
105
106* Time Stamping
107
108#+begin_quote
109[[https://git.sr.ht/~cyborg/cleberg.net/tree/main/item/content/blog/2024-08-11-org-mode-features.org#L106][View this section]] in org-mode.
110#+end_quote
111
112Another great feature are the [[https://orgmode.org/manual/Dates-and-Times.html][dates and times]] functionalities within org-mode.
113Timestamps follow this format in org-mode:
114
115#+begin_src org
116,* An active timestamp
117<2006-11-01 Wed 19:15>
118
119,* An inactive timestamp
120[2006-11-01 Wed 19:15>
121
122,* Repeated timestamps
123<2006-11-01 Wed 19:15 +1m>
124
125,* Time range
126<2006-11-02 Thu 10:00-12:00>
127
128,* Date range
129<2004-08-23 Mon>--<2004-08-26 Thu>
130#+end_src
131
132In addition to the deadlines mentioned above, you can insert timestamps into any
133marker within the buffer with =C-c .= for an active timestamp and =C-c != for an
134inactive timestamp. You can read more on [[https://orgmode.org/manual/Creating-Timestamps.html][creating timestamps]] to figure out the
135different options available when creating timestamps.
136
137* Tags
138
139#+begin_quote
140[[https://git.sr.ht/~cyborg/cleberg.net/tree/main/item/content/blog/2024-08-11-org-mode-features.org#L137][View this section]] in org-mode.
141#+end_quote
142
143Next up are [[https://orgmode.org/manual/Tags.html][Tags]], which provide a way to document contexts within and across
144buffers and files.
145
146You can assign tags directly to headlines or at the file level and can contain
147letters, numbers, underscores, and the =@= symbol.
148
149#+begin_src org
150,#+FILETAGS: :Fruits:
151
152,* Pick fruits off the trees :work:
153,** Start with the orange grove :orange:tree:
154,*** TODO Pick bananas last :banana:
155#+end_src
156
157** Filtering and Searching by Tag
158
159You can search for tags with =C-c \= or open the org-agenda with =M-x org-agenda
160m= and search for a tag of your choosing.
161
162* Tables
163
164#+begin_quote
165[[https://git.sr.ht/~cyborg/cleberg.net/tree/main/item/content/blog/2024-08-11-org-mode-features.org#L162][View this section]] in org-mode.
166#+end_quote
167
168One of the most inconvenient parts of writing in Markdown was dealing with
169tables. In org-mode, [[https://orgmode.org/manual/Tables.html][Tables]] are a breeze due to Emacs's built-in table editor
170and formatter.
171
172** Built-In Table Editor
173
174With the built-in table editor, press =C-c |= to convert the active region to a
175table or create an empty table.
176
177When focused on a table, press =TAB= to re-align the table. There are more
178commands available to re-align, traverse, and edit cells and regions within
179tables in Emacs.
180
181For example, refer to the following table. This table uses the =TBLFM= variable
182to define functions that will apply to the cells within the table. When I press
183=C-c C-c=, the table cells updated to their resulting values.
184
185| N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
186|---+-----+-----+-----+-----------+------------|
187| / | < | | > | < | > |
188| 1 | 1 | 1 | 1 | 1 | 1 |
189| 2 | 4 | 8 | 16 | 1.4142136 | 1.1892071 |
190| 3 | 9 | 27 | 81 | 1.7320508 | 1.3160740 |
191|---+-----+-----+-----+-----------+------------|
192#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
193
194** Spreadsheet
195
196If you spend a lot of time in spreadsheets, you'll appreciate the Emacs Calc
197package, which Emacs uses to implement spreadsheet-like capabilities within
198org-mode tables.
199
200Read through the [[https://orgmode.org/manual/The-Spreadsheet.html][spreadsheet]] documentation to learn more about field references
201(=@ROW$COLUMN=), range references (=$1..$3=), coordinates, formulas, and more.
202
203For example, refer to the following table. Here is a table that computes the
204Taylor series of degree n at location x for a couple of functions. You can clear
205the values out of the =Result= column for each row, press =C-c C-c=, and watch
206as the table re-calculates the results for each.
207
208|---+-------------+---+-----+--------------------------------------|
209| | Func | n | x | Result |
210|---+-------------+---+-----+--------------------------------------|
211| # | exp(x) | 1 | x | 1 + x |
212| # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
213| # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
214| # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
215| # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
216| * | tan(x) | 3 | x | x pi / 180 + 5.72e-8 x^3 pi^3 |
217|---+-------------+---+-----+--------------------------------------|
218#+TBLFM: $5=taylor($2,$4,$3);n3
219
220Alternatively, you can also refer to the following table. This table will update
221to different values based on the =TBLFM= I select when I'm pressing =C-c C-c=.
222The results are =[1,2]= when focused on the first line and =[2,4]= when focused
223on the second line.
224
225| x | y |
226|---+---|
227| 1 | 2 |
228| 2 | 4 |
229#+TBLFM: $2=$1*1
230#+TBLFM: $2=$1*2
231
232* Source Code Blocks
233
234#+begin_quote
235[[https://git.sr.ht/~cyborg/cleberg.net/tree/main/item/content/blog/2024-08-11-org-mode-features.org#L232][View this section]] in org-mode.
236#+end_quote
237
238** Introduction to Source Code Blocks
239
240If you run a technical blog, write code frequently, or like to take notes with
241source code examples, you will appreciate the [[https://orgmode.org/manual/Working-with-Source-Code.html][source code]] functionality of
242org-mode.
243
244With this feature, org-mode can manage the source code you define with features
245such as editing, formatting, extracting, exporting, and publishing.
246Additionally, you can compile and execute source code dynamically within the
247org-mode file or buffer.
248
249A full source code block uses the following structure:
250
251#+begin_src org
252,#+NAME: <name>
253,#+BEGIN_SRC <language> <switches> <header arguments>
254 <body>
255,#+END_SRC
256#+end_src
257
258You can also use inline blocks:
259
260#+begin_src org
261src_<language>[<header arguments>]{<body>}
262#+end_src
263
264** Editing Source Code Blocks
265
266When focused on a code block, press =C-c'= to edit the code block in a special
267editor. Press =C-x C-x= to save the buffer and =C-c '= again to close the
268buffer.
269
270** Syntax Highlighting and Formatting
271
272Emacs provides syntax highlighting by default within org-mode's source code
273blocks. Org-mode will copy the text to a temporary buffer, highlight it using
274the major mode relevant to the language (e.g., [[https://www.gnu.org/software/emacs/manual/html_mono/ccmode.html][CC Mode]]), and then return the
275resulting highlighted text.
276
277** Buffer Evaluation
278
279By default, org-mode will only evaluate Emacs Lisp code blocks. You will need to
280enable other [[https://orgmode.org/manual/Languages.html][languages]] in order to evaluate code blocks written in languages
281other than elisp.
282
283When focused on a code block, you can execute the block with =C-c C-c=. The
284results of the evaluation will appear below the code block in a =RESULTS= block.
285
286For example, here is a code block in elisp that I have written and evaluated with
287org-mode inside this blog post. I will press =C-c C-c= and you will see the
288results below the code block.
289
290#+begin_src elisp
291(defun greet-me ()
292 (message "Hello, world!"))
293
294(greet-me)
295#+end_src
296
297#+begin_src org
298,#+RESULTS:
299: Hello, world!
300#+end_src
301
302* Exporting and Publishing
303
304#+begin_quote
305[[https://git.sr.ht/~cyborg/cleberg.net/tree/main/item/content/blog/2024-08-11-org-mode-features.org#L302][View this section]] in org-mode.
306#+end_quote
307
308I would be remiss if I did not mention the native [[https://orgmode.org/manual/Exporting.html][exporting and publishing]]
309functionality within Emacs and org-mode.
310
311** Built-In Publishing
312
313This functionality allows you to translate Org to the following formats
314(additional formats may be available via external packages):
315
316- ascii (ASCII format)
317- beamer (LaTeX Beamer format)
318- html (HTML format)
319- icalendar (iCalendar format)
320- latex (LaTeX format)
321- md (Markdown format)
322- odt (OpenDocument Text format)
323- org (Org format)
324- texinfo (Texinfo format)
325- man (Man page format)
326
327 You can export with =C-c C-h= and then select your preferred destination
328 format. For example, an export from org to HTML as a file would use =C-c C-e h
329 h=.
330
331** External Publishing Tools
332
333If the native functionality isn't useful enough for you, there are a myriad of
334external [[https://orgmode.org/tools.html][tools]], including [[https://orgmode.org/worg/org-blog-wiki.html][blogs and wikis]], that work with org-mode.
335
336* Agenda
337
338#+begin_quote
339[[https://git.sr.ht/~cyborg/cleberg.net/tree/main/item/content/blog/2024-08-11-org-mode-features.org#L339][View this section]] in org-mode.
340#+end_quote
341
342Last, but not least, are [[https://orgmode.org/manual/Agenda-Views.html][Agenda Views]]. With agenda views, you can easily view
343your agenda of TODO items, scheduled items, projects, etc. across your
344collection of org-mode files.
345
346Org-mode will extract all of this information from your org files
347(=org-agenda-files=) and display it within the agenda buffer.
348
349You can open the agenda with =M-x org-agenda=. Once inside the buffer, you can
350use shortcuts in the [[https://orgmode.org/manual/Agenda-Dispatcher.html][Agenda Dispatcher]] to quickly view calendars, TODOs, create
351items, filter items, and more.
theme/templates/index.html +6 −7
@@ -8,6 +8,12 @@ uid [ultimate] Christian Cleberg &lt;hello@cleberg.net&gt;</pre>
88<section>
99 <h2>Recent Blog Posts</h2>
1010
11 <div class="post">
12 <time date="2024-08-11 20:18:15">2024-08-11</time>
13 <a href="/blog/org-mode-features.html"
14 >My Top 8 Most Used Org-Mode Features</a
15 >
16 </div>
1117 <div class="post">
1218 <time datetime="2024-07-11 20:24:02">2024-07-11</time>
1319 <a href="/blog/emacs-on-ipad.html">Emacs on iPadOS</a>
@@ -20,13 +26,6 @@ uid [ultimate] Christian Cleberg &lt;hello@cleberg.net&gt;</pre>
2026 >
2127 </div>
2228
23 <div class="post">
24 <time datetime="2024-05-03 00:00:00">2024-05-03</time>
25 <a href="/blog/ubuntu-on-macos.html"
26 >Running Ubuntu Linux on macOS with OrbStack</a
27 >
28 </div>
29
3029 <br />
3130 <a href="/blog/">All Posts →</a>
3231</section>