My Personal Notes on Calendars in Emacs org mode
1 Cheat card
1.1 org-agenda tools
C-c a
org-agendaM-S-hammer
adds a newTODO
orCheckbox
C-S-hammer
adds a newTODO
orCheckbox
after subtreeM-S-hammer
adds a newTODO
orCheckbox
[ ]
M-S-hammer
in action[ ]
M-S-hammer
again[ ]
final example ofM-S-hammer
1.1.1 On a heading
S-right
mark heading asTODO
(or typeTODO
)S-left
mark heading undo TODOS-right
cycle throughTODO
,DONE
,OFF
M-x org-agenda-list
try itM-x org-agenda-columns
try itM-x org-agenda-headlines
try itM-x org-agenda-to-appt
try itM-x org-agenda-list-stuck-projects
try itM-x org-agenda-to-appt
try it
1.2 Priorities
From https://orgmode.org/manual/Priorities.html:
C-c ,
prompt for a priority (A
,B
, orC
)A
is the highest. If you pressspace
instead of a priority letter, the priority is removed.S-up
org-priority-upS-down
org-priority-down
Priorities only matter when orgmode is sorting TODOs to present in an agenda or weekly or daily calendar view.
1.3 calendar tools
C-c .
calendar entryC-c . hammer
enterstodays date
C-c C-s
schedule
(add time first if know, then pick date)C-c C-d
deadline
C-c C-y
calculate time between 2 dates in the time rangeC-c C-d
deadline
1.3.1 On a date field (adjusting timestamps)
S-right
add a dayS-left
sub a dayS-up
add a monthS-down
sub a monthS-up
add a yearS-down
sub a year
2 Org-agenda
To enter org-agenda, type M-x org-agenda
or add a key binding. I found
C-c a
was as of Feb 2022 not defined so I defined that as a new key-binding
for org-agenda
mode.
2.1 Menu in org-agenda screen
C-c a
will then show a menu from which you can pick by letter, or q
to quit
.
Press key for an agenda command: -------------------------------- < Buffer, subtree/region restriction a Agenda for current week or day > Remove restriction t List of all TODO entries e Export agenda views m Match a TAGS/PROP/TODO query T Entries with special TODO keyword s Search for keywords M like m, but only TODO entries / Multi-occur S like s, but only TODO entries ? Find :FLAGGED: entries C Configure custom agenda commands * Toggle sticky agenda views # List stuck projects (!=configure) n Agenda and all TODOs
Most common for beginners are these:
a
Agenda
for current week or dayt
List of allTODO
entriese
Export
agenda viewsm
Match
a TAGS/PROP/TODO queryT
Entries with specialTODO
keywords
Search
for keywordsn
Agenda and all TODOs
2.2 Key bindings while in org-agenda view
After you can see your weekly agenda, you can change views
with some single
letter keys:
f
andb
forforward
andbackward
- arrow
>
and<
keys to move forward and backward v
toview
followed bym
ory
orw
for viewing a month, year, or week at a time.
to return totoday
r
to rebuild the agenda (after editing changes in your calendar files)
2.3 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
2.4 Key mappings within agenda view???
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 |
3 Calendars (for scheduling and deadlines)
Orgmode-calendars have the same heirarchical structure as org outlines
- * top level
- ** next level within a top level
- and so on.
* Work ** Meeting with Bob <2013-06-12 Wed 13:00-14:00> ** Call with Sally <2013-06-14 Fri 3:30pm> * Personal ** House work *** clean out garage *** put away snow tires ** Fun *** weekend at the beach <2022-07-06>--<2022-07-09> *** practice guitar
Then each heading, at lowest level, as an optional schedule and/or deadline.
3.1 Scheduling events
These key bindings are only in effect while your cursor is on a TODO
item.
So once on the TODO
item that you want to schedule
, hit C-c C-s
and pick a
date.
C-c .
and select a date using your
mouse.
C-c . hammer
defaults totoday'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.)
3.2 Timestamps
- C-c .
prompt for timestamp (default is today)
- 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
Once the date has been chosen, you can add a time simply by typing
430pm or 1630
3.3 Timestamps for recurring tasks
Simply adding a plus +
sign plus time period, +h, +d, +w, +m, and +y
will
event to recur at those intervals.
While in the calendar minibuffer: ?? need to research this.
key sequence | Command |
---|---|
Shift-f |
follow mode |
F |
move forward |
B |
Move backward |
3.4 Deadlines
C-c C-d
inserts a deadline (that has an automatic date added)
This is done on a heading level, any level
)
Select the date, then hammer
Could also try C-c .
which is a time stamp for today's date
.
3.5 DONE Containers Training
3.6 DONE DevNet training
3.7 lists of items
- easy to add with just typing "[]" with a space so [ ]
- marking the checkbox with a checkmark is also easy with
C-c C-x C-b
orM-x org-toggle-checkbox
[ ] do this [ ] do the other [ ] do the third [ ] do the final
3.8 Scheduling Todo Items C-c C-s
With dates, you can schedule todo items
C-c C-s
inserts a scheduled timestamp
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
3.9 Deadlines to Meet
3.9.1 DONE DevNet training on Netconf
3.9.2 DONE Prep console kit for Macbook
3.9.3
3.9.4 TODO
3.9.5 TODO [ ]
[ ]
one[ ]
two[ ]
three
The checkboxes must be in a list so -
is key. Once there C-c C-x C-b
will
toggle the checkbox from checked to unchecked to checked etc.
See the manual at https://orgmode.org/manual/Checkboxes.html
3.10 Clocking time
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 |
4 Setup
4.1 Defining a key-binding for org-agenda
Entered:
M-x global-set-key hammer C-c a org-agenda hammer
for just the current session. To make it permanent I added this to my init.el file:(add-hook 'org-mode-hook (lambda () (local-set-key (kbd "C-c a") 'org-agenda))) ;; C-c a will be assigned only while in org-mode.
4.2 Configure where emacs looks for org-agenda files.
I noticed that org-agenda
was NOT looking in the current org-mode file I was
in, but rather looked ONLY in zint-calendar.org
file. It turns out I had set
this in my init.el file with the line:
(setq org-agenda-files (list "~/eg/zint-calendar.org"))
Since then I changed that to look at a directroy, zpcalendars
rather than only
one file. Any org-mode calendar files in that directory will be included in
C-c a
org-mode-agenda lookups. Note that it will ignore the current directory
and file from now on.
(setq org-agenda-files (list "~/.emacs.d/zpcalendars/"))
4.3 org-agenda-file documentation
From C-h v org-agenda-files
documentation:
The files to be used for agenda display. If an entry is a directory, all files in that directory that are matched by org-agenda-file-regexp will be part of the file list. If the value of the variable is not a list but a single file name, then the list of agenda files is actually stored and maintained in that file, one agenda file per line. In this file paths can be given relative to org-directory. Tilde expansion and environment variable substitution are also made. Entries may be added to this list with M-x org-agenda-file-to-front and removed with M-x org-remove-file.
4.4 Query current emacs variable org-agenda-files
C-h v org-agenda-files
to see what the current setting is.
4.4.1 Problem symptoms
- The current setting showed a long list of all my org files in the ~/eg/t directory.
- init.el had this section:
(setq org-agenda-files (list "~/.emacs.d/zpcalendars/todo.org"))
i.e. NOT what I was seeing when entering
C-c a
a, for org-agenda
4.4.2 Fix:
- init.el was changed to
setq-default
instead ofsetq
:(setq-default org-agenda-files (list "~/.emacs.d/zpcalendars/todo.org"))
- As per the documentation from
C-h v org-agenda-files
I changed init.el to point to zpcalendars which itself was only a straight text file that was a list of files, one file per line, of the calendar files to examine.i.e. zpcalendars file now has two lines, like this:
~/.emacs.d/todo.org ~/.emacs.d/zint-calendar.org
- Not quite correct
I got an error:
Value '~/\.emacs\.d/zpcalendars'does not match type choice of org-agenda files
So I changed zpcalendars to now look like this:
("~/.emacs.d/todo.org" "~/.emacs.d/zint-calendar.org")
That fixed the does not match type error, but my variable was still messed up.
- Final settings (using C-c [ that adds files to org-calendar-files
I ended up simply setting the variable to
nil
in theinit.el
and theorg.el.gz
, restarting emacs, then adding the two files I want using theC-c [
command "a
" while in both todo.org and zint-calendar.org.This resulted in my
init.el
file haveing this line added to thecustom-set-variables
section at the bottom:'(org-agenda-files '("~/.emacs.d/zint-calendar.org" "~/.emacs.d/todo.org"))
I tried also setting this in the same init.el file, earlier:
(setq-default org-agenda-files ("~/.emacs.d/zint-calendar.org" "~/.emacs.d/todo.org"))
This left the
custom-set-variables
section at the bottom of my init.el file but my agenda was now looking in ONLY those two files. I am happy with that for now.While tweaking my org-agenda-files I came across the command
M-x org-customize-browse
It is worth exploring that in the future. Currently I did NOT make any changes.
5 MobileOrg
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