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.
This commit is contained in:
Gabriel Arazas 2021-04-12 20:03:19 +08:00
parent 85603bd00a
commit 90be31cc52
10 changed files with 79 additions and 69 deletions

View File

@ -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

View File

@ -2,6 +2,6 @@
# name: Org-Mode appendix block
# key: appendix
# --
:PROPERTIES:
:APPENDIX: t
:END:
:properties:
:appendix: t
:end:

View File

@ -2,6 +2,6 @@
# name: Org-Mode dynamic blocks
# key: block
# --
\#+BEGIN: ${1:<PARAMETERS>}
\#+begin: ${1:<PARAMETERS>}
$2
\#+END:
\#+end:

View File

@ -2,6 +2,6 @@
# name: Org-Mode comment block
# key: comment
# --
#+BEGIN_COMMENT
#+begin_comment
$0
#+END_COMMENT
#+end_comment

View File

@ -2,6 +2,6 @@
# name: Org-Mode image
# key: img
# --
#+CAPTION: $1
#+NAME: $2
#+caption: $1
#+name: $2
[[${3:<LINK>}]

View File

@ -2,6 +2,6 @@
# name: Org-Mode local property block
# key: props
# --
:PROPERTIES:
:properties:
$1
:END:
:end:

View File

@ -2,6 +2,6 @@
# name: Org-Mode source block
# key: quote
# --
#+BEGIN_QUOTE
#+begin_quote
$1
#+END_QUOTE
#+end_quote

View File

@ -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

View File

@ -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

View File

@ -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