From 90be31cc52d8a5e103b690f273df5207a406e5c8 Mon Sep 17 00:00:00 2001
From: Gabriel Arazas <foo.dogsquared@gmail.com>
Date: Mon, 12 Apr 2021 20:03:19 +0800
Subject: [PATCH] Update org-mode snippets

As of 2021-04-12, org-mode is apparently standardized in lowercase so
we'll follow that for the sake of future-proofing.
---
 emacs/config.el                        | 94 ++++++++++++++------------
 emacs/snippets/org-mode/appendix       |  6 +-
 emacs/snippets/org-mode/block          |  4 +-
 emacs/snippets/org-mode/comment-block  |  4 +-
 emacs/snippets/org-mode/img            |  4 +-
 emacs/snippets/org-mode/property-block |  4 +-
 emacs/snippets/org-mode/quote          |  4 +-
 emacs/snippets/org-mode/source         |  4 +-
 emacs/snippets/org-mode/video          |  8 +--
 emacs/templates/org-mode/__            | 16 ++---
 10 files changed, 79 insertions(+), 69 deletions(-)

diff --git a/emacs/config.el b/emacs/config.el
index 02be48c..32a590e 100755
--- a/emacs/config.el
+++ b/emacs/config.el
@@ -68,61 +68,71 @@
   (add-to-list 'safe-local-variable-values
                '(TeX-command-extra-options . "-shell-escape")))
 
-(setq
-  ; Set the journal.
-  org-journal-dir "~/writings/journal"
-  org-journal-file-format "%F"
-
-  ; Set the capture
-  org-capture-templates `(
-    ("i" "inbox" entry (file ,(concat org-directory "/inbox.org"))
-      ,(concat "* TODO %?\n"
-        "entered on %<%F %T %:z>"))
-
-    ("p" "project" entry (file ,(concat org-directory "/projects.org"))
-      ,(concat "* PROJ %?\n"
-        "- [ ] %?"))
-
-    ("c" "org-protocol-capture" entry (file ,(concat org-directory "/inbox.org"))
-      "* TODO [[%:link][%:description]]\n%x"
-      :immediate-finish t)))
-
 (after! org
   (setq
-    ; Set a custom time-stamp pattern.
-    ; Even though, it's not recommended, most of the time, it is mainly for personal documents so it is safe.
-    time-stamp-start "DATE_MODIFIED:[ 	]+\\\\?[\"<]+"
+   time-stamp-start "date_modified:[ 	]+\\\\?[\"<]+"
+   ; Set the capture
+   org-capture-templates `(
+     ("i" "inbox" entry
+      (file ,(concat org-directory "/inbox.org"))
+       ,(concat "* TODO %?\n"
+         "entered on %<%F %T %:z>"))
+
+     ("p" "project" entry
+      (file ,(concat org-directory "/projects.org"))
+       ,(concat "* PROJ %?\n"
+         "- [ ] %?"))
+
+     ("c" "org-protocol-capture" entry
+      (file ,(concat org-directory "/inbox.org"))
+       "* TODO [[%:link][%:description]]\n%x"
+       :immediate-finish t))
 
     ; Configure org-roam.
     org-roam-capture-templates '(
-      ("d" "default" plain (function org-roam--capture-get-point)
-       "#+AUTHOR: \"%(user-full-name)\"
-#+EMAIL: \"%(user-mail-address)\"
-#+DATE: \"%<%Y-%m-%d %T %:z>\"
-#+DATE_MODIFIED: \"%<%Y-%m-%d %T %:z>\"
-#+LANGUAGE: en
-#+OPTIONS: toc:t
-#+PROPERTY: header-args  :exports both
+      ("n" "notes" plain
+       #'org-roam-capture--get-point
+       "#+author: \"%(user-full-name)\"
+#+email: \"%(user-mail-address)\"
+#+date: \"%<%Y-%m-%d %T %:z>\"
+#+date_modified: \"%<%Y-%m-%d %T %:z>\"
+#+language: en
+#+options: toc:t
+#+property: header-args  :exports both
 
 %?"
-       :file-name "%<%Y-%m-%d-%H-%M-%S>"
-       :head "#+TITLE: ${title}\n"
-       :unnarrowed t))))
+    :file-name "%<%Y-%m-%d-%H-%M-%S>"
+    :head "#+title: ${title}\n"
+    :unnarrowed t)
+
+    ("d" "dailies" entry
+     #'org-roam-capture--get-point
+     "* %?"
+     :file-name "daily/%<%Y-%m-%d>"
+     :head "#+title %<%Y-%m-%d>"
+     :olp ("Study notes" "Random")))
+
+  ; Get the tags from vanilla and Roam-specific properties.
+  org-roam-tag-sources '(prop vanilla))
+  (add-to-list 'org-modules 'org-checklist))
 
 (setq
   ; Modify the time-stamp with each save.
   time-stamp-format "%Y-%02m-%02d %02H:%02M:%02S %:z"
 
   ; Set file templates folder at $DOOMDIR/templates.
-  +file-templates-dir (expand-file-name "templates/" doom-private-dir))
+  +file-templates-dir (expand-file-name "templates/" doom-private-dir)
 
-; Automate updating timestamps.
+  ; Set the journal.
+  org-journal-dir "~/writings/journal"
+  org-journal-file-format "%F"
+  )
+
+; A workaround for electric-indent plugin.
+; See https://github.com/hlissner/doom-emacs/issues/3172 for more details.
+(add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1)))
+
+; Automate updating timestamps on save.
 (add-hook 'before-save-hook 'time-stamp)
 
