Recent Emacs Packages as of September 2015

Today I want to talk briefly about some packages for GNU Emacs which I have recently installed and integrated into my daily work-flow. Consider this a series of short mini-reviews.

eno

Eno is conceptually similar to AceJump and avy, in that it allows you to quickly jump to any word, symbol, line, parenthesis, string, and so on. However, it does more than simply move the point within a buffer. For each eno-*-goto command there additional commands to copy, cut, and paste. For example, I could use eno-line-goto followed by C-k to kill a line. Or I could simply use eno-line-cut, which accomplishes the same thing in a single command.

Eno comes with a lot of commands which you must bind yourself. Hydra would be useful for simplifying that process along with making it easier to remember which command you have bound to which key. Personally, however, I use guide-key in conjunction with eno. My long list of bindings for eno looks like this:

(use-package eno
  :config
  (bind-keys
    ("C-s-n a". eno-word-goto)
    ("C-s-n b". eno-word-copy)
    ("C-s-n c". eno-word-cut)
    ("C-s-n d". eno-word-paste)
    ("C-s-n e". eno-symbol-goto)
    ("C-s-n f". eno-symbol-copy)
    
    ;; 30 lines omitted…

    ("M-s-n q". eno-word-cut-to-inline)
    ("M-s-n r". eno-word-paste-to-inline)
    ("M-s-n s". eno-url-open)
    ("M-s-n t". eno-clear-overlay)))

I haven’t memorized all of those bindings, nor do I intend to. Instead I use guide-key like so:

(use-package guide-key
  :config
  (setq guide-key/recursive-key-sequence-flag t)
  (setq guide-key/guide-key-sequence
        '("C-s-n"
          "M-s-n"))
  (guide-key-mode 1))

Update: Joost recommend in a comment below that I try which-key instead of guide-key. After using which-key for about sixty seconds I decided it was superior to guide-key, and strongly recommend it. Thanks Joost!

This way whenever I press C-s-n or M-s-n I get a nice menu bar on the right side of my screen that shows the rest of the bindings. I recommend eno for quickly navigating and editing ‘things’ simulatenously in a buffer, but I strongly recommend using eno together with a package like guide-key or Hydra or helm-descbinds to help you remember what keys you have bound to the eno commands.

Avy

I mentioned avy in the previous section. Like eno it allows you to quickly and easily jump to things within a buffer, like a line, word, character, and so on. When all I want to do is navigate to a specific point I have found avy to be more useful than eno. This is because avy is better when it comes to narrowing down your search. For example, avy-goto-word-1 lets you enter the first character of a word you’re searching for; it will then highlight all words that begining with that character, assigning each a single character you can press to choose the word to which you wish to jump. I find this to be faster, more effective, and straight-up easier to use than the eno’s corresponding eno-goto-word command.

If all you want is fast movement to words, lines, etc., then I recommend avy over eno.

Modalka

Modalka is ‘Yet Another Package’ which provides modal editing for Emacs. However, what distinguishes Modalka from similar packages is that it gives you fine control over exactly when and where you want to use modal editing. For example, Modalka binds no keys by default. That means it does nothing right out of the box, but the great benefit to that is Modalka allows you to integrate just the right amount of modal functionality you want. Basically it works like this:

  1. Bind a key to modalka-mode or (in my case) modalka-global-mode so that you can toggle modal editing as needed.

  2. Then use functions like modalka-define-kbd to create key-bindings for when you’re doing modal editing.

Here’s an excerpt from my own configuration:

(modalka-define-kbd "a" "C-a")
(modalka-define-kbd "e" "C-e")
(modalka-define-kbd "p" "C-p")
(modalka-define-kbd "n" "C-n")
(modalka-define-kbd "v" "C-v")
(modalka-define-kbd "V" "M-v")
(modalka-define-kbd "w" "C-w")
(modalka-define-kbd "y" "C-y")
(modalka-define-kbd "W" "M-w")
(modalka-define-kbd "Y" "M-y")
(modalka-define-kbd "SPC" "C-SPC")
(modalka-define-kbd "q" "M-q")
(modalka-define-kbd ";" "M-;")
(modalka-define-kbd "/" "C-/")
(modalka-define-kbd "=" "C-=")
(modalka-define-kbd "o" "C-o")
(modalka-define-kbd "x b" "C-x C-b")
(modalka-define-kbd "x f" "C-x C-f")
(modalka-define-kbd "x s" "C-x C-s")
(modalka-define-kbd "x 0" "C-x 0")
(modalka-define-kbd "x 1" "C-x 1")
(modalka-define-kbd "x 2" "C-x 2")
(modalka-define-kbd "x o" "C-x o")

Whenever Modalka is active I can press v and V to scroll up and down as if using C-v and M-v, respectively. And note how I can use two character sequences to x 2 and x o for fast window management.

If you’ve wanted to try modal editing in Emacs but don’t want to use packages that come with pre-defined bindings then Modalka is a terrific way to get your feet wet and ease into modal editing at your own pace.

nameless

Nameless hides the package namespace in Emacs Lisp code. Instead of trying to explain it you should just read this great article on nameless by Artur Malabarba.

highlight-thing

Finally I want to mention highlight-thing, a minor mode that highlights whatever thing is under the point, where ‘thing’ in this context refers to the builtin thingatpt package. Personally I find highlight-thing useful in programming because if my cursor is over, say, a variable, then it quickly highlights all other uses of that variable throughout the code; you can even restrict the highlighting to the current function if you like. It’s a minor thing, no doubt, but something which I’ve found to help me more easily read the code I work on.

Advertisements

3 thoughts on “Recent Emacs Packages as of September 2015

  1. You should check out which-key as a replacement for guide-key. Nicer presentation of keys IMHO and it doesn’t require any configuration. (Although there’s a lot you can configure.)

Add Your Thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s