[-- Attachment #1: Type: text/plain, Size: 202 bytes --] Without the following patch, storing links to Gnus Article buffers fails on CVS Emacs, as they (at least in my setup -- IMAP) always contain a "From " line, which can't be parsed as an RFC822 header. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: +gnus-tweak.patch --] [-- Type: text/x-diff, Size: 965 bytes --] From: Andreas Rottmann <a.rottmann@gmx.at> Subject: [PATCH] Fixes for the Gnus integration - `org-gnus-store-link': When the article buffer starts with "From ", ignore the first line. This is necessary at least on Gnus v5.13, as shipped with emacs23 (CVS 2009-06-18). --- lisp/org-gnus.el | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el index 41b1be7..4cc5adb 100644 --- a/lisp/org-gnus.el +++ b/lisp/org-gnus.el @@ -128,6 +128,8 @@ If `org-store-link' was called with a prefix arg the meaning of (header (with-current-buffer gnus-article-buffer (gnus-summary-toggle-header 1) (goto-char (point-min)) + (when (looking-at "From ") + (next-line)) (mail-header-extract-no-properties))) (from (mail-header 'from header)) (message-id (org-remove-angle-brackets -- tg: (0795e42..) t/gnus-fixes (depends on: master) [-- Attachment #3: Type: text/plain, Size: 16 bytes --] Regards, Rotty [-- Attachment #4: Type: text/plain, Size: 204 bytes --] _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Andreas Rottmann <a.rottmann@gmx.at> writes: Hi Andreas, > Without the following patch, storing links to Gnus Article buffers > fails on CVS Emacs, as they (at least in my setup -- IMAP) always > contain a "From " line, which can't be parsed as an RFC822 header. Could you elaborate a bit, i.e. provide such an example mail? > diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el > index 41b1be7..4cc5adb 100644 > --- a/lisp/org-gnus.el > +++ b/lisp/org-gnus.el > @@ -128,6 +128,8 @@ If `org-store-link' was called with a prefix arg the meaning of > (header (with-current-buffer gnus-article-buffer > (gnus-summary-toggle-header 1) > (goto-char (point-min)) > + (when (looking-at "From ") > + (next-line)) > (mail-header-extract-no-properties))) > (from (mail-header 'from header)) > (message-id (org-remove-angle-brackets Looking at the patch, I get the impression, that it's a solution to a problem you created on your own. ;-) If the first line of a mail starts with "From ", I'd say it's broken. ,----[ http://cr.yp.to/immhf/field.html ] | The first line of a field begins with a name and a colon. The name is a | string of one or more graphical ASCII characters other than colons, | i.e., bytes between 33 and 126 inclusive other than 58. `---- The space has the ASCII code 32, so IMO it's not allowed as header field name. Bye, Tassilo
Tassilo Horn <tassilo@member.fsf.org> writes: > Andreas Rottmann <a.rottmann@gmx.at> writes: > > Hi Andreas, > >> Without the following patch, storing links to Gnus Article buffers >> fails on CVS Emacs, as they (at least in my setup -- IMAP) always >> contain a "From " line, which can't be parsed as an RFC822 header. > > Could you elaborate a bit, i.e. provide such an example mail? > This is your mail as shown by Gnus after toggling the headers: http://rotty.yi.org/tmp/gnus-article-buffer-sample.txt >> diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el >> index 41b1be7..4cc5adb 100644 >> --- a/lisp/org-gnus.el >> +++ b/lisp/org-gnus.el >> @@ -128,6 +128,8 @@ If `org-store-link' was called with a prefix arg the meaning of >> (header (with-current-buffer gnus-article-buffer >> (gnus-summary-toggle-header 1) >> (goto-char (point-min)) >> + (when (looking-at "From ") >> + (next-line)) >> (mail-header-extract-no-properties))) >> (from (mail-header 'from header)) >> (message-id (org-remove-angle-brackets > > Looking at the patch, I get the impression, that it's a solution to a > problem you created on your own. ;-) > > If the first line of a mail starts with "From ", I'd say it's broken. > "From " lines are for example used in the mbox format[0], so I wasn't too surprised to find it in my IMAP mails as well. However, you very well might be right that this is a bug in the MDA (which stores the mails, including the disputed first line, in a Maildir folder, which is then served by via IMAP). [0] http://www.qmail.org/man/man5/mbox.html > ,----[ http://cr.yp.to/immhf/field.html ] > | The first line of a field begins with a name and a colon. The name is a > | string of one or more graphical ASCII characters other than colons, > | i.e., bytes between 33 and 126 inclusive other than 58. > `---- > > The space has the ASCII code 32, so IMO it's not allowed as header field > name. > I'm aware of that; but I never said that the "From " line is supposed to be a header field -- it preceeds the email headers. Regards, Rotty -- Andreas Rottmann -- <http://rotty.yi.org/>
Andreas Rottmann <a.rottmann@gmx.at> writes: Hi Andreas, > "From " lines are for example used in the mbox format[0], so I wasn't > too surprised to find it in my IMAP mails as well. I see. > However, you very well might be right that this is a bug in the MDA > (which stores the mails, including the disputed first line, in a > Maildir folder, which is then served by via IMAP). Yep. But in general I'm pretty sure that your patch won't introduce effects to "normal" mails, and since Gnus displays those "From " mails without problem, the linking should do the same. So I'll apply it to my local branch and alarm Carsten to pull the changes. > [0] http://www.qmail.org/man/man5/mbox.html Bye and thanks for the report, Tassilo
I just applied the patch in the version I got from Tassilo.
Thanks!
- Carsten
On Jul 7, 2009, at 12:34 PM, Andreas Rottmann wrote:
> Tassilo Horn <tassilo@member.fsf.org> writes:
>
>> Andreas Rottmann <a.rottmann@gmx.at> writes:
>>
>> Hi Andreas,
>>
>>> Without the following patch, storing links to Gnus Article buffers
>>> fails on CVS Emacs, as they (at least in my setup -- IMAP) always
>>> contain a "From " line, which can't be parsed as an RFC822 header.
>>
>> Could you elaborate a bit, i.e. provide such an example mail?
>>
> This is your mail as shown by Gnus after toggling the headers:
>
> http://rotty.yi.org/tmp/gnus-article-buffer-sample.txt
>
>>> diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
>>> index 41b1be7..4cc5adb 100644
>>> --- a/lisp/org-gnus.el
>>> +++ b/lisp/org-gnus.el
>>> @@ -128,6 +128,8 @@ If `org-store-link' was called with a prefix
>>> arg the meaning of
>>> (header (with-current-buffer gnus-article-buffer
>>> (gnus-summary-toggle-header 1)
>>> (goto-char (point-min))
>>> + (when (looking-at "From ")
>>> + (next-line))
>>> (mail-header-extract-no-properties)))
>>> (from (mail-header 'from header))
>>> (message-id (org-remove-angle-brackets
>>
>> Looking at the patch, I get the impression, that it's a solution to a
>> problem you created on your own. ;-)
>>
>> If the first line of a mail starts with "From ", I'd say it's broken.
>>
> "From " lines are for example used in the mbox format[0], so I wasn't
> too surprised to find it in my IMAP mails as well. However, you very
> well might be right that this is a bug in the MDA (which stores the
> mails, including the disputed first line, in a Maildir folder, which
> is
> then served by via IMAP).
>
> [0] http://www.qmail.org/man/man5/mbox.html
>
>> ,----[ http://cr.yp.to/immhf/field.html ]
>> | The first line of a field begins with a name and a colon. The
>> name is a
>> | string of one or more graphical ASCII characters other than colons,
>> | i.e., bytes between 33 and 126 inclusive other than 58.
>> `----
>>
>> The space has the ASCII code 32, so IMO it's not allowed as header
>> field
>> name.
>>
> I'm aware of that; but I never said that the "From " line is
> supposed to
> be a header field -- it preceeds the email headers.
>
> Regards, Rotty
> --
> Andreas Rottmann -- <http://rotty.yi.org/>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Tassilo Horn <tassilo@member.fsf.org> writes:
>> However, you very well might be right that this is a bug in the MDA
>> (which stores the mails, including the disputed first line, in a
>> Maildir folder, which is then served by via IMAP).
>
> Yep. But in general I'm pretty sure that your patch won't introduce
> effects to "normal" mails, and since Gnus displays those "From " mails
> without problem, the linking should do the same. So I'll apply it to my
> local branch and alarm Carsten to pull the changes.
>
Cool; thanks!
Cheers, Rotty