Skip to content

Instantly share code, notes, and snippets.

@spacebat
Created May 7, 2014 04:59
Show Gist options
  • Save spacebat/097f3e7469edf2eaa6a9 to your computer and use it in GitHub Desktop.
Save spacebat/097f3e7469edf2eaa6a9 to your computer and use it in GitHub Desktop.
org-capture-templates
(setq org-capture-templates
(("a" "Appointment" entry
(file+headline
(concat org-directory "/taskdiary.org")
"Calendar")
"* APPT %^{Description} %^g\n%?\nAdded: %U")
("n" "Notes" entry
(file+datetree
(concat org-directory "/taskdiary.org"))
"* %^{Description} %^g %?\nAdded: %U")
("t" "Task Diary" entry
(file+datetree
(concat org-directory "/taskdiary.org"))
"* TODO %^{Description} %^g\n%?\nAdded: %U")
("d" "Long Tail TODO Task" entry
(file+headline "" "Tasks")
"* TODO %?\n %u\n %a")
("j" "Journal" entry
(file+datetree
(concat org-directory "/workjournal.org"))
"** %^{Heading}")
("l" "Log Time" entry
(file+datetree
(concat org-directory "/timelog.org"))
"** %U - %^{Activity} :TIME:")))
@jasonblewis
Copy link

(setq org-capture-templates
      (("l" "Lunch" entry
        (file+datetree
         "~/Dropbox/org/test.org" )
               "* lunch%?\n%U\n:PROPERTIES:\n:Meal: lunch\n:END:\n%^{Description}")
             (("d" "Dinner" entry (file+datetree "~/Dropbox/org/test.org" )
               "* Dinner%?\n%U\n:PROPERTIES:\n:Meal: Dinner\n:END:\n%^{Description}"))  ))

@spacebat
Copy link
Author

spacebat commented May 7, 2014

(setq org-capture-templates
      '(
        ("l" "Lunch" entry (file+datetree "~/Dropbox/org/test.org" )
         "* lunch%?\n%U\n:PROPERTIES:\n:Meal: lunch\n:END:\n%^{Description}")

        ("d" "Dinner" entry (file+datetree "~/Dropbox/org/test.org" )
         "* Dinner%?\n%U\n:PROPERTIES:\n:Meal: Dinner\n:END:\n%^{Description}")
        ))

@spacebat
Copy link
Author

spacebat commented May 7, 2014

