Skip to content

Instantly share code, notes, and snippets.

@suvratapte
Last active April 3, 2021 10:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save suvratapte/fdfdfb5792927533fee2fb4568111175 to your computer and use it in GitHub Desktop.
Save suvratapte/fdfdfb5792927533fee2fb4568111175 to your computer and use it in GitHub Desktop.
;;; org-capture-demo.el --- Org capture demo configuration.
;;; Commentary:
;;; Author: Suvrat Apte
;;; Created on: 03 May 2020
;;; Copyright (c) 2019 Suvrat Apte <suvratapte@gmail.com>
;; This file is not part of GNU Emacs.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Do What The Fuck You Want to
;; Public License, Version 2, which is included with this distribution.
;; See the file LICENSE.txt
;; This is the demo file that was used for this meetup: https://www.meetup.com/the-peg/events/270312246/
;;; Code:
;; ──────────────────────────── Org mode vars - Default values ──────────────────────────
(setq org-directory "~/org")
(setq org-capture-templates nil)
;; ─────────────────────────────────── Basic templates ──────────────────────────────────
(setq suv-org-personal-todo-file (concat org-directory "/todo.org"))
;; `org-capture-templates` should be a list of template specifications:
;; Each specification (<key> <short description> <type> <target> <template> <properties>)
(setq org-capture-templates
'(("t"
"Personal todo"
entry
(file suv-org-personal-todo-file)
"* TODO %^{Description}")))
;; Settting cursor position.
(setq org-capture-templates
'(("t" "Personal todo" entry (file suv-org-personal-todo-file)
"* TODO %^{Description}\n %?")))
;; Adding date in logbook.
(setq org-capture-templates
'(("t" "Personal todo" entry (file suv-org-personal-todo-file)
"* TODO %^{Description}\n :LOGBOOK:\n - Added: %U\n :END:\n %?")))
;; ──────────────────────────────── Advanced configuration ────────────────────────────────
;; Add tags.
(setq org-capture-templates
'(("t" "Personal todo" entry (file suv-org-personal-todo-file)
"* TODO %^{Description} %^g\n :LOGBOOK:\n - Added: %U\n :END:\n %?")))
;; Add template for meeting notes.
(setq suv-org-meeting-notes-file (concat org-directory "/meeting-notes.org"))
(setq org-capture-templates
'(("t" "Personal todo" entry (file suv-org-personal-todo-file)
"* TODO %^{Description} %^g\n :LOGBOOK:\n - Added: %U\n :END:\n %?")
("m" "Meeting notes" entry (file suv-org-meeting-notes-file)
"* %^{Agenda}\n - Attendees: %^{Attendees}, Suvrat
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] ")))
;; Prepend
(setq org-capture-templates
'(("t" "Personal todo" entry (file suv-org-personal-todo-file)
"* TODO %^{Description} %^g\n :LOGBOOK:\n - Added: %U\n :END:\n %?")
("m" "Meeting notes" entry (file suv-org-meeting-notes-file)
"* %^{Agenda}\n - Attendees: %^{Attendees}, Suvrat
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] "
:prepend t)))
;; Clock-in and clock-resume
(setq org-capture-templates
'(("t" "Personal todo" entry (file suv-org-personal-todo-file)
"* TODO %^{Description} %^g\n :LOGBOOK:\n - Added: %U\n :END:\n %?")
("m" "Meeting notes" entry (file suv-org-meeting-notes-file)
"* %^{Agenda}\n - Attendees: %^{Attendees}, Suvrat
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] "
:prepend t
:clock-in t
:clock-resume t)))
;; Movies
(setq suv-org-movies-file (concat org-directory "/movies.org"))
;; Immediate-finish
(setq org-capture-templates
'(("t" "Personal todo" entry (file suv-org-personal-todo-file)
"* TODO %^{Description} %^g\n :LOGBOOK:\n - Added: %U\n :END:\n %?")
("m" "Meeting notes" entry (file suv-org-meeting-notes-file)
"* %^{Agenda}\n - Attendees: %^{Attendees}, Suvrat
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] "
:prepend t)
("M" "Movie" entry (file suv-org-movies-file)
"* TODO %^{Description}"
:immediate-finish t)))
;; Work
(setq suv-org-work-file (concat org-directory "/work.org"))
;; Auto complete for variables and using the variables
(setq org-capture-templates
'(("t" "Personal todo" entry (file suv-org-personal-todo-file)
"* TODO %^{Description} %^g\n :LOGBOOK:\n - Added: %U\n :END:\n %?")
("m" "Meeting notes" entry (file suv-org-meeting-notes-file)
"* %^{Agenda}\n - Attendees: %^{Attendees}, Suvrat
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] "
:prepend t)
("M" "Movie" entry (file suv-org-movies-file)
"* TODO %^{Description}"
:immediate-finish t)
("w" "Work task" entry (file suv-org-work-file)
"* TODO %^{Type|TODO|DEP|BUG}-%^{Ticket number} - %^{Description}
:PROPERTIES:
:LINK: https://helpshift.atlassian.net/browse/%\\1-%\\2
:END:
:LOGBOOK:\n - Added - %U\n :END:\n ")))
;; ────────────────────────────── Writing code in templates ─────────────────────────────
(setq suv-org-reading-list-file (concat org-directory "/reading-list.org"))
;; Get from kill ring
(setq org-capture-templates
'(("t" "Personal todo" entry (file suv-org-personal-todo-file)
"* TODO %^{Description} %^g\n :LOGBOOK:\n - Added: %U\n :END:\n %?")
("m" "Meeting notes" entry (file suv-org-meeting-notes-file)
"* %^{Agenda}\n - Attendees: %^{Attendees}, Suvrat
- Date: %U\n - Notes:\n + %?\n - Action items [/]\n + [ ] "
:prepend t)
("M" "Movie" entry (file suv-org-movies-file)
"* TODO %^{Description}"
:immediate-finish t)
("w" "Work task" entry (file suv-org-work-file)
"* TODO %^{Type|TODO|DEP|BUG}-%^{Ticket number} - %^{Description}
:PROPERTIES:
:LINK: https://helpshift.atlassian.net/browse/%\\1-%\\2
:END:
:LOGBOOK:\n - Added - %U\n :END:\n ")
("r" "Reading list item" entry (file suv-org-reading-list-file)
"* TODO %^{Description}\n :LOGBOOK:\n - Added: %U\n :END:
%(current-kill 0)\n %?")))
;; Show how you can know all of this from inside of Emacs. (`C-h v`)
;; Use `%c` instead of `%(current-kill 0)`
;; Show `organice`
;;; org-capture-demo.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment