an emacs macro
Mark Walters
markwalters1009 at gmail.com
Fri Jun 6 05:02:25 PDT 2014
On Thu, 05 Jun 2014, Tom Hirschowitz <tom.hirschowitz at univ-savoie.fr> wrote:
> Hi all,
>
> I'm trying to define a macro for notmuch/emacs which in show-mode would
>
> - prompt the user for tags (possibly starting with "+"),
>
> - tag the shown message with these tags plus an additional fixed tag,
> say "+local".
>
> I know next to nothing about emacs/lisp, so I tried to mimick notmuch*.el.
>
> Here's my most plausible attempt:
>
> (defun notmuch-show-move (tag-changes)
> "Add the local tag, plus possibly others, given as interactive arguments."
> (interactive (list (notmuch-read-tag-changes (notmuch-show-get-tags)
> "Tag message" "+")))
> (let* ((tag-changes-with-local (cons "+local" tag-changes))
> (rien (notmuch-tag (notmuch-show-get-message-id) tag-changes-with-local))
> (current-tags (notmuch-show-get-tags))
> (new-tags (notmuch-update-tags current-tags tag-changes-with-local)))
> (unless (equal current-tags new-tags)
> (notmuch-show-set-tags new-tags))))
Yes this looks fine for notmuch-show. It won't work for search mode as
notmuch-show- commands basically only work in notmuch-show. I would
suggest copying notmuch-search-tag and tweaking it to use
tag-changes-with-local (as you have done for the show version
above). Something similar should work for tree-mode (ie copy
notmuch-tree-tag)
I think you will need separate functions for the three modes.
Best wishes
Mark
More information about the notmuch
mailing list