aliquote.org

Why I am still using Emacs

August 15, 2015

Some months ago I noticed the release of a new text editor which was supposed to bring the best of both world, Emacs and Vim, but see Spacemacs - First Impressions From an Emacs Driven Developer for a recent review.

Spacemacs

I tried Spacemacs yesterday and I must say this should be great for people used to Vim modal approach to interacting with buffer and text. However, I feel like it is too much for Emacs users (even with the Holy mode), and I stand on my custom settings. These are certainly not the best ones, but this configuration suits my needs and that’s all that matters after all! I should probably update my configuration with the use-package macro, which allows lazy loading of packages among (so many) other things, but I do not have much time at the moment. This is indeed another great advantage of Spacemacs: it is super fast!

I must admit that the Spacemacs UI is really well designed, especially the modeline, and the concept of general and private layers. The core packages are available in spacemacs/package.el; as can be seen, the authors choose some of the best packages around the ones available on MELPA. Regarding Spacemacs modeline, I found a lot of discussion on the internet (e.g., on reddit) because people seem to enjoy a lot its look-and-feel. I even found one implementation of Spacemacs modeline, although it is likely that a dedicated package will be release by the Spacemacs team in the near future.

Since I am not a Vim user, I cannot tell whether Spacemacs can lead Vim users to switch to Emacs, or pure Emacs addicts to adopt Spacemacs. I for one find difficult to work with an already customized text editor: I need to do it myself, in order to understand how everything works or what I may be missing. Anyway, having played with Spacemacs for 3-4 hours I thought it would be good to update my own Emacs.

Some updates

Why am I still using Emacs? Well, I guess this is always the same story.

I decided to use company and get ride of auto-complete. I am aware of the pros and cons but I wanted to give it a try really. I also decided to use Helm in addition to ido. It can be used together with company, dash (be sure to use the built-in eww browser instead of default OS application) and projectile. I also added neotree (with ascii theme) and anzu. I enabled flycheck globally and added R support via lintr (in fact, this is managed by ESS directly, so we just need to install the R package). I customized the flycheck modeline by following Sebastian Wiesner’s example. I also found a pretty low-contrast theme: apropospriate.

Finally, I upgrade Emacs to the latest development version (this was required to get projectile to work anyway, see this issue):

% brew install emacs --HEAD --use-git-head --with-cocoa --srgb
% emacs --version
GNU Emacs 25.0.50.1

I noticed that Homebrew now provides a direct link for running emacs in a Terminal (/usr/local/Cellar/emacs/HEAD/bin), although I am still using this little Bash script (/usr/local/bin/emacs):

#!/usr/bin/env bash
exec /usr/local/Cellar/emacs/HEAD/Emacs.app/Contents/MacOS/Emacs -nw  "$@"

Here is how my Emacs looks like by now:

My modeline is much less developed but I am happy with it. Here is what I have in some of my configuration files:

(require 'powerline)
(powerline-vim-theme)
(global-anzu-mode +1)

(require 'inbox)
(display-inbox-mode)

(require 'window-numbering)
(window-numbering-mode)

(require 'delight)
(delight '((company-mode " Ⓐ" company)
           (hs-minor-mode " ⓗ" hideshow)
           (outline-minor-mode " Ⓞ" outline)
           (outline-mode " Ⓞ" :major)
           (git-gutter-mode " Ⓖ" git-gutter)
           (flyspell-mode " Ⓕ" flyspell)
           (smartparens-mode " Ⓢ" smartparens)
           (elisp-slime-nav-mode nil elisp-slime-nav)
           (ess-noweb-font-lock-mode nil ess)
           (reftex-mode " Ⓡ" reftex)
           (visual-line-mode " Ⓦ" simple)
           (ess-noweb-mode " Ⓝ" ess)
           (anzu-mode " Ⓩ" anzu)
           (abbrev-mode " ⓐ" abbrev)
           (helm-mode " Ⓗ" helm)		
           ))

(setq flycheck-mode-line
      '(:eval
        (pcase flycheck-last-status-change
          (`not-checked nil)
          (`no-checker " -")
          (`running (propertize " ✷" 'face 'success))
          (`errored (propertize " !" 'face 'error))
          (`finished
           (let* ((error-counts (flycheck-count-errors flycheck-current-errors))
                  (no-errors (cdr (assq 'error error-counts)))
                  (no-warnings (cdr (assq 'warning error-counts)))
                  (face (cond (no-errors 'error)
                              (no-warnings 'warning)
                              (t 'success))))
             (propertize (format " %s/%s" (or no-errors 0) (or no-warnings 0))
                         'face face)))
          (`interrupted " -")
          (`suspicious '(propertize " ?" 'face 'warning)))))

(setq projectile-mode-line '(:eval (format " :%s:" (projectile-project-name))))

Briefly, powerline let me customize the modeline a bit, while window-numbering allows me to jump to any window with M-x [0-9] where [0-9] is a number assigned to any new window. The inbox.el file provides a handy minor mode that displays the number of unread messages from mu. I just replaced the default text by a tiny UTF-8 character. Finally, I rely on delight (instead of diminish) to display a light indicator for minor and/or major modes in the modeline. All in one, I have access to the information I need when editing text files, and this basic setup works when Emacs run in a terminal.

See Also

» Fixing some critical keyboard shortcuts in OS X terminal » A modular configuration for Emacs » Common Lisp on Mavericks » GNU Emacs on OS X 10.7 » Emacs versus Textmate