Skip to content

Latest commit

 

History

History
737 lines (598 loc) · 22.3 KB

org.org

File metadata and controls

737 lines (598 loc) · 22.3 KB

Org Cheatsheat

#+HTML_HEAD <link rel=”stylesheet” type=”text/css” href=”stylesheet.css” />

Movement commands

  • C-c C-n Next heading
  • C-c C-p Previous heading
  • C-c C-u backward to a higher level heading
  • C-c C-j org-goto…it is super nice!!

“TODO” notes

Org mode has some VERY handy ways of keeping track of todo items.

The Default TODO/DONE state

When point is on a heading, pressing “C-c C-t” when insert a TODO at the begining of the line, indicatating that it is an item that needs to be completed. Pressing “C-c C-t” changes the TODO “DONE”. You can change the default values as well.

You can also break tasks into neat little subtasks. And keep track of how much of the task is done!

Take over the world [20%]

  • State “TODO” from [2015-10-31 Sat 20:20]

Get some converts [1/2]

  • State “TODO” from [2015-10-31 Sat 20:20]
Talk to people [66%]
  • State “TODO” from [2015-10-31 Sat 20:20]
Kyle
  • State “DONE” from “TODO” [2015-10-31 Sat 20:22]
  • State “TODO” from [2015-10-31 Sat 20:20]
Jen
  • State “TODO” from [2015-10-31 Sat 20:20]
Juice
  • State “DONE” from “TODO” [2015-10-31 Sat 20:21]
  • State “TODO” from [2015-10-31 Sat 20:21]
Write some web blogs
  • State “DONE” from [2015-10-31 Sat 20:22]

Get some $$$ [33%]

  • State “TODO” from [2015-10-31 Sat 20:20]
Rob a bank
  • State “DONE” from “TODO” [2015-10-31 Sat 20:21]
  • State “TODO” from [2015-10-31 Sat 20:21]
start a business
  • State “TODO” from [2015-10-31 Sat 20:21]
sell my stuff
  • State “TODO” from [2015-10-31 Sat 20:22]

Overthrow the government

  • State “DONE” from “TODO” [2015-10-31 Sat 20:22]
  • State “TODO” from [2015-10-31 Sat 20:20]

help the common man

  • State “TODO” from [2015-10-31 Sat 20:20]

kill all the remaining zombies [1/2]

  • State “TODO” from [2015-10-31 Sat 20:20]
kill the zombies in Africa
  • State “DONE” from [2015-10-31 Sat 20:23]
STARTED kill the zombies in NY
  • State “STARTED” from [2015-10-31 Sat 20:23]

You can also create little checkboxs too!

shopping [2/3]

  • State “TODO” from [2015-10-31 Sat 20:24]
  • [ ] pickles
  • [X] onions
  • [X] lettuce

Getting familiar with org-agenda

commands

  • v d or d shows’ today’s agenda
  • v w or w shows this week’s agenda
  • v m view this month’s agenda
  • v t shows the fortnight
  • . goto today’s agenda
  • j goto a specified date
  • J goto the currently clocked in task
  • v c shows you overlapping clock entries
  • r redraw the agenda buffer
  • C-k kill the current agenda item in the agenda buffer and in the file
  • C-c C-w refile the entry
  • T show the tags of an entry
  • : set the tags for the current entry
  • , set the priority of the item
  • P show the priority of the item
  • + Increase its priority
  • - minus its priority
  • z add a note to the entry
  • > change the timestamp with that entry
  • I clock in on an entry
  • O clockout on an entry
  • X cancel the current running clock
  • m mark the entry at point
  • u undo the marked point
  • U unmark all marked entries
  • % mark via regexp

views

  • (org-agenda-log-mode) enteries that were marked done while logging was on, are shone in hte agenda, as are entries that have been clocked today.
  • (org-agenda-clockreport-mode) the agenda view will show a table with all your currently clocked time on tasks.
  • (org-agenda-entry-text-mode)

export commands

In an org buffer type C-c C-e and org-mode will open a buffer that will prompt you for how you would like to export your document.

Export Settings

info:org#Export settings Export options can be set globally with variables, but its much easier to specify your export options in your org buffer

For example #+OPTIONS: toc:nil DATE:<2015-11-20 Fri> will not export your table of contents and specifies an export date +TOC:nil does nothing

  • = Trees with the tag :noexport: means they won’t be exported

Org babel

Org babel allows you to insert code blocks into a document. Those code block’s results, can be weaved to html, latex, info, etc OR that code can be tangled to be later run by a computer! It super cool because inside one emacs buffer, you can be writing a program that uses 30 different languages, and each block’s results can be used as input to any other block!
  • An sql example
:PROPERTIES:
:engine: mysql
:dbhost: localhost
:dbuser: root
:dbpassword: <your password here>
:database: usbc
:END:

sql

SELECT first, last FROM users WHERE last = 'Branson' limit 5
firstlast
JoshuaBranson
JoshuaBranson
JoshuaBranson
JoshuaBranson

That “my_query” block can be passed as input to the following code block

(print x)

One can also tell emacs NOT to export the results of a code execution via

