I was about to write a blog post about how indifferent I became towards different text editors, and how I don’t really care anymore whether I edit code with emacs, vim, Sublime or even Atom. And then this happened:

It’s called Spacemacs and it’s a beautiful hybrid between emacs and vim, or at least it looks like it. Will explore how it works in the course of the next couple of days, i.e., no work will be done and I will spend my days playing with the configuration of a text editor.

And I thought those days were over. Silly me.

update, Sep 9: I’m back on ST3 vim with my old config. I still think Spacemacs is a great idea, it’s just a bit too bloated for my taste.

Previewing LaTeX symbols without preview-latex

This blog’s most popular post is the Emacs howto entry, so I thought I’d share one more LaTeX-related tip for all your Emacs needs. Besides the traditional preview-latex way of generating TeX formulas inside Emacs buffer, there’s a faster and neater way to do this using Emacs' unicode support. My friends Erik Parmann and Pål Drange made a simple package that turns many math symbols and Greek letters commands into corresponding unicode characters.

I like auto-fill-mode and even have it customized for LaTeX-mode in my Emacs configuration. However, while working with other people via a distributed version control system, like I do with my friends, auto-fill-mode can be a real pain if not everyone uses it. Whenever the ones that do commit any code, others are annoyed because it’s difficult to see the changes in the diff file, since auto-fill-mode reformats paragraphs (hence producing ‘more’ changes).

The most straightforward solution is to put some local variables into the file, like (auto-fill-mode -1), but today at StackOverflow I saw a much neater solution: one can put a function that searches for a specific string inside a file and sets minor-modes accordingly. So now there’s a coauthors search function in my .emacs:

; auto-fill is enabled for TeX...
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
; ...unless I work with the gang
(defun my-auto-fill-disabling-hook ()
  "Check to see if we should disable autofill."
    (when (or (re-search-forward "truls" 1000 t)
              (re-search-forward "sjur" 1000 t)
              (re-search-forward "erik" 1000 t))
      (auto-fill-mode -1))))
(add-hook 'find-file-hooks 'my-auto-fill-disabling-hook)

Emacs as the Ultimate LaTeX Editor

Everyone knows, that GNU Emacs is THE Best Programmer’s Editor. Not everyone knows, though, that when you combine it with AUCTeX macros, it also becomes THE Best Editor for LaTeX. The biggest problem with Emacs is that it’s not a particularly intuitive piece of software, to say the least, hence many users flee after their first encounter with it. Emacs has its complicated keyboard shortcuts, enormous documentation and config files written in a Lisp dialect (called Emacs lisp), so at first it might seem very unpleasant using it.