Adapted from http://www.emacswiki.org/PersonalDiary
Functions to maintain a simple personal diary / journal in Emacs. Feel free to use, modify and improve the code! — mtvoid, bastibe
When creating a new journal entry, unfinished TODO items from the
previous entry will be moved to the new entry. This can be controlled
org-journal-carryover-items. Set this to
nil to disable this
feature, or to any agenda tags view match string for a set of matching
tags, properties, and todo states. By default, this is
which will match TODO items.
This file is also available from marmalade, melpa and melpa-stable
under the name org-journal. You may also want to specify the directory
where your journal files will be saved. You can do this by setting the
org-journal-dir (remember to add a trailing slash).
org-journal-dir is also a customizable variable. The default value
You can add all those calendar files to your org-agenda by adding
org-agenda-files and setting
org-agenda-file-regexp to include files with an all-numeric name
\\`[^.].*\\.org\\'\\|[0-9]+). That way, you can use org-agenda to
search for TODO items or tagged items in your org-journal.
A better way to search journal items is to use org-journal’s built-in
search functionality by Vladimir Kazanov. All searches are kicked off
from the calendar, and search different date ranges for a keyword:
w to search the current week,
f m for the current month,
f y for
the current year, and
f f for all journal files. Use
org-journal-search to search entries in a custom date range.
Inside the journal directory, a separate file is created for each day
with a journal entry, with a file name in the format YYYYMMDD. Each
journal entry is an org-mode file that begins with a date entry on the
top, followed by a entries for different times. Any subsequent entries
on the same day are written as additional headings in the same file,
with their own time. To start writing a journal entry, press
C-j. You can also open the current day’s entry without adding a new
C-u C-c C-j.
You can customize the date and time formats using the variables
org-journal-time-format. If you do not
want to use org headings and sub-headings for date and time entries,
example, you could set
order to begin every file with a title instead of a heading. If you
want to store your journal entries with different file names,
You can browse through existing journal entries on disk via the
calendar. All dates for which an entry is present are highlighted.
j will open it up for viewing. Pressing
C-j will open it
for viewing, but not switch to it. Pressing
] will select the
date with the previous or next journal entry, respectively. Pressing
i j will create a new entry for the chosen date.
- To create a new journal entry:
- To open today’s journal without creating a new entry:
C-u C-c C-j
In calendar view:
jto view an entry in a new buffer
C-jto view an entry but not switch to it
i jto add a new entry
f wto search in all entries of the current week
f mto search in all entries of the current month
f yto search in all entries of the current year
f fto search in all entries of all time
[to go to previous entry
]to go to next entry
When viewing a journal entry:
C-c C-fto view next entry
C-c C-bto view previous entry
A typical journal entry for a day would look like this:
(it will actually look a lot nicer, depending on your org-mode settings)
* Tuesday, 06/04/13 ** 10:28 Company meeting Endless discussions about projects. Not much progress ** 11:33 Work on org-journal :org-journal: For the longest time, I wanted to have a cool diary app on my computer. However, I simply lacked the right tool for that job. After many hours of searching, I finally found PersonalDiary on EmacsWiki. PersonalDiary is a very simple diary system based on the emacs calendar. It works pretty well, but I don't really like that it only uses unstructured text. Thus, I spent the last two hours with making that diary use org-mode and represent every entry as an org-mode headline. Very cool! ** 15:33 Work on org-journal :org-journal: Now my journal automatically creates the right headlines (adds the current time stamp if on the current day, does not add a time stamp for any other day). Additionally, it automatically collapses the headlines in the org-file to the right level (shows everything if in view mode, shows only headlines in new-entry-mode). Emacs and elisp are really cool! ** 16:40 Work on org-journal :org-journal: I uploaded my journal mode to marmalade and Github! Awesome! ** TODO teach org-journal how to brew coffee :org-journal:
- 2013-06-04 V1.0 Bastian Bechtold
- Initial working prototype. More or less simply an extension of personal-diary with org-mode files.
- 2013-06-12 V1.3.4 Bastian Bechtold
- Several bug fixes and documentation improvements.
- 2013-08-23 V1.4 Bastian Bechtold
- Now supports more customization
- 2013-09-17 V1.4.3 Bastian Bechtold
- Several bugfixes and autoloading (which kind of mostly works)
- 2013-10-02 V1.4.4 Bastian Bechtold
- Create org-journal directory if not present (thank you, Donghyun Cho!)
- 2013-11-10 V1.4.8 Bastian Bechtold
- Fixed opening of journal files for reading (thank you, Matthew M. Keeler!) View mode now stays active when switching between files (thank you, Matthew M. Keeler!) Some autoload fixes
- 2014-03-10 V1.4.8 Bastian Bechtold
- Some bug fixes on opening files (thank you, Ram Raghunathan!)
- 2014-06-17 V1.5 Bastian Bechtold
- Some more bug fixes for autoloading Simplified setup by auto generating the file pattern from the file format.
- 2014-11-19 V1.6 Bastian Bechtold
- Changed default key bindings to comply with Emacs’ standards.
- 2014-08-12 V1.6.2 Bastian Bechtold
- Added prefix argument to open-current-entry (thank you, Vladimir Kazanov!)
- 2014-08-12 V1.6.3 Bastian Bechtold
- Added key binding for viewing but not switching to entry (thank you, Vladimir Kazanov!)
- 2014-17-12 V1.6.4 Bastian Bechtold
- Journal files should open correctly when restored by desktop-save-mode now.
- 2015-03-01 V1.7.0 Bastian Bechtold
- Added functions for searching journal entries in date ranges (thank you, Vladimir Kazanov!).
- 2015-05-04 V1.8.0 Bastian Bechtold
No more empty files when creating new entries with prefix (thank you, Vladimir Kazanov!).
You can now customize whether org-journal-mode will hide entries (thank you, Boris Buliga!).
- 2015-06-22 V1.9.0 Bastian Bechtold
Journal files can now be encrypted if you set
org-journal-enable-encryption(thank you, Donghyun Cho and Puneeth Chaganti!).
- 2015-07-01 V1.9.1 Bastian Bechtold
- Encryption and prefix now work for calendar-created entries (thank you, Puneeth Chaganti!).
- 2015-09-07 V1.10.0 Bastian Bechtold
- Add option to find-file in same window.
- 2016-04-27 V1.11.0 Bastian Bechtold
- Add highlight to search results (thank you, aJchemist!). Add option to carry over TODO items from previous entry when creating a new entry.