Skip to content

Instantly share code, notes, and snippets.

@febeling
Last active August 29, 2015 13:57
Show Gist options
  • Save febeling/9808734 to your computer and use it in GitHub Desktop.
Save febeling/9808734 to your computer and use it in GitHub Desktop.
org-capture intro
Presentation for emacs-berlin user group
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="remark,remarkjs,markdown,slideshow,presentation" />
<meta name="description" content="A simple, in-browser, markdown-driven slideshow tool." />
<title>emacs-berlin: org-capture</title>
<style type="text/css">
@import url(http://fonts.googleapis.com/css?family=Droid+Serif);
@import url(http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
body {
font-family: 'Droid Serif';
font-size: 20px;
}
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: 400;
margin-bottom: 0;
}
h1 { font-size: 4em; }
h2 { font-size: 2em; }
h3 { font-size: 1.6em; }
.footnote {
position: absolute;
bottom: 3em;
}
li p { line-height: 1.25em; }
.red { color: #fa0000; }
.large { font-size: 2em; }
a, a > code {
color: rgb(249, 38, 114);
text-decoration: none;
}
code {
-moz-border-radius: 5px;
-web-border-radius: 5px;
background: #e7e8e2;
border-radius: 5px;
font-size: 16px;
}
.pull-left {
float: left;
width: 47%;
}
.pull-right {
float: right;
width: 47%;
}
.pull-right ~ p {
clear: both;
}
#slideshow .slide .content code {
font-size: 0.8em;
}
#slideshow .slide .content pre code {
font-size: 0.9em;
padding: 15px;
}
.inverse {
background: #272822;
color: #777872;
text-shadow: 0 0 20px #333;
}
.inverse h1, .inverse h2 {
color: #f3f3f3;
line-height: 0.8em;
}
/* Slide-specific styling */
#slide-inverse .footnote {
bottom: 12px;
left: 20px;
}
#slide-how .slides {
font-size: 0.9em;
position: absolute;
top: 151px;
right: 140px;
}
#slide-how .slides h3 {
margin-top: 0.2em;
}
#slide-how .slides .first, #slide-how .slides .second {
padding: 1px 20px;
height: 90px;
width: 120px;
-moz-box-shadow: 0 0 10px #777;
-webkit-box-shadow: 0 0 10px #777;
box-shadow: 0 0 10px #777;
}
#slide-how .slides .first {
background: #fff;
position: absolute;
top: 20%;
left: 20%;
z-index: 1;
}
#slide-how .slides .second {
position: relative;
background: #fff;
z-index: 0;
}
/* Two-column layout */
.left-column {
color: #777;
width: 20%;
height: 92%;
float: left;
}
.left-column h2:last-of-type, .left-column h3:last-child {
color: #000;
}
.right-column {
width: 75%;
float: right;
padding-top: 1em;
}
</style>
</head>
<body>
<textarea id="source">
name: inverse
layout: true
class: center, middle, inverse
---
#org-capture
Quick note-taking with org-mode
---
## What is it and why should I be using it?
---
layout: false
.left-column[
## What is it?
]
.right-column[
#You have an idea!
while working: what do you do?
- ignore it? Makes you uneasy
- write it down? Have to leave you context, open file, paper notebook, find pen, ...
_What was I about doing?_
]
---
# Solution?
---
name: inverse
class: center, middle, inverse
#Enter org-capture
---
.left-column[
## org-capture is...
]
.right-column[
- a way to quickly write a small text and save it
- provides standard location
- supports types of notes (choose from menu)
- examples: todo, link, note, quote
- can be extended Emacs style
]
---
class: inverse
![Editor with code file](/0working.png)
##Edting some code
---
class: inverse
![org-capture menu](/1menu.png)
---
class: inverse
![Wrinting note](/2write-note.png)
---
class: inverse
![Wrinting note](/5quotes-file.png)
---
#Templates
There are some default templates.
To create your own, set `org-capture-templates` variable.
It should be a list of templates.
```lisp
("t" "TODO" entry
(file "~/org/todos.org")
"* TODO %?\n %i\n")
```
It contains
- Shortcut key
- Name
- Type
- Pattern string with markers
---
#More templates
Another simple example, using the clipboard content (`%x`)
```lisp
("l" "Link" plain
(file (concat org-directory "/links.org"))
"- %?\n %x\n")
```
The parameter after key and name is type. It can be one of
- `plain`, just any text
- `entry`, an org-mode node (text and headline)
- `item`, a plain text list item
- `checkitem`, like item, but with checkmark template
- `table-line`, a new row in a table
See type in [manual](http://orgmode.org/org.html#Template-elements).
---
#Location to store
Put the note under a specific heading, "Quotes", via function `file+heading`.
```lisp
("z" "Quote" plain
(file+headline (concat "~/Schreiben/quotes.org") "Quotes")
"%c%x%?\n\n --")
```
That will place it under the heading in the target file
![Wrinting note](/3quotes-file-top.png)
---
#Use options
Use properties list at the end.
This one closes the buffer if not open before (`:kill-buffer`), and also adds at beginning (`:prepend`).
Also, surround with :empty-lines, before and after.
```lisp
("n" "Note" plain
(file (concat "~/Schreiben/notes.org"))
"\n%?\n\n%T\n"
:kill-buffer t :prepend t :empty-lines 1)
```
---
.left-column[
## Expansion
]
.right-column[
#Things to insert
- Point where cursor should be at (`%?`)
- Date and time (`%t`, `%T`)
- Clipboard (`%x`)
- Kill ring head (`%c`)
- Current tasks, files, current file path
- Many more
]
.footnote[See [all expansions](http://orgmode.org/manual/Template-expansion.html#Template-expansion) from org-mode manual]
---
class: inverse, center
#Installation
org-capture is part of org-mode distribution.
```
M-x package-install RET org RET
```
---
name: last-page
template: inverse
## That's all!
Slideshow created using [remark](http://github.com/gnab/remark).
</textarea>
<script src="http://gnab.github.com/remark/downloads/remark-0.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
var hljs = remark.highlighter.engine;
</script>
<script src="remark.language.js" type="text/javascript"></script>
<script type="text/javascript">
var slideshow = remark.create({
highlightStyle: 'monokai',
highlightLanguage: 'remark'
}) ;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment