Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id E9638431FBC for ; Tue, 24 Nov 2009 00:02:49 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PgA0ZmKZu1jU for ; Tue, 24 Nov 2009 00:02:49 -0800 (PST) Received: from deliver.uni-koblenz.de (deliver.uni-koblenz.de [141.26.64.15]) by olra.theworths.org (Postfix) with ESMTP id B13C6431FAE for ; Tue, 24 Nov 2009 00:02:48 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id 923F878A23F2 for ; Tue, 24 Nov 2009 09:02:47 +0100 (CET) Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 09054-10 for ; Tue, 24 Nov 2009 09:02:47 +0100 (CET) X-CHKRCPT: Envelopesender noch tassilo@member.fsf.org Received: from thinkpad.tsdh.de (unknown [141.26.94.196]) by deliver.uni-koblenz.de (Postfix) with ESMTP id F264578A2375 for ; Tue, 24 Nov 2009 09:02:46 +0100 (CET) From: Tassilo Horn To: notmuch@notmuchmail.org Mail-Copies-To: never Mail-Followup-To: notmuch@notmuchmail.org Date: Tue, 24 Nov 2009 09:02:46 +0100 Message-ID: <87zl6cl595.fsf@thinkpad.tsdh.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: amavisd-new at uni-koblenz.de Subject: [notmuch] Snippet to jump to message in Gnus from notmuch-show buffer X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2009 08:02:50 -0000 Hi all, I'm a Gnus user and use notmuch mostly for searching. When I want to reply to a message, I need to get back to Gnus, so that my Gnus posting styles (gcc into that group, right email address, correct signature,...) are applied. Therefore, I created this small snippet. Now C-c C-c inside some message in the *notmuch-show* buffer opens this article in a Gnus *Summary* buffer, where I can reply to it, forward it, ... Of course, the translation from file name to Gnus group name is something that is different for any user. The essence of this code is the call to the org-gnus.el function `org-gnus-follow-link', which takes the group name and the message-id. It's included in Emacsen >= 23. --8<---------------cut here---------------start------------->8--- (require 'notmuch) (defun th-notmuch-file-to-group (file) "Calculate the Gnus group name from the given file name. Example: IN: /home/horn/Mail/Dovecot/uni/INBOX/dbox-Mails/u.4075 OUT: nnimap+Uni:INBOX" (concat "nnimap+" (replace-regexp-in-string "^\\([^/]+\\)/" "\\1:" (replace-regexp-in-string "/dbox-Mails/.*" "" (replace-regexp-in-string "/home/horn/Mail/Dovecot/" "" file))))) (defun th-notmuch-goto-message-in-gnus () "Open a summary buffer containing the current notmuch article." (interactive) (let ((group (th-notmuch-file-to-group (notmuch-show-get-filename))) (message-id (replace-regexp-in-string "^id:" "" (notmuch-show-get-message-id)))) (message "G: %s, mid: %s" group message-id) (if (and group message-id) (org-gnus-follow-link group message-id) (message "Couldn't get relevant infos for switching to Gnus.")))) (define-key notmuch-show-mode-map (kbd "C-c C-c") 'th-notmuch-goto-message-in-gnus) --8<---------------cut here---------------end--------------->8--- BTW, why does `notmuch-show-get-message-id' prefix the message-id with "id:"? Bye, Tassilo