Exploring Emacs packages
25 Jan 2015Currently, MELPA hosts over 2250
packages. That's
quite a large number, although it's still feasible to try most of the
popular ones. In comparison,
apt-cache pkgnames | wc
gives me the number 50250
. I don't recall calling apt-cache
pkgnames
ever before, while I call package-list-packages
all the
time. I suppose that this will have to change when the number of
packages grows further.
I usually explore packages just as they show up as new in package-list-packages
.
I'll share the two tools that I use for exploring them.
Smex
Smex is an M-x enhancement for Emacs. In addition to executing commands faster, it gives you an option to jump to the current command's definition with M-..
Here's how I bind smex
:
(require 'smex)
(global-set-key "\C-t" 'smex)
(defun smex-prepare-ido-bindings ()
(define-key ido-completion-map
(kbd "C-,") 'smex-describe-function)
(define-key ido-completion-map
(kbd "C-w") 'smex-where-is)
(define-key ido-completion-map
(kbd "C-.") 'smex-find-function)
(define-key ido-completion-map
(kbd "C-a") 'move-beginning-of-line)
;; (define-key ido-completion-map "\C-i" 'smex-helm)
;; (define-key ido-completion-map " " 'smex-helm)
)
I don't feel bad at all for unbinding transpose-chars
,
C-t is such a prime binding, that only the best commands
can deserve it. And since I touch-type, it's easier for me to hit
M-DEL and retype the word when I notice a mistake, than to
carefully navigate to the mistake location and call transpose-chars
with surgical precision. On the other hand, the number of Emacs
packages is only going to grow, so it becomes less and less feasible
to bind everything. Instead, seldom used stuff can be called though
smex
. For instance, I don't bind
markdown-toc or
speed-type and call them via
C-t instead.
Back to the point, C-t ... C-.
(smex-find-function
) allows me to quickly jump to the source of the
package that I want to explore.
Semantic tags
Once I'm in the source code, I can quickly get an overview with
g (lispy-goto
) from
lispy. It uses CEDET's semantic
module to get a list of tags in current directory with
helm for completion. In my
opinion, it's much prettier than helm
's own helm-semantic
. It also
explores more tags for Emacs Lisp, for instance it will capture
use-package
and global-set-key
tags.
A new cute feature that I added recently is a different background for
user-visible functions, i.e. the ones that are callable by
M-x or smex
. Here's how it looks like, for the
speed-type
package (interactive functions have a purple background):
If the image text looks too small, you can right click / view image in
your browser. Here, I can see at a glance, that there are three
commands that I can call. I can also see a few variables, two of them
don't include --
, so they're probably customizable.