From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Subject: Re: Gnus link bug Date: Mon, 24 Aug 2009 14:38:54 +0100 Message-ID: References: <87ljlafkjd.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MfZlG-0003Yk-JS for emacs-orgmode@gnu.org; Mon, 24 Aug 2009 09:39:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MfZlC-0003T7-FD for emacs-orgmode@gnu.org; Mon, 24 Aug 2009 09:39:02 -0400 Received: from [199.232.76.173] (port=58686 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfZlC-0003Su-85 for emacs-orgmode@gnu.org; Mon, 24 Aug 2009 09:38:58 -0400 Received: from ppsw-5.csi.cam.ac.uk ([131.111.8.135]:55558) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MfZlB-0000cX-O4 for emacs-orgmode@gnu.org; Mon, 24 Aug 2009 09:38:58 -0400 In-Reply-To: <87ljlafkjd.fsf@bzg.ath.cx> (Bastien's message of "Mon, 24 Aug 2009 02:32:38 +0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: emacs-orgmode@gnu.org On 2009-08-23 19:32 +0100, Bastien wrote: > Hi Leo, > > Leo writes: > >> I haven't used org to store links from Gnus for almost two years and >> today I tried it again and found at least one annoying bug. >> >> In the summary buffer, calling org-store-link will display the article >> buffer which is uncalled for. It also causes visual disturbance as well >> as asks Gnus to download the article while all the information required >> is already available. > > Should be fixed now in git, please try it. I tried the git version and it worked as expected. > >> Possible solution (not real patch): >> >> In Gnus summary buffer the header of each article is already downloaded >> and can be obtained by (gnus-summary-article-header). To get the mid, >> use (mail-header-id (gnus-summary-article-header)). > > I followed your suggestion, but only for when we are in the summary > buffer, as I found out that the output of `gnus-summary-article-header' > in the article buffer is not very reliable. I feel there's something we can simplify. Also the old code for handling gnus-article-mode moves the cursor around. So I simplified org-gnus-store-link as follows: (defun org-gnus-store-link () "Store a link to a Gnus folder or message." (cond ((eq major-mode 'gnus-group-mode) (let* ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus (gnus-group-group-name)) ; version ((fboundp 'gnus-group-name) (gnus-group-name)) (t "???"))) desc link) (when group (org-store-link-props :type "gnus" :group group) (setq desc (org-gnus-group-link group) link desc) (org-add-link-props :link link :description desc) link))) ((memq major-mode '(gnus-summary-mode gnus-article-mode)) (let* ((group gnus-newsgroup-name) (header (with-current-buffer gnus-summary-buffer (gnus-summary-article-header))) (extra (mail-header-extra header)) (from (mail-header-from header)) (message-id (org-remove-angle-brackets (mail-header-id header))) (date (mail-header-date header)) (to (cdr (assoc 'To extra))) (newsgroups (cdr (assoc 'newsgroup extra))) (x-no-archive (cdr (assoc 'x-no-archive extra))) (subject (mail-header-subject header)) desc link) (org-store-link-props :type "gnus" :from from :subject subject :message-id message-id :group group :to to) (setq desc (org-email-link-description) link (org-gnus-article-link group newsgroups message-id x-no-archive)) (org-add-link-props :link link :description desc) link)))) I tested this in my Emacs 2009-08-10 with the default Gnus. It seems to work nicely. Could you test it as well? Thanks. Leo -- Emacs uptime: 6 days, 23 hours, 16 minutes, 38 seconds