Hacker News new | past | comments | ask | show | jobs | submit login

> it cracks open Emacs on the notes file, adds a timestamp, appends the optional text

Do you mind sharing how you have setup Emacs to do that? Thanks!




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 ?

I actually work in Windows, and use an Emacs clone called Epsilon, so my tiny batch file and Eel-language customization probably won't help you. It's really just a few minutes of work in any event.


Upvoted. Trying to setup that as well


I had been following some of the set-up from "Org Mode - Organize Your Life In Plain Text!"[0].

[0] - http://doc.norang.ca/org-mode.html




Applications are open for YC Summer 2020

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

Search: