Dan's Brain

org-capture


Setting up

(setq org-default-notes-file (concat org-directory “/notes.org”))

directory di org-roam nel caso di

  • journal

    • usando org-roam-today
  • roam

directory di agenda o ledger nei casi

Activation

(global-set-key (kbd “C-c a”) ‘org-agenda)

(global-set-key (kbd “C-c c”) ‘org-capture)

Capture Templates

org-mode-templates <– modifica questa variabile

(setq org-capture-templates ‘( (“t” “Todo” entry (file+headline “~/org/gtd.org” “Tasks”) “* TODO %?\n %i\n %a”) (“j” “Journal” entry (file+datetree “~/org/journal.org”) “* %?\nEntered on %U\n %i\n %a”) ))

per saltare il set-up

(define-key global-map (kbd “C-c x”) (lambda () (interactive) (org-capture nil “x”)))

Template Elements

keys

  • “a” o “-tasto-”
  • “ab” per due tasti

    • in questo caso le combinazioni devono essere consequenziali e seguite da una descrizione

description

  • “blabla” - mostrata nella selezione

type

  • un simbolo
  • es

    • entry

      • org mode node
      • con headline
      • inserita come child della target entry

        • target deve essere .org
    • item

      • un oggetto lista
      • piazzata nella prima lista del target

        • target .org
    • checkitem

      • checkbox
      • nel resto uguale al item
    • table-line

      • nuova riga alla prima tabella del target
      • dove verra inserita dipende dalle proprieta’

        • :prepend
        • :tabel-line-pos
    • plain

      • testo che verra’ incollato cosi’ com’e’

target

  • dove verra' inserito l’elemento catturato

    • ‘(file “path/to/file”)’
    • ‘(id “id of existing org entry”)’
    • ‘(file+headline “filename” “node headline”)’
    • ‘(file+olp “filename” “Level 1 heading” “Level 2” …)’
    • ‘(file+regexp “filename” “regexp to find location”)’
    • ‘(file+olp+datetree “filename” [ “Level 1 heading” …])’

      • creates a heading in a date tree for today’s date. If the optional outline path is given, the tree will be built under the node it is pointing to, instead of at top level. Check out the :time-prompt and :tree-type properties
    • ‘(file+function “filename” function-finding-location)’
    • ‘(clock)’
    • ‘(function function-finding-location)’

template

  • The template for creating the capture item. If you leave this empty, an appropriate default template will be used. Otherwise this is a string with escape codes, which will be replaced depending on time and context of the capture call.

    (file “/path/to/template-file”) (function FUNCTION-RETURNING-THE-TEMPLATE)

properties

  • :prepend
  • :immediate-finish
  • :empty-lines
  • :clock-in
  • :clock-keep
  • :clock-resume
  • :time-prompt
  • :tree-type
  • :unnarrowed
  • :table-line-pos
  • :kill-buffer
  • :no-save

Template expansion

%-escapes

%[FILE]

inserisce contenuto da FILE

%(EXP)

valuta un espressione Elist e rimpiazza con risultato, deve ritornare una stringa, puo' contenere solo %-escapes non interattivi

%<FORMAT>

risultato di format-time-string con FORMAT a parametro

%t/%T

timestamp solo data/data e ora

%u/%U

come sopra ma timestamp inattivi

%i

contenuto iniziale

%a/%A

annotazione/annotazione con prompt di descrizione

%l

%c

%x

x-clipboard

%k

%K

%n

nome

%f

file visitato quando viene chiamato org-capture

%F

path del file visitata dal buffer corrente

%:keyword

info per certi link

%^g

prompt per tag, autocompletati in target

%^G

%^t

t ma con propt

%PROMPT

prompt per una stringa e rimpiazza la sequenza con quella inserita