From 940dd03833f5a597353046adf0522d6c54048157 Mon Sep 17 00:00:00 2001 From: Jameson Rollins Date: Sun, 12 Sep 2010 12:56:10 -0400 Subject: [PATCH] add emacs tip about custom keybindings --- emacstips.mdwn | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/emacstips.mdwn b/emacstips.mdwn index 20b671f..94b09ff 100644 --- a/emacstips.mdwn +++ b/emacstips.mdwn @@ -70,6 +70,33 @@ As its name implies, notmuch isn't really doing that much (which is part of its -----

Advanced tips and tweaks

+ +* **Add a keybinding to add/remove/toggle a tag.** + + Here's an example of how to add a key binding to notmuch-show-mode + to toggle a "deleted" tag: + + (define-key notmuch-show-mode-map "d" + (lambda () + "toggle deleted tag for message" + (interactive) + (if (member "deleted" (notmuch-show-get-tags)) + (notmuch-show-remove-tag "deleted") + (notmuch-show-add-tag "deleted")))) + + You can do the same for threads in notmuch-search-mode by just + replacing "show" with "search" in the called functions. This + definition makes use of a lambda function, but you could just as + easily defined a separate function first: + + (defun notmuch-show-toggle-deleted-tag() + "toggle deleted tag for message" + (interactive) + (if (member "deleted" (notmuch-show-get-tags)) + (notmuch-show-remove-tag "deleted") + (notmuch-show-add-tag "deleted"))) + (define-key notmuch-show-mode-map "d" 'notmuch-show-toggle-deleted-tag) + * **How to do FCC/BCC...** Any notmuch reply will automatically include your primary email @@ -234,4 +261,4 @@ As its name implies, notmuch isn't really doing that much (which is part of its This inserts the blurb `<#part sign=pgpmime>` into the beginning of my mail text body and will be converted into a pgp signature when sending (so I can just manually delete that line if I do not want a - mail to be signed). \ No newline at end of file + mail to be signed). -- 2.43.0