Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This isn't exactly what was asked for, but because I live in emacs I don't get much value being able invoke it from the command line. If that's ok, try this..

  (defvar org-journal-file "~/Dropbox/org/engjournal.org"  
    "Path to OrgMode journal file.")  
  (defvar org-journal-date-format "<%Y-%m-%d %a %I:%M %p>"  
    "Date format string for journal headings.")  

  (defun org-journal-entry ()  
    "Create a new diary entry for today or append to an existing one."  
    (interactive)  
    (switch-to-buffer (find-file org-journal-file))  
    (widen)  
    (let ((today (format-time-string org-journal-date-format)))  
      (beginning-of-buffer)  
      (unless (org-goto-local-search-headings today nil t)  
 ((lambda ()   
    (org-insert-heading)  
    (insert today)  
    (insert " "))))  
      (beginning-of-buffer)  
      (org-show-entry)  
      (org-narrow-to-subtree)  
      (end-of-buffer)))  

  (global-set-key "\C-cj" 'org-journal-entry)
So, C-cj will open the file, create a timestamp entry at the top, and narrow to the subtree. Great for creating timestamped notes. I keep a journal this way (multiple entries per day are fine), but it could be used for any note taking.


Love this. Running it outside of the file though is truncating my file though ?




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: