Hacker News new | ask | show | jobs
by stevekemp 3138 days ago
If you write a small pre-processor (simple to do) you can store your emacs configuration file in a markdown file - allowing you to document all the settings neatly.

As I was reading this piece I was imagining that is what the author had done, as it is what I did too:

https://github.com/skx/dotfiles/blob/master/.emacs.d/init.md

4 comments

No need for a separate preprocessor. org-mode offers org-babel which enables you to practice "literate programming" to create your init file, where you interleave text and code.

Here's are couple of examples: https://github.com/howardabrams/dot-files/blob/master/emacs....

https://raw.githubusercontent.com/sachac/.emacs.d/gh-pages/S...

Also see: http://howardism.org/Technical/Emacs/literate-programming-tu...

There are various schemes to use an org mode file as your configuration, which gives you all the niceties of org mode: collapsible headers, language-aware editing modes, etc.

Here's one: http://endlessparentheses.com/init-org-Without-org-mode.html

Author here. I didn't, but I might now. Dig this.
Hi there. Thanks for the article. I'm a newbie when it comes to emacs config files. You said, that we will put (add-to-list 'load-path "~/.emacs.d/lisp/") in the .emacs file, but that was before we had created it. Then a few paragraphs later, when we finally do create it, you tell us to just put in

;; set up ido mode (require `ido) (setq ido-enable-flex-matching t) (setq ido-everywhere t) (ido-mode 1)

Where do we put in (add-to-list 'load-path "~/.emacs.d/lisp/") ?

Disclaimer: I spend very little time configuring emacs these days, as it's working well for me, and there are others around who are much better at emacs than I am. There are likely better ways to do everything than I have, but I shared what works for me.

I've got the `(add-to-list 'load-path "~/.emacs.d/lisp/")` pretty early in the file. You can put the `(require `ido) (setq ido-enable-flex-matching t) (setq ido-everywhere t) (ido-mode 1)` where you like. Basically, you just need the lines in your .emacs file - if you add the reference prior to creating the directory and populating it, you'll get an error, but nothing will break. Add the directory and do a `M-x eval-buffer` and it'll pick it up without restarting emacs. Or just restart emacs. Hope this helps. Someone will tell you a better way.

"Obviously" the code is in init.el in the same directory.

But I'm sure there are similar implementations out there you could copy from too.

It's probably more idiomatic to use org-mode (not that it makes a difference really). Here's a random example I found: https://github.com/larstvei/dot-emacs