(let ((default-template "* %s%%?\n%%U\n:PROPERTIES:\n:Meal: lunch\n:END:\n%%^{Description}"))
  (setq org-capture-templates
        `(
          ("l" "Lunch" entry (file+datetree "~/Dropbox/org/test.org" )
           ,(format default-template "Lunch"))

          ("d" "Dinner" entry (file+datetree "~/Dropbox/org/test.org" )
           ,(format default-template "Dinner"))
          )))

@spacebat
Copy link
Author

spacebat commented May 7, 2014

(let ((default-template "* %s%%?\n%%U\n:PROPERTIES:\n:Meal: lunch\n:END:\n%%^{Description}")
      (filename "~/Dropbox/org/test.org")
      (meal-template (lambda (name)
                       (list (downcase (substring name 0 1)) name `(file+datetree ,filename)
                             (format default-template name)))))
  (setq org-capture-templates (mapcar meal-template '("Breakfast" "Lunch" "Dinner"))))

@spacebat
Copy link
Author

spacebat commented May 7, 2014

(let ((default-template "* %s%%?\n%%U\n:PROPERTIES:\n:Meal: %s\n:END:\n%%^{Description}")
      (filename "~/Dropbox/org/test.org")
      (meal-template (lambda (name)
                       (list (downcase (substring name 0 1)) name 'entry `(file+datetree ,filename)
                             (format default-template name (downcase name))))))
  (setq org-capture-templates (mapcar meal-template '("Breakfast" "Lunch" "Dinner"))))

@spacebat
Copy link
Author

spacebat commented May 7, 2014

(let ((default-template "* %s%%?\n%%U\n:PROPERTIES:\n:Meal: %s\n:END:\n%%^{Description}")
      (filename "~/Dropbox/org/test.org")
      (meal-template (lambda (arg)
                       (let (name initial)
                         (if (listp arg)
                             (setq name (car arg)
                                   initial (cadr arg))
                           (setq name arg))
                         (when (not initial)
                           (setq initial (downcase (substring name 0 1))))

                         (list initial name 'entry `(file+datetree ,filename)
                               (format default-template name (downcase name)))))))

  (setq org-capture-templates (mapcar meal-template '("Breakfast" ("Lunch" "L") "Dinner"))))

@jasonblewis
Copy link

(let ((default-template "* %s%%?\n:PROPERTIES:\n:Meal: %s\n:END:\n%%^{Description}")
      (filename "~/Dropbox/org/test.org")
      (meal-template (lambda (arg)
                       (let (name initial)
                         (if (listp arg)
                             (setq name (car arg)
                                   initial (cadr arg))
                           (setq name arg))
                         (when (not initial)
                           (setq initial (downcase (substring name 0 1))))

                         (list initial name 'entry `(file+datetree ,filename)
                               (format default-template name (downcase name)))))))

  (add-to-list org-capture-templates (mapcar meal-template '("Breakfast"  ("Lunch" "l") "Dinner" ("Snack" "s")))))

@jasonblewis
Copy link

;; for capturing books to read
(setq org-capture-templates
      (quote (("B" "Book" entry (file+headline "~/Dropbox/org/todo.org" "books to read")
               "* TODO %\\1 - %\\2%?\n%U\n:PROPERTIES:\n:NAME: %^{NAME}\n:TITLE: %^{TITLE}\n:END:\n"))))

;; for capturing food diary
;; C-c c to capture
(let ((default-template "* %s%%?\n:PROPERTIES:\n:Meal: %s\n:END:\n%%^{Description}")
      (filename "~/Dropbox/org/test.org")
      (meal-template (lambda (arg)
                       (let (name initial)
                         (if (listp arg)
                             (setq name (car arg)
                                   initial (cadr arg))
                           (setq name arg))
                         (when (not initial)
                           (setq initial (downcase (substring name 0 1))))

                         (list initial name 'entry `(file+datetree ,filename)
                               (format default-template name (downcase name)))))))

  (add-to-list org-capture-templates (mapcar meal-template '("Breakfast"  ("Lunch" "l") "Dinner" ("Snack" "s")))))

@jasonblewis
Copy link

(let ((default-template "* %s%%?\n:PROPERTIES:\n:Meal: %s\n:END:\n%%^{Description}")
      (filename "~/Dropbox/org/test.org")
      (meal-template (lambda (arg)
                       (let (name initial)
                         (if (listp arg)
                             (setq name (car arg)
                                   initial (cadr arg))
                           (setq name arg))
                         (when (not initial)
                           (setq initial (downcase (substring name 0 1))))

                         (list initial name 'entry `(file+datetree ,filename)
                               (format default-template name (downcase name)))))))


  (add-to-list org-capture-templates (mapcar meal-template '("Breakfast"  ("Lunch" "l") "Dinner" ("Snack" "s")))))

@academikuser
Copy link

academikuser commented May 4, 2017

(setq org-capture-templates
'(
("p" "protocol" entry (file+headline ,(concat org-directory "notes.org") "inbox")
"* %^{title}\nsource: %u, %c\n #+begin_quote\n%i\n#+end_quote\n\n\n%?")

("x" "org-protocol" entry (file "~/org/web.org")
"** TODO Review %c\n%U\n%i\n" :immediate-finish)

("n" "mnemonic w/ notes")
("na" "notes - applescript" entry (file+datetree "~/org/appleScripNotes.org")
"* %?\nentered on %u\n %i\n %a" :empty-lines 1)

("nb" "notes - book" plain (file "/Users/AbuDavid/school/bibliography/unfiledBooks.bib")
"\n %^{bibtex}" :empty-lines 1)

("nh" "notes - html" entry (file+datetree "~/org/htmlNotes.org")
"* %?\nentered on %u\n %i\n %a" :empty-lines 1)

("l" "protocol link" entry (file+headline ,(concat org-directory "notes.org") "inbox")
"* %? [[%:link][%:description]] \ncaptured on: %u")

("l" "ledger entries")
("lm" "mbna" plain
(file "~/personal/.ledger")
"%(org-read-date) %^{payee}
liabilities:samplecreditcard
expenses:%^{account} %^{amount}
")

("ld" "deposit" plain
 (file "~/personal/.ledger")
 "%(org-read-date) * %^{payee}
Assets:Bank:Deposits
Income:Scholarship  %^{amount}
 ")

("lh" "use Bank Hapoalim debit card" plain
 (file "~/personal/.ledger")
 "%(org-read-date) * %^{payee}
 Assets:Bank:Hapoalim
 Expenses:%^{account}               %^{amount}
 ")

("lw" "atm withdrawal" plain
 (file "~/personal/.ledger")
 "%(org-read-date) * %^{payee}
Assets:Bank:Hapoalim 
Assets:Cash               %^{amount}
 ")

("lc" "cash" plain
(file "~/personal/.ledger")
"%(org-read-date) * %^{payee}
Assets:Cash 
Expenses:%^{account}               %^{amount}
 "))  )

@rjanardan
Copy link

great examples, thank you

@hank-lenzi
Copy link

There's a missing quote in:
(setq org-capture-templates
(("a" "Appointment" entry ...

Should be:
(setq org-capture-templates
'(("a" "Appointment" entry ...

@charlemana
Copy link

Thank you so much for these examples

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