News for hackers. Stuff that matters.
Re:Ask HN: How do you maintain your daily log? by afefers on Thursday October 27, 2022 @02:51PM (#33362220)
Thank you! Just converted it to Emacs Lisp:

  (defun new-note ()
    (interactive)
    (insert "----------------\n")
    (insert (shell-command-to-string "echo -n $(date \"+%Y-%m-%d %T\")"))
    (insert "\n"))
  
  (global-set-key (kbd "C-M-n") #'new-note)

And to invoke it from the shell:

  emacs --function new-note --file notes.txt

If somebody knows a better or more elegant way to do this, please tell me!
Re:Ask HN: How do you maintain your daily log? by ossusermivami on Friday October 28, 2022 @05:49AM (#33369474)
i guess with yasnippet something like this, but may need a more to open your note file and expand the snippet (with yas-expand) at the top of the file.

  # -*- mode: snippet -*-
  # name: note
  # key: note
  # --
  ----------------
  `(format-time-string "%Y-%m-%d %T")`

    $1
Re:Ask HN: How do you maintain your daily log? by kabdib on Friday October 28, 2022 @03:16PM (#33376229)
The +999999 bit in my own script automatically goes to the end of the file. There's probably a cleaner way, but that works fine.

I'm not sure if your setup does that.

It's the minor creature comforts that really matter sometimes.

Re:Ask HN: How do you maintain your daily log? by fm2606 on Saturday October 29, 2022 @06:49AM (#33382857)
Thanks for this!

I had to set keybinding to C-c C-n because I got unmatched parentheses error with C-M-n.

I've been slowly moving to emacs since this summer and got to where I like it better than Vim. I was "forced" to learn it as I am learning Lisp (started with Clojure but moved to Common Lisp).