For the past few years I've been keeping a work-log of everything I do. I don't often share these, though it is sometimes interesting to be able to paste into a chat-channel "Oh on the 17th March I changed that .."
I've had a couple of different approaches but for the past few years I've mostly settled upon
emacs ~/Work.md. I just create a heading for the date and I'm done:
# 10-03-2019 * Did a thing. * See this link * Did another thing. ## Misc. Happy Birthday to me.
As I said I've been doing this for years, but it was only last week that I decided to start making it more efficient. Since I open this file often I should bind it to a key:
(defun worklog() (interactive "*") (find-file "~/Work.MD")) (global-set-key (kbd "C-x w") 'worklog)
This allows me to open the log by just pressing
C-x w. The next step was to automate the headers. So I came up with a function which will search for today's date, adding it if missing:
(defun worklog-today() "Move to today's date, if it isn't found then append it" (interactive "*") (beginning-of-buffer) (if (not (search-forward (format-time-string "# %d-%m-%Y") nil t 1)) (progn (end-of-buffer) (insert (format-time-string "\n\n# %d-%m-%Y\n")))))
Now we use some magic to makes this function run every time I open
(defun worklog_hook () (when (equalp (file-name-nondirectory (buffer-file-name)) "work.md") (worklog-today) ) ) (add-hook 'find-file-hook 'worklog_hook)
Finally there is a useful package imenu-list which allows you to create an inline sidebar for files. Binding that to a key allows it to be toggled easily:
(add-hook 'markdown-mode-hook (lambda () (local-set-key (kbd "M-'") 'imenu-list-smart-toggle)
The end result is a screen that looks something like this:
If you have an interest in such things I store my emacs configuration on github, in a dotfile-repository. My init file is writting in markdown, which makes it easy to read: