Re: RFC: tag macros

Subject: Re: RFC: tag macros

Date: Thu, 19 Jan 2012 09:10:19 -0400

To: Jameson Graef Rollins, Notmuch Mail

Cc:

From: David Bremner


On Wed, 18 Jan 2012 10:50:50 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:

> Is all of this really easier than just adding the following to your
> .emacs?:
> 
> (define-key notmuch-search-mode-map "o"
>   (lambda ()
>     (interactive)
>     (notmuch-show-add-tag "notmuch::patch")
>     (notmuch-show-add-tag "notmuch::obsolete")
>     (notmuch-show-remove-tag "notmuch::needs-review")))
> 

I started out along this route.  I think there are a few advantages to
the approach I posted, but only if many people are making similar
snippets for more than one key.

- it doesn't have the 3 lines of boilerplate per keybinding
- it doesn't require the user to program in lisp; I suspect that
  explaining to new users how to customize their lisp snippets is some
  support burden as well.
- it provides the equivalent of a submap, which is another few lines of
  boilerplate. The only actual keybinding is "t" as a prefix. 

In my case, assuming the API was improved a bit as Austin suggested,
this would be a savings of 15-20 lines of boilerplate per user. 

Anyway, we can start by improving and documenting the API, and see how
that goes. The actually "parse lists and turn them into keybindings" part
is only the 4 line function notmuch-show-apply-tag-macro.

> That seems really simple to me, and doesn't require us to support a
> bunch of code to do complicated customization stuff.

I'm admittedly ignorant about emacs customization stuff, this requires a
single list of lists. Personally I use "setq" in .emacs for most
customization; it plays much better with version control.

Thread: