emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Gnus link bug


From: Leo
Subject: [Orgmode] Re: Gnus link bug
Date: Mon, 24 Aug 2009 14:38:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (darwin)

On 2009-08-23 19:32 +0100, Bastien wrote:
> Hi Leo,
>
> Leo <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]