Skip to content

Instantly share code, notes, and snippets.

@scateu
Last active March 2, 2025 04:44
Show Gist options
  • Save scateu/7261f78823ea3496094003fb4d5d4f8b to your computer and use it in GitHub Desktop.
Save scateu/7261f78823ea3496094003fb4d5d4f8b to your computer and use it in GitHub Desktop.
Minimalist Emacs Org Capture Configuration - Using Emacs as a notebook and notebook only
; Usage:
; put the following files to ~/.emacs.d/init.el
; Fire up Emacs.
; C-c c t will add an todo item to ~/org/todo.org
; C-c c j will add a journal item to ~/org/journal.org
; C-c s will add some date, before you check it later with C-c a t
; Org Capture Template borrowed from Doom Emacs. Thank you!
; M-x nerd-icons-install-fonts will fix the missing icon on bottom left corner.
(global-set-key (kbd "C-c l") #'org-store-link)
(global-set-key (kbd "C-c a") #'org-agenda)
(global-set-key (kbd "C-c c") #'org-capture)
(with-eval-after-load 'org
(setq org-directory "~/org")
(setq org-default-notes-file (concat org-directory "/notes.org"))
(setq org-capture-templates
'(
("t" "Todo" entry (file+headline "~/org/todo.org" "Tasks") "* TODO %?\n %i\n %a")
("n" "Personal notes" entry (file+headline "~/org/personal_notes.org" "Inbox") "* %u %?\n%i\n%a" :prepend t)
("N" "Work notes" entry (file+headline "~/org/work_notes.org" "Inbox") "* %u %?\n%i\n%a" :prepend t)
("j" "Journal" entry (file+olp+datetree "~/org/journal.org") "* %U %?\n%i\n%a" :prepend t)
)
)
(setq org-agenda-files '("~/org"))
)
; LaTeX Chinese support - add the following lines to the head of your org file. Then C-c e l p
; #+TITLE: Journal
; #+LATEX_CLASS: ctexart
; #+LATEX_CLASS_OPTIONS: [letter]
; #+LATEX_HEADER: \usepackage[driver=dvipdfm,margin=1in,a4paper]{geometry}
; #+OPTIONS: toc:nil num:nil
; sudo apt install texlive texlive-lang-chinese texlive-xetex
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("ctexart" "\\documentclass[11pt]{ctexart}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(setq org-latex-default-class "ctexart")
(setq org-latex-compiler "xelatex"))
; macOS shortcut - bind to Control-Option-c; like Omnifocus's Control-Option-Space
;#!/bin/bash
;socket_file=$(lsof -c Emacs | grep server | tr -s " " | cut -d' ' -f8)
;if [[ $socket_file == "" ]]; then
; # emacs $@ &
; /Application/Emacs.app/Contents/MacOS/Emacs $@ &
;else
; /opt/homebrew/bin/emacsclient $@ -n -s $socket_file org-protocol://capture?template=j
;fi
;osascript -e 'tell application "Emacs"' -e 'activate' -e 'end tell'
@scateu
Copy link
Author

scateu commented Jan 15, 2025

@scateu
Copy link
Author

scateu commented Jan 15, 2025

@scateu
Copy link
Author

scateu commented Jan 15, 2025

emacsclient org-protocol://capture?template=j

@scateu
Copy link
Author

scateu commented Mar 2, 2025

- [ ] todo item
- [X] done item

will need:

#+LATEX_HEADER: \usepackage{amssymb}

courtesy of BG1REN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment