emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: Bastien <bastienguerry@googlemail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Gnus link bug
Date: Mon, 24 Aug 2009 14:38:54 +0100	[thread overview]
Message-ID: <m0my5pib69.fsf@cam.ac.uk> (raw)
In-Reply-To: <87ljlafkjd.fsf@bzg.ath.cx> (Bastien's message of "Mon, 24 Aug 2009 02:32:38 +0800")

On 2009-08-23 19:32 +0100, Bastien wrote:
> Hi Leo,
>
> Leo <sdl.web@gmail.com> 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	other threads:[~2009-08-24 13:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19 10:53 Gnus link bug Leo
2009-08-23 18:32 ` Bastien
2009-08-24 13:38   ` Leo [this message]
2009-08-25  2:43     ` Bastien
2009-08-27 15:54       ` Leo
2009-08-27 23:10         ` Bastien
2009-08-28 20:12           ` Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m0my5pib69.fsf@cam.ac.uk \
    --to=sdl.web@gmail.com \
    --cc=bastienguerry@googlemail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).