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

Brutal simplicity is the key for me.

I use a single flat text file, and use it for years. I have an editor macro that adds a new, timestamped entry at the end of the file, which looks something like this:

    ----------------
    27-Oct-2022 9:38:48 am
    
        |
The bar is where my cursor lands, all ready to start typing. A simple alias ("note") brings up the file. I can make a note in a second or two, then get back to what I was doing.

I dump everything into this file. At my last job, my notes file was maybe 20-30MB and nearly a decade old. I record hard-won knowledge, TODO items, pieces of debug sessions that are interesting, little notes about what's going on, jokes and random thoughts, contact info, whatever. Editors load big files fast, and incremental search works great. The idea is to make this practice fast, nearly frictionless, and not adopt complications that are tough to maintain over time.

I've found that the less formal and structured I make things, the more notes I take; if I had to conform to a schema it would be a burden. No Emacs modes. No email or contact or TODO-system integration. Just notes.

It's saved my butt more times that I can remember. It's great to have at review time, too.




This is so cool! Care to share it? I'm a non-programmer-who-wants-to-be-a-programmer and I loved this approach.


Well, if you're running Epsilon (a really great commercial Emacs clone), you can use this macro:

    new-day: macro "<EscapeKey>>----------------<EnterKey>A-xinsert da <EnterKey><EnterKey><EnterKey><TabKey>"
... which I bind to C-M-N.

I have the following batch file in my path:

    note.cmd
    --------
    @echo off
    epsilon -add +9999999 %USERPROFILE%\notes.txt
You can tell I'm running Windows; I have a similar thing for Linux (Epsilon also runs there).

That's it. Nothing fancy. You could do it with just about any modern editor.


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!


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).


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.


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


Slightly off topic, but what are some of the advantages Epsilon has over Emacs?

I’m really curious.


It's far, far faster. I can edit multi-gigabyte files without thinking much about it, my last attempt to open a 10GB log with Emacs did not go well.

I also think it's got much better integration with Windows, though I can't point at anything in particular. (Its integration on MacOS is less wonderful).

It also helps that its defaults mostly line up with my own preferences in an editor, though this is highly subjective.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: