an emacs macro
Tom Hirschowitz
tom.hirschowitz at univ-savoie.fr
Thu Jun 5 02:52:32 PDT 2014
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))))
(define-key notmuch-show-mode-map (kbd "M") 'notmuch-show-move)
(define-key notmuch-search-mode-map (kbd "M") 'notmuch-show-move)
This seems to work in show-mode, but not in search-mode.
I'd be grateful for any hint on doing this in tree- and search-modes
(and possibly explanations on why the current version does not work).
Thanks,
Tom
More information about the notmuch
mailing list