how I use org-mode

This commit is contained in:
Yann Esposito (Yogsototh) 2020-10-29 09:54:07 +01:00
parent 0032a6150d
commit b37269f840
Signed by untrusted user who does not match committer: yogsototh
GPG Key ID: 7B19A4C650D59646
4 changed files with 298 additions and 45 deletions

View File

@ -44,6 +44,7 @@ goblins.
Those costume looks very bad and cheap.
So much you can only find them not terrorizing but funny and ridiculous.
#+ATTR_ORG: :width 560
#+ATTR_HTML: A goblin
#+CAPTION: One goblin during the introduction scene of Troll 2
#+NAME: fig:troll-2-intro
@ -55,6 +56,7 @@ To give you an idea, the only equal bad acting I ever witnessed was while
looking at amateurs first Youtube movies trying to follow a scenario.
Apparently most actors were amateurs, it was their first and last movie.
#+ATTR_ORG: :width 560
#+ATTR_HTML: A bad acting demonstration
#+CAPTION: One particularly terrible acting scene
#+NAME: fig:bad-acting
@ -83,6 +85,7 @@ They win against the monsters with, what I believe was a failed attempt at
humor.
It misses the point so bad, that the irony still make it funny.
#+ATTR_ORG: :width 560
#+ATTR_HTML: Eliott prevents his family to eat the food by urinating on the table
#+CAPTION: Our hero save the day by urinating on the table. His family is frozen for 30s said grandpa, they were for 70s.
#+NAME: fig:prevent-eating

View File

