• Adding a Bit of Holiday Spirit to Emacs

    Christmas is here! Is your Emacs ready for it?

    Emacs is famous for having a major mode for any and every occasion, but does this hold true for Christmas? I was shocked to find out this morning that there’s no christmas-mode or christmas-tree-mode! Still, I did manage to figure out a way to optimize my Emacs for the holiday season, at least for the people living in countries where the holidays happen to be during the winter.

    If you’re feeling cold and you need some extra warmth in your life Emacs can certainly help with that! Enter emacs-fireplace. It’s a major mode that turns your Emacs into… a cozy fireplace.


    So, just enable the mode with M-x fireplace and bask in the warmth and glory of Emacs. Using the mode is super simple (consider pressing C-* to enable smoke) and I guess you’ll be able to figure out the details by yourselves.

    Merry Christmas! Merry Mxmas! Until next time!

  • Spell Checking Comments

    I’m notorious for all the typos I make.1 Thankfully Emacs features an awesome built-in mode named flyspell to help poor typists like me. Flyspell highlights misspelled words as you type (a.k.a. on the fly) and has useful keybindings to quickly fix them.

    Most people typically enable flyspell only for major modes derived from text-mode (e.g. markdown-mode, adoc-mode), but it can really help programmers as well by pointing out typos they make in comments. All you need to do is enable flyspell-prog-mode. I typically enable it for all programming modes2 like this:

    (add-hook 'prog-mode-hook #'flyspell-prog-mode)

    Now you’ll get instant feedback when you make some typo in a comment. To fix a word just press C-c $ (M-x flyspell-correct-word-before-point), while your cursor is behind it.3


    That’s all I have for you today! Keep fixing those nasty typos!

    1. Especially in blog posts. 

    2. At least the well-behaved ones that derive from prog-mode that is. 

    3. There are many other ways to correct misspelled words with flyspell, but we’ll ignore them for now for the sake of simplicity. 

  • Dealing with Jekyll Post URLs

    A while ago I wrote about migrating Emacs Redux from Octopress to Jekyll. While I’m really happy with Jekyll overall, there has always been one thing that frustrated me a bit - namely linking to other posts. The syntax for this is the following:

    {% post_url name-of-post %}

    I know this probably doesn’t seem like a problem, but posts in Jekyll are usually prefixed with a timestamp (e.g. 2019-05-21-some-post ) which makes it really hard to get the name right without consulting the list of posts first. Luckily for us it’s trivial to write an Emacs command that helps with this.

    (defun jekyll-insert-post-url ()
      (let* ((files (remove "." (mapcar #'file-name-sans-extension (directory-files "."))))
             (selected-file (completing-read "Select article: " files nil t)))
        (insert (format "{%% post_url %s %%}" selected-file))))

    Here’s how this command looks like in action:


    I don’t know you, but I’m totally loving this. You can easily extend the core idea for all sorts of similar tasks that require transforming a bit the files in the current directory. Here’s a similar helper for dealing with image URLs:

    (defun jekyll-insert-image-url ()
      (let* ((files (directory-files "../assets/images"))
             (selected-file (completing-read "Select image: " files nil t)))
        (insert (format "![%s](/assets/images/%s)" selected-file selected-file))))

    Let’s see this in action:


    That’s all I have for you today! Meta-X forever!

  • Emacs Prelude Gets a User Manual

    This is going to be a really short post.

    For ages I’ve planned to create a user manual for Emacs Prelude, but I never got to doing so. Writing a good manual is a huge amount of work and I was wary (and lazy) to commit to doing it. Today I realized that probably having some manual (even if it’s not good) beats having no manual, so I quickly sliced and diced the old huge README of the project, and compiled it together into this proto-manual.

    I’ll try to find some time to improve it, but I can make no promises. You can certainly help me out by working on the manual yourselves, though. Prelude is pretty simple, so I assume that everyone, who has spent a bit of time using it, is more than qualified to work on improving its documentation. By the way, the manual features a dedicated section for working on the manual! Coincidence? I don’t think so.

    Keep hacking!

  • The Emacs Year in Review

    This post is a brief summary of the past year for Emacs from my perspective.

    Read More

Subscribe via RSS | View Older Posts