/org-journal

A simple org-mode based journaling mode

Primary LanguageEmacs Lisp

org-journal.el http://melpa.org/packages/org-journal-badge.svg http://stable.melpa.org/packages/org-journal-badge.svg

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

_BREAKING CHANGE_

Org-journal used to use the key bindings C-c j, C-c b, and C-c f. These however are reserved for user-defined actions. Instead, org-journal now uses C-c C-j, C-c C-b and C-c C-f. This can lead to conflicts with other modes. Please (global-set-key (kbd "C-c j") 'org-journal-new-entry) if this bothers you.

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 variable org-journal-dir (remember to add a trailing slash). org-journal-dir is also a customizable variable. The default value for org-journal-dir is ~/Documents/journal/.

You can add all those calendar files to your org-agenda by adding org-journal-dir to 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: f 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-c C-j. You can also open the current day’s entry without adding a new entry with C-u C-c C-j.

You can customize the date and time formats using the variables org-journal-date-format and org-journal-time-format. If you do not want to use org headings and sub-headings for date and time entries, customize org-journal-date-prefix and org-journal-time-prefix. For example, you could set org-journal-date-prefix to #+TITLE: in order to begin every file with a title instead of a heading. If you want to store your journal entries with different file names, customize org-journal-file-format.

You can browse through existing journal entries on disk via the calendar. All dates for which an entry is present are highlighted. Pressing j will open it up for viewing. Pressing C-j will open it for viewing, but not switch to it. Pressing [ or ] will select the date with the previous or next journal entry, respectively. Pressing i j will create a new entry for the chosen date.

Quick summary:

  • To create a new journal entry: C-c C-j
  • To open today’s journal without creating a new entry: C-u C-c C-j

In calendar view:

  • j to view an entry in a new buffer
  • C-j to view an entry but not switch to it
  • i j to add a new entry
  • f w to search in all entries of the current week
  • f m to search in all entries of the current month
  • f y to search in all entries of the current year
  • f f to 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-f to view next entry
  • C-c C-b to 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:

Changelog

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!).