u/Martinsos

▲ 44 r/emacs

[ANN] Starter template for your own blog in Emacs Lisp

A week or so ago I wrote about how I implemented my new blog in Emacs Lisp: https://martinsos.com/posts/my-blog-in-elisp. At that time I linked from it to the public "snapshot" of the source code of my blog at the moment of writing the article.

Since then, however, I turned that snapshot into a proper starter template for creating your own blog in Emacs Lisp: https://github.com/Martinsos/blog-in-emacs-lisp .

I derived it from how I implemented my blog, but removed all but a few example pieces of content, depersonalized relevant parts, and made sure it is in the right state to serve as a starting point for anybody who wants to use it for their own blog. Start should be as easy as cloning the repo and running make && make serve.

I also keep updating it as I add new features to my blog. My blog is close to being feature complete though and I want to keep it minimal so I don't think there is much to keep adding, but if I do, I will keep propagating the changes. I would also love to do it in the other direction, if somebody has any ideas how to improve the template (I am an experienced engineer but intermediate in elisp), I would love to propagate those back to my blog.

I hope you find this useful, that this possibly encourages you to move your blog to Emacs Lisp, and as always, I would love to get any feedback, particularly on the code architecture / decisions!

p.s. I feel a bit silly adding the following disclaimer, but in the times we are, I know I would appreciate it as a reader:

On AI usage: This project is not vibe coded or AI driven. I do use AI as one of the tools in my repertoire, but all the code in this project was written by me, every detail/polish and every decision was made by me, with understanding and care. I highly care about the quality of my work and love writing clean code and tweaking all the little details. This is my side project and I was in no hurry so I gave myself time, enjoyed the learnings and had a lot of fun with it.

github.com
u/Martinsos — 2 days ago
▲ 40 r/emacs

I started working on this a couple of months ago in the spare time and have finally gotten it to the state where I am ready to pronounce it done! It was great fun and I love the result, I hope you find it interesting. Would also love any feedback on what I could do better. Thanks!

martinsos.com
u/Martinsos — 12 days ago
▲ 3 r/emacs

I am writing an elisp script that I run with emacs -Q --script myscript.el, so a standalone thing, not reliant on my emacs config.

I ended up splitting it into multiple files and started requiring certain files from other files, as the project grew more complex, but hit a challenge there: even though I added the parent dir, my require that loads a neighbouring local elisp file was getting flycheck warnings.

From what I investigated, the problem is that flycheck is not aware of my modifications to load path in my script, so it wasn't able to resolve the require.

I ended up with this, which seems to work for all three situations (emacs --script, in buffer evaluation during development, flycheck during development):

(require 'my-other-script (expand-file-name "my-other-script.el" (file-name-directory (or load-file-name buffer-file-name default-directory))))

However, it feels quite complex, and also I am now doing these requires with explicit filenames instead of extending the load path -> I don't mind too much, but I wonder if I am missing out on some more elegant solution. From what I understood so far, flycheck can't know what I add to load-path, but it can analyze what I do here in require, so that is why these explicit-filename requires work (as long as I add default-directory in them, which flycheck correctly set in its environment where it does the analysis).

I guess the main complication comes from the combo of me evaluating this outside of my emacs config + the fact that I want flycheck to work.

Also I didn't want to duplicate dirs that should go to load path in the .dir-locals.el, that sounded like duplication I don't want to have/maintain.

How would you do this? Is this ok? Would you do something with .dir-locals.el that is better than just adding hardcoded load paths to same dirs? Any ideas/feedback are welcome! Thanks

EDIT: I created a small repo on github here to reproduce the whole thing,it is only a couple of lines, give it a look, I think it should make it clear what is happening and you can also try it locally: https://github.com/Martinsos/emacs-script-load-path-repro

u/Martinsos — 16 days ago