July 7th, 2013

I use Emacs, and one of the key roles I use Emacs for is journaling — keeping a log of what I do, as regards to work (I could do a better job of personal journaling, but I wouldn’t need or use Emacs for that, I’d probably put that in a paper-based journal). For computer work — whether it’s day-job related, freelance-related, or personal-project related, tracking what I did and when can be invaluable when I try to recreate a setup or recall what I was doing last month when project X started working/failing.


For years I used a simple journal, original built by someone else, that I had enhanced. It’s up at github, but I’ve recently (April/May 2013) started using org-mode and I am happier (sorry, old-journal-code!).


The below extract is taken from my org-init.el file, and needs some tweaking. They were inspired by Journaling with Emacs OrgMode. There is still some reliance on global-functions (aren’t they all, in Emacs-lisp?) from my old journal-mode, but they do the job of opening a new file where I need it. Then org-mode does all the rest.

(global-set-key "\C-c\M-jw" 'org-journal-work)
(global-set-key "\C-c\M-jp" 'org-journal-personal)
(global-set-key "\C-c\M-jf" 'org-journal-freelance)
(defun org-journal-work ()
  "Send work-based directory to org-journal for day-job journaling."
  (org-journal "D:/home/Personal/org-journal-work/" "work"))
(defun org-journal-personal ()
  "Send dropbox-based directory to org-journal for personal journaling."
  (org-journal "D:/Dropbox/Emacs/org/org-journal-personal/" "personal"))
(defun org-journal-freelance ()
  "Send dropbox-based directory to org-journal for freelance journaling."
  (org-journal "D:/Dropbox/Emacs/org/org-journal-freelance/" "freelance"))
(defun org-journal (&optional root suffix)
  "Open .org file named after today's date, format YYYY-MM-DD-Day.jnl,
in subdirectory named in variable root, set in ~/.emacs,
else as defined below.
    (setq root (or root "D:/Dropbox/Emacs/org-journal/"))
    (setq default-directory (year-month-dir root))
    (setq todays-date (format-time-string "%Y-%m-%d-%a" nil))
    (let ((sfx (if suffix (concat "." suffix) "")))
    (setq filename (concat todays-date sfx ".org")))
    (list (read-file-name
"Open journal-org file: " default-directory filename nil filename)))
  (find-file filename) ;; switch to buffer if exists, or open file
  ;; following lines based on
  ;; heading is not working correctly if it is the result of (today)
  (let ((isearch-forward t) (heading (get-today)))
        (unless (org-goto-local-search-headings heading nil t)
          ((lambda ()
             (insert heading)
             (insert "\n\n"))))
        ;; (org-show-entry)
        ;; (org-narrow-to-subtree)
        ;; (end-of-buffer)
        ;; (backward-char 2)
        ;; (unless (= (current-column) 2)
        ;; (insert "\n\n "))
  • syndicate

    • Add to MyMSN
    • Add to MyYahoo
    • Add to Google Reader
    • Add to Bloglines
    • Add to Newsgator
    • Add to NewsIsFree