This just mean that when you export the document to html, pdf, .odt, etc., then you will not see that code block’s source code or results.

  • A gnu plot example
    set title "My First Plot";  plot 'data';  print "all done!"
        

gnu calc

fsolve (x*2 + 4 = 5, x)
fsolve([x + y = a, x - y = b],[x,y])
integ (x**2,x)

gnuplot

plot x**2 with lines

running code remotely

ls

C code

double pi = 4*atan(1);
double r, theta, phi;
r = sqrt(x*x+y*y+z*z);
theta = acos(z/r) * 180.0/pi;
phi = atan2(y,x) * 180.0/pi;
printf("%f %f %f", r, theta, phi);
10.816654 22.406871 75.963757

To include multiple C header files

org mode

Sometimes you may need to generate org-mode source code inside your document for exporting. So to do that you do:

 print "foo"
#+END_SRC

simple calc example

2*3
6

lisp

(mapcar (lambda (el) (* el el)) (append '(1 7 3 4) (list n)))
14991625
1
2
3
(+ 1 (length lst))
4

*

bash

echo "This file takes up `du -h org-babel.org |sed 's/\([0-9k]*\)[ ]*org-babel.org/\1/'`"
pacman -Q firefox

This program lists duplicate files. It runs md5sum on the files to find the duplicates https://www.maketecheasier.com/remove-duplicate-files-linux/

find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate

In this example both the lisp code and the results will be exported:

(print "hello")
hello

So, we make a named code block in the si.org file called “figure-1”. Then we call it like this:

#+call: si.org:figure-1() :wrap html

http

ob-http mode

GET https://api.github.com/repos/zweifisch/ob-http/languages
Accept: application/vnd.github.moondragon+json

header arguments info:org#Specific header arguments

:var

:var [<variable name>=<[ literal_value | #+table_name ]>] [<variable name>=<[ literal_value | #+table_name ]>] …

:var lets you assign a variable at the top level header argument.

x + y + z
1.89
you can assign a variable to the result of an org src code block

5 gallons of gas costs

5 * gas

:dir

ls | grep -m 5 -e ".*org" -

:output-dir

:exports

:exports [both | results | code | none]

Export specifies what needs to be saved when you export the document

passing specific org table columns

groceries50
rent800
debt500
electric100
for output in $name; do
    echo $name
done
2+a*x**y

Org spreadsheets/tables

Money I earn in a monthExpensesExpenses$Total
2000groceries500
100gas200
700

One refers to a specific table in org, @ROW$COLUMN. Sometimes its hard to see the column and row values. To show these, anywhere in the table type C-c }. Typing C-c } again, will turn hide the row and column values. You can add columns fairly easily. For example, let’s sum my expenses for the month: at the bottom of my expenses row, type in =@2$3 + @3$3

But let’s say that you have lots of expenses. How can I add a range of values? in the total section under expenses type: =vsum(@2$3..@5$3)

Money I earn in a monthExpensesExpenses$Total
2000groceries500
100gas200
800rent450
20entertainment20
1170

Commands

  • C-c * recalculates that table row
  • C-} toggles showing the row and column numbers
  • C-{ toggles formula debugging
  • C-c | convert the active region to a table
  • TAB moves you to the next column
  • S-TAB takes you back to the last column
  • org-table-delete-column deletes the column point is in
  • C-c - insert a horizontal line below point
  • C-c SPC blank the field at point
  • M-left move column to the left
  • M-right move column to the right
  • C-c ' edit the field in a seperate window=
  • C-c SPC blank the field at point
  • C-c <RET> insert a horizontal row below point
  • C-c ^ sort the current table, by the column that point is in alphabetically or numerically SUPER COOL.

Org Columns

When in an org file, you can change the file to column view. You can define a custom column format for the whole file with:

#+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO

You can define a column view for a specific subtree with

** Top node for columns view
   :PROPERTIES:
   :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
   :END:

org lists

* hello there you cool people
* hello  C-RET will make a new item in this list
* here is that new item!

When you have a list like the one above, to add to it just type C-RET, but when you have a list like the one below, you need to type M-RET.

1) tahsetnhaentuh
2) snthaoentuhesntuh
3)
4)
5)
6)

This paragraph would mess up your list.  If you try to start a new list here, org will assume that it should start at "1)".  To fix it, you have to include the =[@<number>] text  [@<number>]=.

7) [@7] sntahenusth [@7]
8)

latex equations

\[ \hat{F}(ν) = \frac{G(ν)}{H(ν)}. \]

There are other ways that I’m supposed to be able to make latex fragments If $a^2=b$ and \( b=2 \), then the solution must be either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].

\begin{equation} x=\sqrt{b} \end{equation}

org-preview latex fragment with “C-c C-x C-l”

\begin{equation} R=-µ\fraq{dux}{dy} \end{equation}

Creating Indexes