@ -10,7 +10,7 @@
#+LANGUAGE: en
#+LANG: en
#+OPTIONS: H:5 auto-id:t
#+STARTUP: showeverything
+STARTUP: showeverything
This week I didn't take a look at HN to grab some news.
And this week-end, in the morning I read those:
@ -19,6 +19,7 @@ And this week-end, in the morning I read those:
- [[https://news.ycombinator.com/item?id=23107123][Making Emacs popular again]]
- [[https://news.ycombinator.com/item?id=23092904][Github Codespace]]
#+ATTR_ORG: :width 560
#+ATTR_HTML: :alt Midsommar Welcome
#+NAME: Welcome to Halsingland
#+CAPTION: Welcome to Halsingland
@ -92,6 +93,7 @@ For the single developers and open source developers this offer:
But the price to pay is hidden.
#+ATTR_ORG: :width 560
#+ATTR_HTML: :alt Midsommar Sorrow
#+CAPTION: Midsommar Sorrow
[[file:midsommar-cry.jpg]]
@ -177,6 +179,7 @@ future.
:CUSTOM_ID: post-conclusion
:END:
#+ATTR_ORG: :width 560
#+ATTR_HTML: :alt Midsommar Joy
#+CAPTION: Midsommar Joy
[[./midsommar-joy.jpg]]

View File

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 179 KiB

View File

@ -4,7 +4,7 @@
#+TITLE: How I use org-mode
#+AUTHOR: Yann Esposito
#+EMAIL: yann@esposito.host
#+DATE: [2019-09-30 Mon]
#+DATE: [2020-10-29 Thu]
#+KEYWORDS: org-mode
#+DESCRIPTION: How I use org-mode
#+OPTIONS: auto-id:t toc:t
@ -16,33 +16,45 @@ I use org mode for:
- tasks management & time tracking
- writing documents (articles, book, etc...)
- note taking ; which I consider slightly different from just writing documents
TL;DR:
- =SPC y a= ⇒ Show agenda view for today
- =SPC X= ⇒ Capture a new task, write a description, then =C-c C-c=, save
that in =tracker.org= (or =inbox.org= depending of the capture template)
- =SPC n o= ⇒ jump to the current time tracked tasks
- =SPC m c o= ⇒ stop the clock on that task; if you capture a new time
tracking tasks you don't need to clock-out
- =SPC y o r==org-refile=, meaning move that task somewhere else
- =SPC q= ⇒ add/remove tags to that task
#+end_abstract
In this article I would like to share a tool that was a real life changer
to me: [[http://orgmode.org][org mode]].
I use it for a few years now.
And for me emacs is worth learning just for org-mode.
In my opinion emacs is worth learning just for org-mode.
This is by far the best solution I ever used to manage my tasks.
More than that, the solution is so versatile that the power is decupled by
all the plugins, tools, libs that work around org-mode.
Also the tool will adapt to your very specific needs.
I tried a lot of differents tools before it, and this is the only one I
really stick with.
It is so versatile that it can adapt to your very specific needs.
Mainly the major problem I see with most tasks management applications is
the wrong level of complexity facing the user.
The major difficulty faced by tasks management application is the wrong
level of complexity facing the user.
This is a very hard problem to tackle.
If your system is too simple, the users will not be able to manage the
tasks how they would like.
If your system is too complex, the user will be faced with too much details.
If your system is too complex, the user will be faced with too much
details.
So most successful systems have a way to adapt their apparent complexity to
the need of their users.
And org mode is exactly like that.
Not only starting with org mode can be extremely simple but also there are
mostly no complexity limit.
Whatever your need most of the time there is already an emacs package that
take cares of that.
Even if this is not the case, it is easy to write your own.
Either org mode already handle one of your need, or most of the time you
will find a package to fulfill your need.
And if not, it is easy to write your own.
Here is the result of a few years of improving my use of org mode.
Today I can say that org mode is part of my day to day life.
@ -67,6 +79,11 @@ What are urgent tasks, deadlines, tasks that have deadlines in a few days, etc..
I also have a glimpse of my habits, tasks that I should start at some hour
in the day, etc...
#+ATTR_ORG: :width 560
#+CAPTION: Org super calendar view
#+NAME: fig:org-super-agenda
[[./img/org-super-agenda.png]]
I then start to track (/clock/) the tasks I'm currently working on.
Often during the day, I need to create new tasks.
@ -98,19 +115,16 @@ in my notes.
Writing documents with org mode and in particular technical document is
just incredible.
So at first writing document with org mode is a lot like writing markdown.
Neat, there are a few minor differences.
The org mode format is not only intended to be exported to HTML only so
there are a few differences.
Org mode feels a lot like markdown.
Where org mode shine is with the use of *org-babel*.
But org mode shine with its use of *org-babel*.
*org-babel* is used to execute code inside your document.
So you can execute block of code and get their result in block of code.
For technical writing this is extremely useful.
Mainly you can write code that will make real HTTP call, execute real
functions in the language of your choice.
I wrote most part of an OAuth2 provider in Clojure.
And to generate a documentation for our users it is very nice to provide
the full HTTP request along the response.
For example, I wrote most part of an OAuth2 provider in Clojure.
And to generate a documentation to some of our advanced users it is very
nice to provide the full HTTP request along the response.
But I also often need to play a few tricks in the doc and directly use our
Clojure code to generate JWT for example.
@ -137,7 +151,7 @@ Mainly you capture notes quite easily and put links about the subject, but
also tags.
In the end that generate a graph of notes that you could use later to dig
into your own notes.
*** journaling
*** journal
:PROPERTIES:
:CUSTOM_ID: journaling
:END:
@ -153,6 +167,8 @@ And I guess it is different for anyone of us.
:CUSTOM_ID: task-management
:END:
So here is a more detailed description about my org mode usage.
*** Workflow 1; planned tasks : org-agenda + clock
:PROPERTIES:
:CUSTOM_ID: worfklow-1--planned-tasks---org-agenda---clock
@ -167,7 +183,7 @@ I work most of my using emacs[fn:emacs-digression].
Generally the first thing I do in the morning is opening `org-calendar`.
It looks like this:
#+ATTR_ORG: :width 400
#+ATTR_ORG: :width 560
#+CAPTION: Org super calendar view
#+NAME: fig:org-super-agenda
[[./img/org-super-agenda.png]]
@ -283,26 +299,26 @@ All tasks nicely clocked.
I generally create a clock report that look like this:
#+BEGIN_SRC
#+BEGIN: clocktable :scope subtree :maxlevel 4 :timestamp t
#+BEGIN: clocktable :scope subtree :maxlevel 4 :timestamp t :narrow 36! :match "work"
#+CAPTION: Clock summary at [2020-09-23 Wed 08:20]
| Timestamp | Headline | Time | | | |
|------------------------+------------------------------------------------+--------+---+------+------|
| | *Total time* | *6:40* | | | |
|------------------------+------------------------------------------------+--------+---+------+------|
| | \_ 2020-09-21 Monday | | | 7:40 | |
| [2020-09-21 Mon 08:54] | \_ check chat | | | | 0:36 |
| [2020-09-21 Mon 09:30] | \_ check reviews | | | | 0:41 |
| [2020-09-21 Mon 10:11] | \_ check emails | | | | 0:07 |
| [2020-09-21 Mon 10:37] | \_ review PR about xxx | | | | 0:44 |
| [2020-09-21 Mon 11:21] | \_ update my PR from feedbacks | | | | 0:36 |
| [2020-09-21 Mon 12:08] | \_ review John's PR about Foo | | | | 0:12 |
| [2020-09-21 Mon 13:41] | \_ review M's PR about Bar | | | | 0:11 |
| [2020-09-21 Mon 13:53] | \_ another thing | | | | 0:16 |
| [2020-09-21 Mon 14:09] | \_ review PR | | | | 0:51 |
| [2020-09-21 Mon 15:00] | \_ work on PR | | | | 1:30 |
| [2020-09-21 Mon 16:49] | \_ check another PR | | | | 0:33 |
| [2020-09-21 Mon 17:03] | \_ answer email | | | | 0:55 |
| [2020-09-21 Mon 17:58] | \_ Chat John about X | | | | 0:28 |
| Timestamp | Headline | Time | | | |
|------------------------+--------------------------------------+--------+---+------+------|
| | *Total time* | *6:40* | | | |
|------------------------+--------------------------------------+--------+---+------+------|
| | \_ 2020-09-21 Monday | | | 7:40 | |
| [2020-09-21 Mon 08:54] | \_ check chat | | | | 0:36 |
| [2020-09-21 Mon 09:30] | \_ check reviews | | | | 0:41 |
| [2020-09-21 Mon 10:11] | \_ check emails | | | | 0:07 |
| [2020-09-21 Mon 10:37] | \_ review PR about xxx | | | | 0:44 |
| [2020-09-21 Mon 11:21] | \_ update my PR from feedbacks | | | | 0:36 |
| [2020-09-21 Mon 12:08] | \_ review John's PR about Foo | | | | 0:12 |
| [2020-09-21 Mon 13:41] | \_ review M's PR about Bar | | | | 0:11 |
| [2020-09-21 Mon 13:53] | \_ another thing | | | | 0:16 |
| [2020-09-21 Mon 14:09] | \_ review PR | | | | 0:51 |
| [2020-09-21 Mon 15:00] | \_ work on PR | | | | 1:30 |
| [2020-09-21 Mon 16:49] | \_ check another PR | | | | 0:33 |
| [2020-09-21 Mon 17:03] | \_ answer email | | | | 0:55 |
| [2020-09-21 Mon 17:58] | \_ Chat John about X | | | | 0:28 |
#+END_SRC
@ -327,9 +343,240 @@ file.
And it will appear in my agenda.
*** Configuration
:PROPERTIES:
:CUSTOM_ID: configuration
:END:
So to have all of that, I added a lot of configuration over time.
But here is the most important part.
Most of that config is what I personally think are better defaults.
And a minor part of it only is about how I organize myself.
#+BEGIN_SRC emacs-lisp
(defun org-mode-config ()
"Org-mode."
(setq org-extend-today-until 4
org-use-effective-time t)
(setq org-todo-keywords
'((sequence "TODO(t)"
"IN-PROGRESS(p)"
"|"
"DONE(d)"
"HOLD(h@/!)"
"CANCELED(c@/!)"
"HANDLED(l@/!)")
(sequence "|" "PAUSE(p)" "CHAT(c)" "EMAIL(e)" "MEETING(m)" "REVIEW(r)" "GEEK(g)")))
;;; Look & Feel
;; I like to have something different than ellipsis because I often use them
;; myself.
(setq org-ellipsis " [+]")
(custom-set-faces '(org-ellipsis ((t (:foreground "gray40" :underline nil)))))
(defun my-org-settings ()
(org-display-inline-images)
(setq fill-column 75)
(abbrev-mode)
(org-indent-mode)
nil)
(add-hook 'org-mode-hook #'my-org-settings)
(setq org-tags-column 69)
;; src block indentation / editing / syntax highlighting
(setq org-src-fontify-natively t
org-src-window-setup 'current-window ;; edit in current window
org-src-preserve-indentation t ;; do not put two spaces on the left
org-src-tab-acts-natively t)
;; *** Templates
;; the %a refer to the place you are in emacs when you make the capture
;; that's very neat when you do that in an email for example.
(setq org-capture-templates
'(("t" "todo" entry (file "~/.org/inbox.org")
"* TODO %?\n%U\n- ref :: %a\n")
;; time tracker (clocked tasks)
("g" "geek" entry (file+olp+datetree "~/.org/tracker.org")
"* GEEK %? :perso:\n%U\n- ref :: %a\n"
:prepend t :tree-type week :clock-in t :clock-keep t)
("c" "chat" entry (file+olp+datetree "~/.org/tracker.org")
"* CHAT %? :work:chat:\n%U\n- ref :: %a\n"
:prepend t :tree-type week :clock-in t :clock-keep t)
("e" "email" entry (file+olp+datetree "~/.org/tracker.org")
"* EMAIL %? :work:email:\n%U\n- ref :: %a\n"
:prepend t :tree-type week :clock-in t :clock-keep t)
("m" "meeting" entry (file+olp+datetree "~/.org/tracker.org")
"* MEETING %? :work:meeting:\n%U\n- ref :: %a\n"
:prepend t :tree-type week :clock-in t :clock-keep t)
("r" "review" entry (file+olp+datetree "~/.org/tracker.org")
"* REVIEW %? :work:review:\n%U\n- ref :: %a\n"
:prepend t :tree-type week :clock-in t :clock-keep t)
("w" "work" entry (file+olp+datetree "~/.org/tracker.org")
"* IN-PROGRESS %? :work:\n%U\n- ref :: %a\n"
:prepend t :tree-type week :clock-in t :clock-keep t)
("p" "pause" entry (file+olp+datetree "~/.org/tracker.org")
"* PAUSE %? :pause:\n%U\n- ref :: %a\n"
:prepend t :tree-type week :clock-in t :clock-keep t)
("i" "interruption" entry (file+olp+datetree "~/.org/tracker.org")
"* IN-PROGRESS %? :interruption:work:\n%U\n- ref :: %a\n"
:prepend t :tree-type week :clock-in t :clock-keep t)
("f" "chore" entry (file "~/.org/inbox.org")
"* IN-PROGRESS %? :chore:\n%U\n"
:clock-in t :clock-keep t)))
;; How to create default clocktable
(setq org-clock-clocktable-default-properties
'(:scope subtree :maxlevel 4 :timestamp t :link t :tags t :narrow 36! :match "work"))
;; How to display default clock report in agenda view
(setq org-agenda-clockreport-parameter-plist
'(:lang "en" :maxlevel 4 :fileskip0 t :link t :indent t :narrow 80!))
;; *** Projectile; default TODO file to create in your projects
(setq org-projectile-file "inbox.org")
;; *** Refile mapped to SPC y o r
(map! :leader :desc "org-refile" "y o r" #'org-refile)
;; Refile to either the =refile.org= file or to =agenda.org= org =standup.org=
(setq org-refile-target-files
'("~/.org/tracker.org"
"~/.org/inbox.org"))
(setq org-refile-targets
'((nil :maxlevel . 5)
(org-refile-target-files :maxlevel . 5)))
;; *** Agenda
(setq org-log-into-drawer t) ;; hide the log state change history a bit better
(setq org-agenda-files org-refile-target-files)
(setq org-deadline-warning-days 7)
(setq org-agenda-skip-scheduled-if-deadline-is-shown t)
(setq org-habit-show-habits-only-for-today nil)
(setq org-habit-graph-column 65)
(setq org-duration-format 'h:mm) ;; show hours at max, not days
(setq org-agenda-compact-blocks t)
;; default show today
(setq org-agenda-span 'day)
(setq org-agenda-start-day "-0d")
(setq org-agenda-start-on-weekday nil)
(setq org-agenda-custom-commands
'(("d" "Done tasks" tags "/DONE|CANCELED")
("g" "Plan Today"
((agenda "" ((org-agenda-span 'day)))
(org-agenda-skip-function '(org-agenda-skip-deadline-if-not-today))
(org-agenda-entry-types '(:deadline))
(org-agenda-overriding-header "Today's Deadlines ")))))
(setq org-agenda-window-setup 'only-window)
(defun y/go-to-today-agenda ()
(interactive)
(org-agenda nil "a"))
;; Faster jump to agenda today keybinding shortcut (SPC y a)
(map! :leader
:desc "Today's agenda"
"y a" #'y/go-to-today-agenda)
;; ** Org Annotate
;; Ability to take annotate some files, can of double usage with org-capture.
;; Still, I keep that keyboard shortcut here.
;; (evil-leader/set-key "oa" 'org-annotate-file)
(setq org-annotate-file-storage-file "~/.org/annotations.org")
;; ** Org colums
;; Can be nice sometime to have that column view
;; give a felling of Excel view
(setq org-columns-default-format
"%TODO %3PRIORITY %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM %8TAGS(TAG)")
(map! :leader "y o c" #'org-columns)
;; ** Deft
;; useful to find files and jump to them
(setq deft-extensions '("org" "gpg" "md" "txt"))
(setq deft-recursive t)
(setq deft-use-filter-string-for-filename t)
(setq deft-default-extension "org")
(setq deft-directory "~/.org")
;; Org Babel
(org-babel-do-load-languages
'org-babel-load-languages
'(;; other Babel languages
(shell . t)
(http . t)
(clojure . t)
(haskell . t)
(plantuml . t) ;; UML graphs
(gnuplot . t)))
(setq org-plantuml-jar-path "~/bin/plantuml.jar"))
(use-package! org
:config (org-mode-config))
#+END_SRC
And also
#+BEGIN_SRC emacs-lisp
(use-package! org-super-agenda
:after org-agenda
:custom (org-super-agenda-groups
'( ;; Each group has an implicit boolean OR operator between its selectors.
(:name "Overdue" :deadline past :order 0)
(:name "Evening Habits" :and (:habit t :tag "evening") :order 8)
(:name "Habits" :habit t :order 6)
(:name "Today" ;; Optionally specify section name
:time-grid t ;; Items that appear on the time grid (scheduled/deadline with time)
:order 3) ;; capture the today first but show it in order 3
(:name "Low Priority" :priority "C" :tag "maybe" :order 7)
(:name "Due Today" :deadline today :order 1)
(:name "Important"
:and (:priority "A" :not (:todo ("DONE" "CANCELED")))
:order 2)
(:name "Due Soon" :deadline future :order 4)
(:name "Todo" :not (:habit t) :order 5)
(:name "Waiting" :todo ("WAITING" "HOLD") :order 9)))
:config
(setq org-super-agenda-header-map nil)
(org-super-agenda-mode t))
#+END_SRC
** Conclusions
:PROPERTIES:
:CUSTOM_ID: conclusions
:END:
That article is already quite long.
But if you intend to dig into org mode, this can be a nice default starting point.
I haven't really dig into some details but only given you the ability to
start not completely from scratch and with decent default values for an
already advanced usage.
To resume:
- =SPC y a= ⇒ Show agenda view for today
- =SPC X= ⇒ Capture a new task, write a description, then =C-c C-c=, save
that in =tracker.org= (or =inbox.org= depending of the capture template)
- =SPC n o= ⇒ jump to the current time tracked tasks
- =SPC m c o= ⇒ stop the clock on that task; if you capture a new time
tracking tasks you don't need to clock-out
- =SPC y o r==org-refile=, meaning move that task somewhere else
- =SPC q= ⇒ add/remove tags to that task
** Footnotes
:PROPERTIES:
:CUSTOM_ID: footnotes
:END:
:PROPERTIES:
:CUSTOM_ID: footnotes
:END:
[fn:emacs-digression]