-(add-to-list 'org-modules 'org-checklist)
-
-; Org-roam-bibtex is somehow a horrible name.
-; I guess that's why they insist on calling it ORB.
-(use-package! org-roam-bibtex
-  :after-call org-mode
-  :hook (org-roam-mode . org-roam-bibtex-mode))
+;;; config.el ends here
diff --git a/emacs/snippets/org-mode/appendix b/emacs/snippets/org-mode/appendix
index 2e6b5d2..1e82f3d 100755
--- a/emacs/snippets/org-mode/appendix
+++ b/emacs/snippets/org-mode/appendix
@@ -2,6 +2,6 @@
 # name: Org-Mode appendix block
 # key: appendix
 # --
-:PROPERTIES:
-:APPENDIX: t
-:END:
+:properties:
+:appendix: t
+:end:
diff --git a/emacs/snippets/org-mode/block b/emacs/snippets/org-mode/block
index 2fd262a..a7ef16a 100755
--- a/emacs/snippets/org-mode/block
+++ b/emacs/snippets/org-mode/block
@@ -2,6 +2,6 @@
 # name: Org-Mode dynamic blocks
 # key: block
 # --
-\#+BEGIN: ${1:<PARAMETERS>}
+\#+begin: ${1:<PARAMETERS>}
 $2
-\#+END:
+\#+end:
diff --git a/emacs/snippets/org-mode/comment-block b/emacs/snippets/org-mode/comment-block
index 84b780c..594522a 100755
--- a/emacs/snippets/org-mode/comment-block
+++ b/emacs/snippets/org-mode/comment-block
@@ -2,6 +2,6 @@
 # name: Org-Mode comment block
 # key: comment
 # --
-#+BEGIN_COMMENT
+#+begin_comment
 $0
-#+END_COMMENT
+#+end_comment
diff --git a/emacs/snippets/org-mode/img b/emacs/snippets/org-mode/img
index a43d803..b9a7e4e 100755
--- a/emacs/snippets/org-mode/img
+++ b/emacs/snippets/org-mode/img
@@ -2,6 +2,6 @@
 # name: Org-Mode image
 # key: img
 # --
-#+CAPTION: $1
-#+NAME: $2
+#+caption: $1
+#+name: $2
 [[${3:<LINK>}]
diff --git a/emacs/snippets/org-mode/property-block b/emacs/snippets/org-mode/property-block
index aa20713..b8e64d0 100755
--- a/emacs/snippets/org-mode/property-block
+++ b/emacs/snippets/org-mode/property-block
@@ -2,6 +2,6 @@
 # name: Org-Mode local property block
 # key: props
 # --
-:PROPERTIES:
+:properties:
 $1
-:END:
+:end:
diff --git a/emacs/snippets/org-mode/quote b/emacs/snippets/org-mode/quote
index dc938b0..acb4659 100755
--- a/emacs/snippets/org-mode/quote
+++ b/emacs/snippets/org-mode/quote
@@ -2,6 +2,6 @@
 # name: Org-Mode source block
 # key: quote
 # --
-#+BEGIN_QUOTE
+#+begin_quote
 $1
-#+END_QUOTE
+#+end_quote
diff --git a/emacs/snippets/org-mode/source b/emacs/snippets/org-mode/source
index 893acb8..6373f9b 100755
--- a/emacs/snippets/org-mode/source
+++ b/emacs/snippets/org-mode/source
@@ -2,6 +2,6 @@
 # name: Org-Mode source block
 # key: csrc
 # --
-#+BEGIN_SRC ${1:<LANG>} :results output  :exports both  :session *${2:<SESSION NAME>}*
+#+begin_src ${1:<LANG>} :results output  :exports both  :session *${2:<SESSION NAME>}*
 $3
-#+END_SRC
+#+end_src
diff --git a/emacs/snippets/org-mode/video b/emacs/snippets/org-mode/video
index 5364503..06d8e58 100755
--- a/emacs/snippets/org-mode/video
+++ b/emacs/snippets/org-mode/video
@@ -2,8 +2,8 @@
 # name: Org-Mode video block (on HTML, anyways)
 # key: video
 # --
-#+ATTR_HTML: :controls controls
-#+BEGIN_video
-#+HTML: <source src="${1:<VIDEO URL>}">
+#+attr_html: :controls controls
+#+begin_video
+#+html: <source src="${1:<VIDEO URL>}">
 Your browser does not support the video tag.
-#+END_video
+#+end_video
diff --git a/emacs/templates/org-mode/__ b/emacs/templates/org-mode/__
index 3ac46f6..fd70e16 100644
--- a/emacs/templates/org-mode/__
+++ b/emacs/templates/org-mode/__
@@ -1,7 +1,7 @@
 # -*- mode: snippet -*-
 # name: Org template
 # --
-#+TITLE: ${1:`
+#+title: ${1:`
 (string-join
  (mapcar #'capitalize
          ;; Replace -,_... with space
@@ -16,13 +16,13 @@
           "[^[:word:]0-9]+"
           )) " " )
 `}
-#+AUTHOR: "`user-full-name`"
-#+EMAIL: "`user-mail-address`"
-#+DATE: "`(format-time-string "%Y-%m-%d %T %:z")`"
-#+DATE_MODIFIED: "`(format-time-string "%Y-%m-%d %T %:z")`"
-#+LANGUAGE: en
-#+OPTIONS: toc:t
-#+PROPERTY: header-args  :exports both
+#+author: "`user-full-name`"
+#+email: "`user-mail-address`"
+#+date: "`(format-time-string "%Y-%m-%d %T %:z")`"
+#+date_modified: "`(format-time-string "%Y-%m-%d %T %:z")`"
+#+language: en
+#+options: toc:t
+#+property: header-args  :exports both
 
 
 $0