My notes on emacs' org mode Zintis notes on org-mode in emacs
1 Everything you need in orgmode (basics)
From this blog at karl-voit.at
* This Is A Heading ** This Is A Sub-Heading *** And A Sub-Sub-Heading Paragraphs are separated by at least one empty line. *bold* /italic/ _underlined_ +strikethrough+ =monospaced= [[http://Karl-Voit.at][Link description]] http://Karl-Voit.at → link without description - list item - another item - sub-item 1. also enumerated 2. if you like - [ ] yet to be done - [X] item which is done : Simple pre-formatted text such as for source code. : This also respects the line breaks. *bold* is not bold here.
2 Changing fonts for highlights.
In org mode, you can include some elisp code in a src block that modifies the fonts in headings. Just copy this src block and modify the height as you like.
(custom-set-faces '(org-level-1 ((t (:inherit outline-1 :height 1.4)))) '(org-level-2 ((t (:inherit outline-1 :height 1.0)))) '(org-level-3 ((t (:inherit outline-1 :height 1.0)))) '(org-level-4 ((t (:inherit outline-1 :height 1.0)))) '(org-level-5 ((t (:inherit outline-1 :height 1.0)))) )
3 Basics and Text Entering basics
3.1 sections
one , two *, three * etc. are for sections and subsections when in one subsection, can hit m-return or "alt hammer" in slang that will add another element at the same level.
so if you were in a list, and want another list entry alt hammer
if you were in a * level, and you want another * entry alt hammer
etc.
3.2 tabs
when in one section and entering a new line, hit tab to align to the correct column if you have inserted text from some other source that is not aligned, you can simply hit tab anywhere on the line, and that line will align itself to the level above it. note: if you are inserting python code as an example, it will mess up the code indents
- i still don't know how to change this behaviour when inputting python code.
3.3 expanding/collapsing all tabs
use shift-tab
repeatedly. it is a toggle.
3.4 using m-arrows
m-hammer
can also be used at any level to create a new line with the same heading
3.4.1 then m-right arrow i.e. -> will make that a sub-level (i.e. one more asterix)
of course you can also just type the '*
' that works as always.
but using m-arrows
does not require you to be at the beginning of the line
where the asterixes are. cool cool.
3.4.2 m-up arrow or m-down arro
will of course move the whole section up or done (within the same level)
3.5 m-hammer broken
since updating emacs, when i use m-hammer
i would get a new top level heading
and not a new heading at the current level to fix it i researched the following:
m-hammer
is (org-meta-return)
actually it wasn't broken:
my meta key had changed from apple 'command'
to apple option
.
4 tips within org mode
4.1 moving sections moving
m-down arrow
will move the section down
m-up arrow
will move the section up
- have the cursor somewhere/anywhere in the section, on any section even in a simple paragraph.
note: this works for me in terminal mode, for instance emacs -nw
org-mode.org
, but in windows mode it works when i am using the \-option key
from my mbp keyboard as the meta key
4.2 check boxes [ ] checkbox
simply square brackets with a space, specifically:
minus space bracket space bracket
4.2.1 my checklist [ ] checklist
[ ]
eggs[ ]
bacon[ ]
sausage[ ]
spam[ ]
lobster thermidor au crevette with a mornay sauce served in a provencale manner with shallots and aubergines garnished with truffle pate, brandy and with a fried egg on top of spam
4.2.2 progress indicators on checklists [/]
marking the checkbox with an x
changes its colour.
to make a progress indicator for the checkboxes, type space bracket slash
bracket
i.e. [/]
level with the checkbox list.
then covert it to a progress indicator by
C-c C-c
while cursor in the [0/5]
box. c-c c-c
also toggles it complete
could of course just hit "x" to mark it, rather C-c C-c
while cursor
in the box.
important
C-c C-c
is a toggle (done and not done)
4.2.3 example of progress indicator [1/4]
progress
[ ]
eggs- bacon
[ ]
sausage[ ]
spam
4.2.4 checklist percentages [36%]
progress%
[ ]
aquaduct[ ]
sanitation[ ]
roads- irrigation
- medicine
- education
[ ]
wine[ ]
public baths- peace
[ ]
public order[ ]
sanitation, medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health
if one adds or subtracts a checklist line, one must c-c c-c to force the progress line to re-calculate.
4.3 tags
C-c C-c
can be used to assign keywords/(tag) to a heading. any level.
you will see a prompt: to enter a tag.
this will display a tag on the right side.
4.4 adding links
orgmode.org is a good web page. specifically handling links as text it is: [ with [link] then [description] ending with ]
c-c c-l
to both add a link, and to edit one already there (cursor must be
on link)
- i learned this first from here
- pressing
c-c c-o
to open - to edit, simply delete the last "]". there are a pair of [][] with a pair [] surround the whole.
- like this: [[link][description] ]
- as soon as you delete the (hidden) last ] is will no longer be a link.
- edit it, then add the last ] when done and it is back to being a link.
c-u c-c c-l
to add link to a file, not just http links.
- so for example, a link to the org-mode reference card using c-u c-c c-l
- if the external link is a local file link,
c-c c-o
will open the file in a split buffer. how cool is that!c-x b
will switch buffersc-x c-b
will list buffers.
can link to not just websites.
my emacs eg emacs.org it can also be specific lines in files, like my python elpy in emacs.org
4.5 adding links from specific headings in other org files
when in the target org file, (or in the current file) at the chosen link, type
c-c l
for "org-store-link", which was previously set in init.el as follows:
(global-set-key (kbd "c-c l") 'org-store-link)
you will see a message "stored: title of the section heading"
for whatever
the title is on the section heading you pressed c-c l
on. that will "store"
i.e. copy to clipboard, the target file link.
move to the buffer where you want to insert the link, and c-c c-l
as usual
except rather than pasting an html link, with description, you can now
just hammer the copied file link instead of pasting an html link.
then proceed with the description for the file link.
- adding links
- expanding links
- adding links from specific headings in other org files
- Other good youtube links about org mode follow:
- Summarizing file link workflow
If you C-c l
a bunch of links, those links are stored in a buffer of links
from which you can choose a link when you enter C-c C-l
again.
C-p
and C-n
to move between stored links.
Finally, these links do NOT have to be within the same org mode file, or even
another org mode file. They could be in any file type. So for example,
editing my ~/.emacs.d/init.el file, I can type C-c l
and store the link
from that file. Then in my .org file I can C-c C-l
and past that link.
Here is a link to my init.el web-mode section Clicking on this link in this org mode file, will open that file in a split window buffer. How cool is that?
These next five links are all links to heading within this same file.
Also
(global-set-key (kbd "C-c C-l") 'org-insert-link)
but this one is default so
probably already set.
4.6 Summarizing file link workflow
C-c l
while on a heading, ( link stored in buffer)C-c C-l hammer
at the link insertion point ( link pasted)- Just add a description and
hammer
Voila!
Result is [ [ *heading ] [ description ] ]
4.6.1 The "target org file" could be a different heading in the current file
If that is the case, the link is just to jump to a different point in the same file.
4.7 expanding links
just use delete key when cursor at the end of the link, but not sure if this permanently deletes it or not. C-c C-o to open the link in my default browser. - bloody right good this is.
4.8 these too can be expanded or contracted using the tab key on the * or **
- org mode has plenty of features.
- these are just the simplest features with which I have scratch the surface
4.9 Other good youtube links about org mode follow:
5 Calendars
I moved this section to its own calendar agenda file.
6 Markup a.k.a. emphasis
Bold, italic, verbatim
other
strikethrough underline
See Org-mode customization section as well.
You can markup text through special characters, beginning and ending a word or phrase. You can use:
- * for bold
- / for italic
- = for
verbatim
- ~ for
other
- + for
strikethrough - _ for underline
*Bold *, /italic /, =verbatim = ~other ~ +strikethrough + _underline _
This is my example where only I can try to add exactly what I want
to add.
For stuff that is obsoleted in my notes, I can strikethrough the whole
sections
For more information on the markups availble see this documentation online at orgmode.org
You can make words bold, italic, underlined, verbatim
and code
. That means:
*bold *, /italic /, _underlined _, underlined
, =verbatim = and ~code ~. That
means:
if you must, ‘+strike-through+’. Text in the code and verbatim string is not processed for Org-mode specific syntax, it is exported verbatim.
To insert a horizontal rules, use a line consisting of only dashes, and at least 5 of them.
6.1 customizing the emphasis colours: (colors:)
The colours shown for a particular emphasis are specified in the init.el file as follows:
(add-to-list 'org-emphasis-alist '("*" (:foreground "red"))) (add-to-list 'org-emphasis-alist '("~" (:foreground "yellow"))) (add-to-list 'org-emphasis-alist '("=" (:foreground "magenta"))) (setq org-hide-emphasis-markers t)
6.2 Literal Markups for Chunks of Code
if type(stringZ)is complex: print(" stingz is already complex ") return(stringZ) else: stringZ = stringZ[0:-1] # truncate the last field -1 which is the letter i liststrings = stringZ.split() # split into a list of three parts - to remove the spaces liststrings.append("j") # adds the "j" complex_string = ''.join(liststrings) # joins them up again without the spaces return(complex(complex_string)) # converts this string to a complex number
7 Unstructured lists
You can add an unstructured list like this:
- bulleted
- list
- items
- To add more list entries, use "alt-hammer"
- That's slang for M-RETURN. If you just hit return, you will get ever more indented lists.
There are some key powerful features with these list. They are:
7.1 change, or indeed cycle through all the list types
C-c--
or M-x org-ctrl-c-minus
7.2 change a region into an unstructured list
C-c--
actually does more depending on the context. It also:org-table-insert-hline
when in a tableorg-toggle-item
when somewhere else??org-cycle-list-bullet
when in a list
The list cycle is as follows: - + * 1. 1)
- another powerful features. I should tag these powerful feartures somehow.
8 Org-mode can insert images (visible when exported)
This is simply the image full name surrounded by two square brackets, as far as I can tell. A couple of notes:
- if the referenc is relative, org-mode will only display the image if it exists in the relative directory location
- if one uses
[ [path-to-file][description of file] ]
you will NOT see the image inline. Only the link to the image - if one uses
[ [ path to file ] ]
then you WILL see the image inline (after exporting) - exporting will NOT be able to open HTML files unless ALL links are valid.
I got this example straight out of org Great stuff out of this youtube video.
8.1 Toggle inline display of images
M-x
- org-redisplay-inline-images
- org-display-inline-images
- org-toggle-inline-images
- org-remove-inline-images
9 differences between terminal mode and windows mode
9.1 Terminal mode needs "emacs -nw"
In terminal mode moving whole sections works using M-up
or M-down
where up and down are the up arrow and down arrow respectively.
In terminal mode C-h k
then M-down showed me that, ESC
<down>
(translated from ESC M-O B
) runs the command org-metadown
(found in org-mode-map), which is an interactive compiled Lisp
function in ‘org.el’.
It is bound to <M-down>, ESC <down>, <menu-bar> <Org> <Edit Structure> <Move Subtree Down>, <menu-bar> <Tbl> <Row> <Move Row Down>.
9.2 Windows mode
In windows mode, C-h k M-down
gives me an error, "ESC-down is undefined"
I had to change preferences in my Terminal app, under Profiles and Keyboard
The toggle to change is called "Use Option as Meta key"
.
With that set, (and emacs called from within a terminal) M-down
worked for me.
9.3 stuff I have yet to cover:
9.3.1 (org-metadown &optional ARG)
Move subtree down or move table row down.
Calls ‘org-move-subtree-down’
or ‘org-table-move-row’
or
‘org-move-item-down’
, depending on context. See the individual
commands for more information.
10 Organizing org (adding, moving sections)
10.1 New sections of the same type,
just hit M-RET a.k.a. ESC-RETURN a.k.a. "met-hammer"
10.2 another level 2
with text
10.3
11 Tasks
11.1 tasks[ 0/3]
- this needs to be done ( just really fourth level * from left most column )
- second task
this needs to be done
- third task
shoulld be able to hit "t" to cycle a task from todo, done, which then automatically updates two things, one is the 0/3 changes to 1/3 the other is that it adds a date when the task was done (automatically)
12 Two CURL examples Using the International Chuck Norris Database
From the youtube Devnet course: https://youtu.be/1sauCq5Hnoc
13 Tables
13.1 first what you type:
use vertical bars | between your headings for more space in current table row use TAB
For next row, plain hammer or TAB, then when on next line, at the beginning: | - TAB
start typing, | N a m e | P h o n e | A g e RET | - TAB.
some | Data |
---|---|
XML | spaces don't matter |
use tags like | |
<ip> 1.1.1.1 </ip> | |
- | |
JSON | spaces don't matter |
use curly braces {} | |
and [] for arrays | |
and commas | |
YAML | indentation matters |
no commas | |
Add "wrap" text within a cell by using M-RETURN
Once the table has as few columns or rows, you can rearrange
them
very easily by M-up
, M-down
, M-left
, and M-right
.
You can add
more columns by simply adding more headings separated by "|".
There are more capabilites of tables listed here at org-mode.org.
Some common ones:
C-c SPC
(org-table-blank-field)Blank the field
at point.Hammer
(org-table-next-row) Re-align the table andmove
down tonext row
. Creates a new row if necessary. At the beginning or end of a line, RET still inserts a new line, so it can be used tosplit a table
.
M-a
(org-table-beginning-of-field)Move to beginning
of the current table field, or on to the previous field.M-e
(org-table-end-of-field)Move to end
of the current table field, or on to the next field.
M-LEFT
(org-table-move-column-left)Move
the current columnleft
.M-RIGHT
(org-table-move-column-right)Move
the current columnright
.M-S-LEFT
(org-table-delete-column) remember M-S means "alt-shift"Kill
the current column.M-S-RIGHT
(org-table-insert-column)Insert
a new column to the left of point position.M-UP
(org-table-move-row-up) Move the currentrow up
.M-DOWN
(org-table-move-row-down) Move the currentrow down
.
13.2 Using C-c |
You can also =create a table from scratch with C-c |
. You will be asked for
the structure of the table, the default being 5x2 (see
org-table-default-size), five columns and two rows:
Org mode also lets you convert an existing region into a table. For this,
select a region and press C-c |
The region could be comma seperated strings.
For example:
heading one, heading two, heading three, heading 4
Selecting that and pressing C-c |
then becomes
heading one | heading two | heading three | heading 4 |
13.3 Fixing column widths:
you want to restrict the width visible width of a cell, you need to add a new row to your table.
A very wide cell | Another very very wide cell |
Pressing C-c C-c
on this table will update the display so that the first and
second columns are respectively narrowed to 10 and 15 characters:
A very=> | Another very => |
When columns are narrowed, it might be useful to temporarily see the content
of a cell with C-u <TAB>
(or C-u C-c `
) or to edit the content in a separate
window with C-c `.
13.4 Aligning table cells (left-centre-right)
If you would like to overrule the automatic alignment of number-rich columns
to the right
and of string-rich columns
to the left
, you can use <r>
, <c>
or <l>
in a similar fashion. You may also combine alignment and field width
like this: <r10>
.
Lines which only contain these formatting cookies are removed automatically upon exporting the document.
14 Export to other formats
14.1 C-c C-e for export menu
C-c C-e
will open a minibuffer with all the options to where you can export
hit h
then o
to open html for example
Here is some metadata: with Hashtag colon opptions as follows;
This option specifies that a table of contents, toc, is set to true, t
However, if you don't want a table of contents, specifiy toc:nil
Then when
exporting to HTML this won't have the table of contents.
you can also export to pdf (latex (l) pdf () )
Other export formats can be added. That can be downloaded by searching
packages that start with "ox". ox for "Org eXport." Specifically the next
section describes my favourite: ox-twbs
14.2 Some ox-twbs export, a.k.a."Org eXport- TWitter Boot Strap"
out the org export to twitter boot strap. Now known as bootstrap
.
ox-twbs twitter boot strap package, install it, then C-c C-e w o
for twitter and open.
ox-gfm
package for github flavoured markdown (if you want) org-drill gives you
question / answer layouts, and have emacs present them.
Check out org2blog
that published to a wordpress site.
Check out org-publish
that published org docs to a website,
a whole tree of org files
, and creates an entire website.
14.3 Changing colour of highlighted text in html exports
When exporting org files into html, verbatim, or highlighted text defaults to white background, red text. Here's how you change it:
First a couple of links: kitchingroup.cheme.cmu.edu has a blog on this.
This post looks promising while in org mode: stackoverflow.com
14.3.1 zintis.net exporting colours
I added this line to all of my ,org files. Now when I export, I get the colours I want:
#+HTML_HEAD_EXTRA:<style>footer { background-color: #353535; } body {background-color: #222; color: lightgreen; } h3, h4 {color: teal} h1, h2 {color: #08f} pre { background-color: #111; color: #dcc; } code { background-color: #444; color: #ff0; } </style>
15 Batch exporting to hmtl files
The command C-c C-e
followed by the options w and h really just run the
command M-x org-twbs-export-to-html
So, I should be able to run this in a
batch command as follows:
emacs myorgfile.org --batch -f org-html-export-to-html --kill emacs myorgfile.org --batch -f org-twbs-export-as-html --kill emacs myorgfile.org --batch -f org-twbs-export-as-html -l ~/.emacs.d/init.el --kill
f
executes a single LISP functionl
load emcs LISP code from a file and execute it
Emacs –batch will not load your init.el file unless you explicitly tell it
to do so. Use the -l ~/.emacs.d/init.el
option to do so.
Some other options to explore:
16 Syncing to Dropbox and MobileOrg
In order to sync up mobileOrg with this folder, you have to setup MobileOrg with the same username and password as this mac.
16.1 MobileOrg
MobileOrg the automatically created the folder Dropbox/Apps/MobileOrg where it synced any files I created with the MobileOrg app.
16.2 MacBook with MobileOrg
Set up your org mode configuration files with this:
;; Set to the location of your Org files on your local system (setq org-directory "~/eg") ;; Set to the name of the file where new notes will be stored. ;; (setq org-mobile-inbox-for-pull "~/eg/flagged.org") (setq org-mobile-inbox-for-pull (concat org-directory "/flagged.org")) ;; Set to <your Dropbox root directory>/MobileOrg. (setq org-mobile-directory "~/Dropbox/MobileOrg") (setq org-mobile-directory (concat org-directory "~/Dropbox/MobileOrg"))
After restarting emacs/reparsing your configuration, run org-mobile-push
.
This will copy your Org files to ~/Dropbox/Apps/MobileOrg, which is where
MobileOrg will read from.
You can run org-mobile-push by pressing C-c C-x RET p
whilst you are
in an Org buffer. If you use spacemacs just type: SPC q r
Go back to MobileOrg and click on the Outlines tab at the bottom, then click the Sync button in the upper right.
After capturing notes or making changes on the device to your Org files, be
sure to sync in MobileOrg. Then run org-mobile-pull
from Emacs to integrate
your changes. After integrating, you can run org-mobile-push
to make sure
MobileOrg has access to the latest version of your files.
16.2.1 NOTE:
If you already had a MobileOrg directory in your ~/Dropbox/Apps, a new folder will be created like MobileOrg (1). You should rename the newly created MobileOrg (1) folder to something that makes more sense, perhaps MobileOrg-staging before proceeding. Be sure your org-mobile-directory Emacs variable reflects this change.
set the following in your .emacs.d/init.el
file:
(setq org-agenda-files (quote ("~/Pending/org/gtd")))
This will automatically expand directory contents using org-agenda-file-regexp
which by default is set to
"\\'[^.].*\\.org\\'"
So it matches all non-hidden org files. Nice.
16.3 MobileOrg push and pull
Sync items by running org-mobile-push and org-mobile-pull This can be done with the following key sequence:
C-c C-x RET p
for push
C-c C-x RET g
for pull
17 Agenda mode in orgmode.
Any org mode file can become an agenda file. Doing so will make any regular heading, at any level, become an agenda item, if so converted. So I see this as 3 steps.
- add the .org file as an agenda files , and
- make the headings in that file into Using TODO items (or other types of agenda items) I explain both stpes below.
- you can change views by switching to Agenda view and others. These views each have their own commands.
17.1 agenda files
For an org file to become an agenda file it must be added to the list of files that agenda will keep track of. Not any org file in the current directory or sub-directories will be checked for. I will keep the following files:
- todo.org
- zint-calendar.org
17.1.1 Add a file to the agenda list
To add a file to the top of the agenda file list use C-c [
17.1.2 List all the agenda files
To see all the files in the list try M-x org-agenda-list
17.1.3 Remove a file from the agenda list
To remove a file, edit that file and type C-c ]
17.1.4 To cycle through all agenda files
If you only have one agenda file, then this will do nothing, otherwise:
C-'
will do it.
Agenda file commands:
Key | Function |
---|---|
C-c [ |
add/move current file to front of agenda |
C-c ] |
remove current file from your agenda |
C-' |
cycle through agenda file list |
C-c C-x </> |
set/remove restriction lock |
C-c a L |
show timeline of current org file |
17.2 Agenda view
Org agenda view can be reached with M-x org-agenda
The most common key-binding to M-x org-agenda
is C-c a
Once enabled, M-x org-agenda
will show a list of single letter "commands"
as follows:
a
Agenda for this weekt
list of all TODO itemsT
list of all TODO items specifically with TODO: keywordm
match a tags/prop/todo queryM
match a tags/prop/todo query restricting to TODO: keyworde
export agenda views
search for keywordsn
Agenda and all TODOs, (new view)
17.2.1 Do not get confused with spacemacs
Spacemacs uses SPC for lots or commands, including SPC-a to enter
agenda view. Lots of agenda videos on youtube talk about this. Do
not get confused by that. I have set M-g a
as my key binding for
M-x org-agenda
17.3 Changing key binding
To find another key binding for org-agenda. How about M-g a
for "goto agenda" ? It is not taken as of
See details in Customize Key Bindings So, set the key binding like this:
interactively: M-x global-set-key RET M-g a org-agenda RET
or just
- (define-key org-mode-map "\C-a" 'move-beginning-of-line)
- (define-key org-mode-map "\C-a" 'move-beginning-of-line)
- (define-key org-mode-active-map "\C-a" 'some-emacs-function-or-something)
(define-key org-mode-map "C-c s" 'org-deadline-in-one-week)
In my init.el file I have saved these keyboard macros:
;; setting Zintis org-mode keyboard macros (fset 'make-bold (kmacro-lambda-form [?\C-w ?* ?\C-y ?*] 0 "%d")) (fset 'make-hlight (kmacro-lambda-form [?\C-w ?~ ?\C-y ?~] 0 "%d")) (fset 'make-underline (kmacro-lambda-form [?\C-w ?_ ?\C-y ?_] 0 "%d")) (fset 'make-verbatim (kmacro-lambda-form [?\C-w ?= ?\C-y ?=] 0 "%d"))
So I also added a key binding for these four functions:
- (define-key org-mode-map "\C-c b" 'make-bold)
- (define-key org-mode-map "\C-c h" 'make-hlight)
- (define-key org-mode-map "\C-c u" 'make-underline)
- (define-key org-mode-map "\C-c v" 'make-verbatim)
For just in the current major mode, type M-x local-set-key RET M-g a org-agenda RET
18 Editing agenda files
These files are simply org files with usual headings. These headings can be
interactively changed to TODO
items, or SCHEDULED
items or AGENDA
items
with the various commands. I call these the agenda files commands below.
Resulting headings will have special words in the agenda file.
You will see the following keywords after running the above agenda mode
commands:
NEXT
TODO
PROJ
WAITING
SOMEDAY
DEADLINE
18.1 Using TODO
You can mark an item as a TODO item by using a 3-way toggle:
shift-right arrow
cycles through TODO, DONE, OFFshift-left arrow
cycles through OFF, DONE, TODO
Just remember to have the cursor somewhere on the heading itself to cycle
Try it on these task below:
18.1.4 todo lists
use a +
or the usual -
for a regular list inside the todo. (try it)
18.2 Shortcuts for TODO
M-S-hammer
adds a new TODO or Checkbox item
C-S-hammer
adds a new TODO or Checkbox item after subtree
C-c C-t
adds a new TODO (in place of typing TODO: which also works)
18.3 Scheduling Todo Items C-c C-s
With dates, you can schedule todo items
C-c C-s
inserts a scheduled timestamp, for the heading that your cursor is on
Can create repeating
scheduled events by simply adding
+1w
to the scheduled timestamp.
+1w
will add that schedule on this day every week.
++1w
will ensure your scheduled events will only be in the future
18.4 Deadlines
C-c C-d
inserts a deadline (that has an automatic date added) This is done
on a heading level, apparently no matter at what level the heading is.
Select the date
, then hammer
Could also try C-c .
which is a time stamp for today's date.
key sequence | Command |
---|---|
C-c C-s | schedule this heading |
C-c C-d | define a deadline |
C-a a | Switch to agenda view |
Shift-f | follow mode |
F | move forward |
B | Move backward |
18.5 Follow me mode
When you are editing an org file that has been added to your agenda files,
(see Add a file to agenda list ) and you subsequently hit M-g a
then the
screen will split into 2. You can use Shift-f
to have your cursor "follow"
where you are in the agenda view, and so quickly edit each item as needed,
and add more info or whatever.
18.6 Timestamps
C-c .
prompt for timestamp (default is today, no time stamp)
C-u C-c .
today with timestamp
C-c C-d
deadline
C-c C-s
scheduled
C-c C-y
calculate time between 2 dates in the time range
Can then adjust timestamps (both scheduled and deadline)
S-RIGHT/LEFT
on a timestamp adds/subtracts 1 day
S-UP/DOWN
on a timestamp adds/subtracts 1 month/year
18.7 Clocking time
Useful for working on contract:
Key | Function |
---|---|
C-c C-x C-i |
start clock on current item |
C-c C-x C-o/x |
stop/cancel clock on current item |
C-c C-x C-d |
display total subtree times |
C-c C-c |
remove displayed times |
C-c C-x C-r |
insert/update table with clock report |
18.8 Other agenda commands
Key | Function |
---|---|
C-c a a |
compile agenda for the current week |
C-c a t |
compile global TODO list |
C-c a T |
compile TODO list for specific keyword |
C-c a m |
match tags, TODO kwds, properties |
C-c a M |
match only in TODO entries |
C-c a # |
find stuck projects |
C-c C-o |
agenda for date at cursor |
18.9 agenda commands review
all of which will act on the heading where your cursor is on:
Shift-right-arrow
3-way toggle for TODOShift-left-arrow
3-way toggle for TODO (reverse direction)C-c C-s
to scheduleC-c C-d
to pick a deadlineC-a A
to enter agenda view (or is it just C-a ? where ? is one of many commands, the most common being a,t, and ?)Shift-f
to switch to follow-me mode screen will split into 2 and where you place your cursor on the agenda or todo screen will cause the cursor to jump to that spot on the actual org mode in the "other" screen. Convenient to see the detailed notes for each TODO items and jump between them.F
orB
to jump forward or backwardq
to quit agenda mode.
After you run one of these commands on the heading, you won't see the results
unless you expand the heading (use <TAB>
)
After you create a time stamp, you can manually edit it, add a specific time,
etc. These times can be simple timestamps, or a range of time. For example:
DEADLINE:
You can enter a calendar anywhere by C-c .
18.10 Review all org-agenda commands:
Key | Function |
---|---|
C-c [ |
add/move current file to front of agenda |
C-c ] |
remove current file from your agenda |
C-' |
cycle through agenda file list |
C-c C-x </> |
set/remove restriction lock |
C-c a a |
compile agenda for the current week |
C-c a t |
compile global TODO list |
C-c a T |
compile TODO list for specific keyword |
C-c a m |
match tags, TODO kwds, properties |
C-c a M |
match only in TODO entries |
C-c a # |
find stuck projects |
C-c a L |
show timeline of current org file |
C-c a C |
configure custom commands |
C-c C-o |
agenda for date at cursor |
19 org-agenda templates
You can add this to your .emacs.d/init.el file and then be able call up an
org mode template with C-c t t
to quickly, and without switching to the
todo.org file, add a todo item. Not only that, the todo item will have a
link into the heading or section of the file where you thought of the todo
item. If you are anywhere in an emacs buffer, the M-x org-capture
command followed
by the template command (letter) you set up as shown below
19.1 org-template setup in init.el
, and you can
(setq org-capture-templates `(("t" "Tasks / Projects") ("tt" "Task" entry (file+olp "~/Projects/Code/orgFiles/tasks.org" "Inbox") "* TODO %?\n %U\n %a\n %i" :empty-lines 1)))
- %? is where the cursor is placed in the capture template
- %U gives a timestamp
- %a gives you the link to wherever you are in emacs (including heading)
- %i is the item. (or is %a and %i switched around? read the docs and update here)
The whole org-mode section follows:
(setq org-capture-templates `(("t" "Tasks / Projects") ("tt" "Task" entry (file+olp "~/Projects/Code/emacs-from-scratch/OrgFiles/Tasks.org" "Inbox") "* TODO %?\n %U\n %a\n %i" :empty-lines 1) ("j" "Journal Entries") ("jj" "Journal" entry (file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org") "\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n" ;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org") :clock-in :clock-resume :empty-lines 1) ("jm" "Meeting" entry (file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org") "* %<%I:%M %p> - %a :meetings:\n\n%?\n\n" :clock-in :clock-resume :empty-lines 1) ("w" "Workflows") ("we" "Checking Email" entry (file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org") "* Checking Email :email:\n\n%?" :clock-in :clock-resume :empty-lines 1) ("m" "Metrics Capture") ("mw" "Weight" table-line (file+headline "~/Projects/Code/emacs-from-scratch/OrgFiles/Metrics.org" "Weight") "| %U | %^{Weight} | %^{Notes} |" :kill-buffer t)))
19.2 org-mode habit tracking
There is a built-in sub-mode that comes with org-mode called org-habit
but it is not activated by default. So you need to add it to init.el
setup, and also add it the the org-modules list. That way org-mode will
(require 'org-habit) (add-to-list 'org-modules 'org-habit) (setq org-habit-graph-column 60)
For details, see orgmode.org/manual
Full org mode setup:
(use-package org :pin org :hook (org-mode . efs/org-mode-setup) :config (setq org-ellipsis " ▾") (setq org-agenda-start-with-log-mode t) (setq org-log-done 'time) (setq org-log-into-drawer t) (setq org-agenda-files '("~/Projects/Code/emacs-from-scratch/OrgFiles/Tasks.org" "~/Projects/Code/emacs-from-scratch/OrgFiles/Habits.org" "~/Projects/Code/emacs-from-scratch/OrgFiles/Birthdays.org")) (require 'org-habit) (add-to-list 'org-modules 'org-habit) (setq org-habit-graph-column 60) (setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)") (sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)"))) (setq org-refile-targets '(("Archive.org" :maxlevel . 1) ("Tasks.org" :maxlevel . 1))) ;; Save Org buffers after refiling! (advice-add 'org-refile :after 'org-save-all-org-buffers) (setq org-tag-alist '((:startgroup) ; Put mutually exclusive tags here (:endgroup) ("@errand" . ?E) ("@home" . ?H) ("@work" . ?W) ("agenda" . ?a) ("planning" . ?p) ("publish" . ?P) ("batch" . ?b) ("note" . ?n) ("idea" . ?i)))
20 Calendars
The above is a timestamp. Type C-c .
and select a date using your mouse.
C-c . hammer
defaults to today's date.
I can manually type in <
followed by the date in the at form and org mode will
automatically recognize it as a date. (all org mode is just text.)
is my wedding anniversary
key sequence | Command |
---|---|
C-c C-s | schedule this heading |
C-c C-d | define a deadline |
C-a a | Switch to agenda view |
Shift-f | follow mode |
F | move forward |
B | Move backward |
21 LaTeX integration.
e^x=\sum_{n=0}^{\infty}\frac{x^n}{n!}
which is not quite there.
Will have to figure this out later.
\begin{equation} e^x=\sum_{n=0}^{\infty}\frac{x^n}{n!} \end{eqation}
There that's better. I needed the " \ begin curly{ equation" delimiters.
\begin{equation} frac{x^n}{n!} \end{eqation} \rightarrow \kappa \begin{equation} x=\sqrt{b} \end{equation}
22 Org-mode File of Org-mode Reference Card
Well, duh!! I looked online for a reference card and found several pdf versions. One looked suspiciously like it was made using org-mode of course. So I looked for org-mode file version of it and found it on ormode.org
So here is the complete Org-Mode Reference Card stored locally
23 Org-mode with vscode
It turns out that there is a org-mode plugin
available for vscode. That is
what I am using now.
24 Org-mode customization
You can customize the colour of highlights by adding this line to your
/.emacs.d/init.el file
=(add-to-list 'org-emphasis-alist '("*" (:foreground "red")))=
=(add-to-list 'org-emphasis-alist '("
" (:foreground "yellow")))=
You can tell emacs to hide the emphasis characters so you get highlight vs highlight
These can be added to the init.el file, OR, can be set interactively with the command M-: (add-to-list 'org-emphasis-alist '("*" (:foreground "red")))
M-: org-hide-emphasis-markers
(setq org-hide-emphasis-markers t)
or set it via customize:
M-x customize-variable RET org-hide-emphasis-markers RET
To make the emphasis character visible again, put your cursor on the last
character, hit <space>
and the emphasis will be broken and you will see the
characters. You can then edit them. Then remove the space and the emphasis
will be back again.
See the Markup a.k.a. emphasis section.
24.1 Org-mode auto indentation
You can turn on auto indent
with the command: M-x org-indent-mode
To test if you
have it on, run M-x describe-variable org-indent-mode
Could also be
org-startup-indented
so (defcustom org-startup-indented t)
(or nil)
Or, on a per-file basis using #+STARTUP: indent
org-indent-mode
is an autoloaded interactive LISP
function in org-indent.el
25 init.el customizations
Working on a prettify customization with this in my init.el:
;; prettify-sympols-alist ;; to remove it just (setq prettify-symbols-alist nil) (defun org-icons () ;; (interactive) (setq prettify-symbols-alist '(("#+begin_src" . ?) ("#+BEGIN_SRC" . ?) ("#+end_src" . ?) ("#+END_SRC" . ?) ("#+begin_example" . ?) ("#+BEGIN_EXAMPLE" . ?) ("#+end_example" . ?) ("#+END_EXAMPLE" . ?) (":PROPERTIES:" . ?) (":properties:" . ?))) (prettify-symbols-mode 1)) (add-hook 'org-mode-hook ( org-icons ))