unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* an emacs macro
@ 2014-06-05  9:52 Tom Hirschowitz
  2014-06-06 12:02 ` Mark Walters
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Hirschowitz @ 2014-06-05  9:52 UTC (permalink / raw)
  To: notmuch


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-06 12:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-05  9:52 an emacs macro Tom Hirschowitz
2014-06-06 12:02 ` Mark Walters
2014-06-06 12:20   ` Tom Hirschowitz

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).