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 6D2DA40DF1F for ; Sat, 20 Nov 2010 17:12:54 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham 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 b9SpYFpOPHWk for ; Sat, 20 Nov 2010 17:12:42 -0800 (PST) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) by olra.theworths.org (Postfix) with ESMTP id 9B5E540DEEC for ; Sat, 20 Nov 2010 17:12:42 -0800 (PST) Received: by fxm10 with SMTP id 10so952083fxm.26 for ; Sat, 20 Nov 2010 17:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=j7D6tAs4NKNqGZT3xJMP7/gE67E21ksM0Mak/L51WCI=; b=ttkurPhHi+T8GMJR5VbytDIl1FYp0nHWPBKWbfMm5qN7UCwk+7UzyudGb6EhOf7pjj OcIqqD5N6+iwnHTQoo8Ank+rUGzdng5J9pSqmJav2KuVyltuvxxebHNwfQADoxTGy+0l +I5ireUq1h5DT2/rfhiZ7SFi8UW2RKqJZgAoM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=DcXqgBHrr9dtWwu93wOIKGPBnGLQVFLOUFM3jBKKjU+CrvpJ+KfJNPQDZykpoPLCGX ZhiWe4PGYjwpT9rkwChY1Ojk/guLcsiYlEWhRRsimpBcxYPoOub7NKOEXhneEld6jDHr h64+UTqnFYN4t7FzTDG0QNg0YxiDTAiTWOq6o= MIME-Version: 1.0 Received: by 10.223.122.146 with SMTP id l18mr2598426far.102.1290301961671; Sat, 20 Nov 2010 17:12:41 -0800 (PST) Received: by 10.223.89.142 with HTTP; Sat, 20 Nov 2010 17:12:41 -0800 (PST) In-Reply-To: <87zl6cl595.fsf@thinkpad.tsdh.de> References: <87zl6cl595.fsf@thinkpad.tsdh.de> Date: Sat, 20 Nov 2010 20:12:41 -0500 Message-ID: Subject: Re: [notmuch] Snippet to jump to message in Gnus from notmuch-show buffer From: Brett Viren To: notmuch@notmuchmail.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Sun, 21 Nov 2010 01:12:54 -0000 Hi Tassilo, I adapted your code for my use and found it was failing due to some stray double-quotes. I'm using notmuch from git so maybe these quotes were added in the year since you first posted your idea. See below for the simple fix: On Tue, Nov 24, 2009 at 3:02 AM, Tassilo Horn wrot= e: > --8<---------------cut here---------------start------------->8--- > (require 'notmuch) > > (defun th-notmuch-file-to-group (file) > =A0"Calculate the Gnus group name from the given file name. > > Example: > > =A0IN: /home/horn/Mail/Dovecot/uni/INBOX/dbox-Mails/u.4075 > =A0OUT: nnimap+Uni:INBOX" > =A0(concat "nnimap+" > =A0 =A0 =A0 =A0 =A0(replace-regexp-in-string > =A0 =A0 =A0 =A0 =A0 "^\\([^/]+\\)/" "\\1:" > =A0 =A0 =A0 =A0 =A0 (replace-regexp-in-string > =A0 =A0 =A0 =A0 =A0 =A0"/dbox-Mails/.*" "" > =A0 =A0 =A0 =A0 =A0 =A0(replace-regexp-in-string > =A0 =A0 =A0 =A0 =A0 =A0 "/home/horn/Mail/Dovecot/" "" file))))) > > (defun th-notmuch-goto-message-in-gnus () > =A0"Open a summary buffer containing the current notmuch > article." > =A0(interactive) > =A0(let ((group (th-notmuch-file-to-group (notmuch-show-get-filename))) > =A0 =A0 =A0 =A0(message-id (replace-regexp-in-string > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "^id:" "" (notmuch-show-get-messa= ge-id)))) I needed to define the message-id like: (message-id (replace-regexp-in-string "\"" "" (replace-regexp-in-string "^id:" "" (notmuch-show-get-message-id))))) > =A0 =A0(message "G: %s, mid: %s" group message-id) > =A0 =A0(if (and group message-id) > =A0 =A0 =A0 =A0(org-gnus-follow-link group message-id) > =A0 =A0 =A0(message "Couldn't get relevant infos for switching to Gnus.")= ))) > > (define-key notmuch-show-mode-map (kbd "C-c C-c") 'th-notmuch-goto-messag= e-in-gnus) > --8<---------------cut here---------------end--------------->8--- Regards and thanks for this handy code! -Brett.