You can specify entries that will be used for generating an index during publishing. This is done by lines starting with `#+INDEX’. An entry the contains an exclamation mark will create a sub item. See *note Generating an index:: for more information.

  • Curriculum Vitae

Agenda

Agenda commands

  • A redraw the agenda view and prompt for how you want it
  • d show the day’s view
  • w show the week’s view
  • f go forward in time
  • b go backward in time
  • j jump to a specific date
  • . jump to today
  • D toggle inclusion of diary entries
  • vl toggle logbook mode.
  • vR will toggle clockreport mode. You will see a table showing you the total amount of time
  • vc show overlaping clock entries, clocking gaps, or other clocking problems. Then press l to return to the normal agenda view
  • G toggle displaying of the time grid in the view
  • g/r redraw the agenda buffer
  • / filter by tag
  • \ narrow the agenda buffer further by another tag
  • = filter the agenda view by regexp
  • | remove all filters on the agenda view
  • a archive the item at point
  • T show the tags associated with the current item
  • : set the tags for the current item
  • , set the priority of the item
  • z add a note to this entry
  • C-c C-s attach an item to this item
  • I clock in
  • m mark the agenda item
  • u unmark the item
  • U unmark all items
  • % mark all entries via a regexp
  • B do a bulk action on the marked items in the agenda

When inside the calendar/agenda

  • i insert a new entry into the diary
  • M show the date phases of the moon
  • S show sunrise and sunset times
  • H show upcoming Holidays
  • =

inserting links

a bbdb record link into the file

bbdb:Nathaniel Simone How cool is that?

To do this “C-c I” bbdb RET <name of person>

an email address

my email address

To do this “C-c I” mailto RET <email address>

gnus links!!!???

Putting images in the document

~/.emacs.d/images/which-key.png

Easy Templates

Org mode supports insertion of empty structural elements (like #+BEGIN_SRC and #+END_SRC pairs) with just a few key strokes. This is achieved through a native template expansion mechanism. Note that Emacs has several other template mechanisms which could be used in a similar way, for example yasnippet.

To insert a structural element, type a ‘<’, followed by a template selector and <TAB>. Completion takes effect only when the above keystrokes are typed on a line by itself.

The following template selectors are currently supported.

  • s #+BEGIN_SRC … \ #+END_SRC
  • e #+BEGIN_EXAMPLE … \ #+END_EXAMPLE
  • q #+BEGIN_QUOTE … \ #+END_QUOTE
  • v #+BEGIN_VERSE … \ #+END_VERSE
  • c #+BEGIN_CENTER … \ #+END_CENTER
  • l #+BEGIN_LaTeX … \ #+END_LaTeX
  • L #+LaTeX:
  • h #+BEGIN_HTML … \ #+END_HTML
  • H #+HTML:
  • a #+BEGIN_ASCII … \ #+END_ASCII
  • A #+ASCII:
  • i #+INDEX: line
  • I #+INCLUDE: line

For example, on an empty line, typing “<e” and then pressing TAB, will expand into a complete EXAMPLE template.

You can install additional templates by customizing the variable org-structure-template-alist. See the docstring of the variable for additional details.

Categories

I can specify Categories to show up nicely in the agenda buffer Right under a tree item, I can say

* Good Jokes
  :PROPERTIES:
  :CATEGORY: Projects
  :END:
** One time this farmer

Schedulting

Scheduling involves creating timestamps. An active timestamp is enclosed by “<” and “>”, and it will cause the heading it’s in, to show up in the agenda buffer. An inactive timestamp is enclosed by “[” “]” and it will not show up in the agenda buffer. You can schedule to begin working on a TODO item by typing C-c C-s. You can schedule a deadline for a TODO item by typing C-c C-d.

The result is this

* TODO Walk the dog
  SCHEDULED: <2015-11-23 Mon>

You can also make items repeatable like so. This tasks repeats everyday and lets you know if you miss it.

* TODO Walk the dog
  SCHEDULED: <2015-11-23 Mon +1d>

However the above is not satisfactory. Org-mode provides two nice extensions to this.

The below reminds you to take out your trash once a week. BUT if you forget to do it, it’ll still make you take it out on Monday. The + sign is a precise mathematical operation. It precisely remembers the day to do this task.

* TODO Take out the trash
  SCHEDULED: <2015-11-23 Mon ++1w>

The below reminds you to brush your teeth. BUT if you forget to do it, it’ll still tell you do it the next 3rd day. The . is a regexp symbol that can is a variable. In the same way, the day that you do this task is variable.

* TODO Work out
  SCHEDULED: <2015-11-23 Mon .+3d>

You can also say that you want to do something at least every third day but at most every fourth day like this

* TODO workout
   SCHEDULED: <2015-11-26 Thu .+3d/4d>

To mark a task with a repeater as `DONE’, use `C– 1 C-c C-t’ (i.e., `org-todo’ with a numeric prefix argument of -1.)

Advanced Scheduling

Org scheduling will only get you so far. Org timestamps cannot plan things like “The 2nd Thursday of the Month”, but the Emacs Diary Sexp Entries can!

For example, suppose your local bowling team goes bowling on the 3rd Tuesday of every month. Here is how you can schedule that task:

*  Go Bowling with the Gents
 <%%(diary-float t 2 3)>

If you would like to know more, the documentation for the function “diary-float”, is quite sufficient.