(or emacs irrelevant)

Embedding sexps in Hydra docstrings

In yesterday's post I showed how to embed variable values into the docstring, among other things. Today, I've extended this approach to work with s-expressions. Here's how it looks like:

(defhydra hydra-marked-items (dired-mode-map "")
      "
Number of marked items: %(length (dired-get-marked-files))
"
      ("m" dired-mark "mark"))

This piece of code will remind you how many files you've marked so far each time you press m. By the way, this is the 64th post on the blog; I found out by pressing tm in dired buffer or the _posts directory. Also, I don't think that I've showed passing "" as the keyboard prefix parameter before. Apparently, it works and just translates to this:

(define-key dired-mode-map
    "m" 'hydra-marked-items/dired-mark)

Here's how it looks like: hydra-docstring-sexp

There's no need for a quitting key, it will auto-vanish when you press anything other than m.