Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and...
authorPieter Praet <pieter@praet.org>
Thu, 26 Jan 2012 13:07:44 +0000 (14:07 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:21 +0000 (09:43 -0800)
8d/fc6e6c9e219b64597a684b792d7715c6969680 [new file with mode: 0644]

diff --git a/8d/fc6e6c9e219b64597a684b792d7715c6969680 b/8d/fc6e6c9e219b64597a684b792d7715c6969680
new file mode 100644 (file)
index 0000000..e6d0323
--- /dev/null
@@ -0,0 +1,191 @@
+Return-Path: <pieter@praet.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 33AC5431FB6\r
+       for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 05:09:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id WgtjOqDPAYw4 for <notmuch@notmuchmail.org>;\r
+       Thu, 26 Jan 2012 05:09:42 -0800 (PST)\r
+Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
+ [74.125.82.45])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 23367431FAE   for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 05:09:42 -0800\r
+ (PST)\r
+Received: by wgbdt12 with SMTP id dt12so499056wgb.2\r
+       for <notmuch@notmuchmail.org>; Thu, 26 Jan 2012 05:09:41 -0800 (PST)\r
+Received: by 10.180.80.8 with SMTP id n8mr3392346wix.14.1327583380892;\r
+       Thu, 26 Jan 2012 05:09:40 -0800 (PST)\r
+Received: from localhost ([109.131.116.159])\r
+       by mx.google.com with ESMTPS id fr8sm12394010wib.10.2012.01.26.05.09.40\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 26 Jan 2012 05:09:40 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: David Edmondson <dme@dme.org>\r
+Subject: Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and\r
+       `notmuch-show-stash-gmane-and-go'.\r
+In-Reply-To: <cunliownvhs.fsf@hotblack-desiato.hh.sledj.net>\r
+References: <1327397873-20596-1-git-send-email-dme@dme.org>\r
+       <1327452608-8247-1-git-send-email-pieter@praet.org>\r
+       <cunliownvhs.fsf@hotblack-desiato.hh.sledj.net>\r
+User-Agent: Notmuch/0.11+132~ga81001f (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+Date: Thu, 26 Jan 2012 14:07:44 +0100\r
+Message-ID: <87pqe6vcgv.fsf@praet.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 26 Jan 2012 13:09:43 -0000\r
+\r
+On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <dme@dme.org> wrote:\r
+> On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet <pieter@praet.org> wrote:\r
+> > In a perfect world, everyone would be using Notmuch and have a local\r
+> > copy of every message ever sent to any ML.  While we're waiting for\r
+> > Atlantis to resurface, we'll need an interim solution.\r
+> > \r
+> > +1 for the idea, but Gmane doesn't archive *all* MLs, so we should leave\r
+> > the user some legroom.  Since I've already made the necessary changes,\r
+> > I'll just send the patch instead of wasting your time with suggestions.\r
+> > Feel free to merge it into yours.\r
+> \r
+> This is definitely a good idea, but...\r
+> \r
+> > Peace\r
+> > \r
+> > ---\r
+> >  emacs/notmuch-show.el |   40 ++++++++++++++++++++++++++++++----------\r
+> >  test/emacs            |    2 +-\r
+> >  2 files changed, 31 insertions(+), 11 deletions(-)\r
+> > \r
+> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> > index c4d45e7..7f209cd 100644\r
+> > --- a/emacs/notmuch-show.el\r
+> > +++ b/emacs/notmuch-show.el\r
+> > @@ -123,6 +123,24 @@ indentation."\r
+> >             (const :tag "View interactively"\r
+> >                    notmuch-show-interactively-view-part)))\r
+> >  \r
+> > +(defcustom notmuch-show-stash-mlarchive-link-pref "http://mid.gmane.org/"\r
+> > +  "Default Mailing List Archive to use when stashing links."\r
+> > +  :group 'notmuch-show\r
+> > +  ;; TODO: find a working `Message-Id' search arg for all options.\r
+> > +  :type '(choice (const :tag "Gmane"\r
+> > +                  "http://mid.gmane.org/")\r
+> > +           ;; (const :tag "MARC"\r
+> > +           ;;     "http://marc.info/")\r
+> > +           (const :tag "Mail Archive, The"\r
+> > +                  "http://www.mail-archive.com/search?l=mid&q=")\r
+> > +           ;; (const :tag "MarkMail"\r
+> > +           ;;     "http://markmail.org/")\r
+> > +           ;; (const :tag "opensubscriber"\r
+> > +           ;;     "http://opensubscriber.com/")\r
+> > +           ;; (const :tag "Nabble"\r
+> > +           ;;     "http://nabble.com/")\r
+> > +           (string :tag "Custom URI")))\r
+> \r
+> ...do we not now how to reference messages by message-id on these other\r
+> services?\r
+> \r
+\r
+I've found the missing Message-Id search URI for 'marc.info', but as\r
+for the remaining services:  if they provide search by Message-Id,\r
+they're pretty damn good at hiding it...\r
+\r
+\r
+> Your point about Gmane not having everything applies equally to any\r
+> service, suggesting that perhaps the user should also have an option to\r
+> choose which service to use at stash time. Thoughts?\r
+> \r
+\r
+Definitely.\r
+\r
+Patch follows.\r
+\r
+\r
+> > +\r
+> >  (defmacro with-current-notmuch-show-message (&rest body)\r
+> >    "Evaluate body with current buffer set to the text of current message"\r
+> >    `(save-excursion\r
+> > @@ -1016,8 +1034,8 @@ thread id.  If a prefix is given, crypto processing is toggled."\r
+> >      (define-key map "s" 'notmuch-show-stash-subject)\r
+> >      (define-key map "T" 'notmuch-show-stash-tags)\r
+> >      (define-key map "t" 'notmuch-show-stash-to)\r
+> > -    (define-key map "g" 'notmuch-show-stash-gmane)\r
+> > -    (define-key map "G" 'notmuch-show-stash-gmane-and-go)\r
+> > +    (define-key map "l" 'notmuch-show-stash-mlarchive-link)\r
+> > +    (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)\r
+> >      map)\r
+> >    "Submap for stash commands")\r
+> >  (fset 'notmuch-show-stash-map notmuch-show-stash-map)\r
+> > @@ -1605,20 +1623,22 @@ buffer."\r
+> >    (interactive)\r
+> >    (notmuch-common-do-stash (notmuch-show-get-to)))\r
+> >  \r
+> > -(defun notmuch-show-stash-gmane ()\r
+> > -  "Copy a Gmane URI for the current message to the kill-ring.\r
+> > +(defun notmuch-show-stash-mlarchive-link ()\r
+> > +  "Copy an ML Archive URI for the current message to the kill-ring.\r
+> >  \r
+> > -This presumes that the message is available at Gmane."\r
+> > +This presumes that the message is available at the Mailing List Archive\r
+> > +configured in `notmuch-show-stash-mlarchive-link-pref'."\r
+> >    (interactive)\r
+> > -  (notmuch-common-do-stash (concat "http://mid.gmane.org/"\r
+> > +  (notmuch-common-do-stash (concat notmuch-show-stash-mlarchive-link-pref\r
+> >                               (substring (notmuch-show-get-message-id) 4 -1))))\r
+> >  \r
+> > -(defun notmuch-show-stash-gmane-and-go ()\r
+> > -  "Copy a Gmane URI for the current message to the kill-ring and visit it.\r
+> > +(defun notmuch-show-stash-mlarchive-link-and-go ()\r
+> > +  "Copy an ML Archive URI for the current message to the kill-ring and visit it.\r
+> >  \r
+> > -This presumes that the message is available at Gmane."\r
+> > +This presumes that the message is available at the Mailing List Archive\r
+> > +configured in `notmuch-show-stash-mlarchive-link-pref'."\r
+> >    (interactive)\r
+> > -  (let ((uri (concat "http://mid.gmane.org/"\r
+> > +  (let ((uri (concat notmuch-show-stash-mlarchive-link-pref\r
+> >                 (substring (notmuch-show-get-message-id) 4 -1))))\r
+> >      (notmuch-common-do-stash uri)\r
+> >      (browse-url uri)))\r
+> > diff --git a/test/emacs b/test/emacs\r
+> > index 5f7467d..4e08726 100755\r
+> > --- a/test/emacs\r
+> > +++ b/test/emacs\r
+> > @@ -382,7 +382,7 @@ test_emacs '(notmuch-show "id:\"bought\"")\r
+> >    (notmuch-show-stash-message-id-stripped)\r
+> >    (notmuch-show-stash-tags)\r
+> >    (notmuch-show-stash-filename)\r
+> > -  (notmuch-show-stash-gmane)\r
+> > +  (notmuch-show-stash-mlarchive-link)\r
+> >    (switch-to-buffer\r
+> >      (generate-new-buffer "*test-stashing*"))\r
+> >    (dotimes (i 10)\r
+> > -- \r
+> > 1.7.8.1\r
+> > \r
+\r
+\r
+Peace\r
+\r
+-- \r
+Pieter\r