emacs: Customize how each tag is displayed

Damien Cassou damien.cassou at gmail.com
Fri Jan 18 08:03:54 PST 2013


[PATCH 1/4] emacs: Add notmuch-intersperse to notmuch-lib/
[PATCH 2/4] emacs: pictures that might be used as icons for tags
[PATCH 3/4] emacs: possibility to customize the rendering of tags
[PATCH 4/4] emacs: provide convenience functions for notmuch-tagger


These patches are the first of an upcoming series whose goal is to
integrate notmuch-labeler into notmuch. See the following for more
details: https://github.com/DamienCassou/notmuch-labeler

Points of discussion:

- This series does not have any unit-test to make it smaller and more
  amenable to comments. I will send a patch when requested.

- Patch 3/4 formats tags as mode-line templates so that we can show
  tags in the header-line in a later series.

- Patch 3/4 introduces `notmuch-tagger-formats', a list of pairs (KEY
  FORMAT) to format a tag matching KEY using a special format.
  Currently, an example of such a list is:

    (("unread"
         (:propertize "unread" face
                      (:foreground "red")))
     ("flagged"
         (:propertize "flagged" display
                      (image :type svg
                             :file ,(notmuch-tagger-image-path "star.svg")
                             :ascent center :mask heuristic))))

  to set the unread tag to be red and the flagged tag to have a star
  picture attached. Because this variable is hard to edit without
  making mistakes, patch 4/4 introduces customization functions that
  the user can call on their init.el file like this:

  (notmuch-tagger-propertize "unread" :foreground "red")
  (notmuch-tagger-image-star "flagged")

  Nevertheless, implementing a customize interface for this variable
  is difficult as Emacs does not provide customization widgets for
  text-property lists. A possible solution could be to change the list
  value so that it looks like:

    (("unread" (propertize :foreground "red"))
     ("flagged" (image-star)))

  where the FORMAT part of each pair would be the suffix of a
  notmuch-tagger customization function name (as introduced by patch
  4/4) and the rest would be parameters to pass to this function
  (except the KEY parameter that is already in each pair of the
  `notmuch-tagger-formats' list). This solution would be more amenable
  to the customization interface, but maybe less powerful.


More information about the notmuch mailing list