* org-gnus.el returns incorrect message subject in article mode
@ 2009-06-05 1:19 finalpatch
2009-06-05 7:28 ` Tassilo Horn
0 siblings, 1 reply; 3+ messages in thread
From: finalpatch @ 2009-06-05 1:19 UTC (permalink / raw)
To: emacs-devel
Hi group,
I found that running org-store-link inside a gnus article buffer gives
out incorrect message subject. This is because in gnus-article-mode the
gnus-summary-subject-string function returns the subject of the next
message instead of the current one. The following patch fixes this
problem for me.
--- c:\users\fengl\code\emacs\lisp\org\org-gnus.el Tue Feb 24 09:05:12 2009
+++ c:\emacs\lisp\org\org-gnus.el Fri Jun 5 11:02:31 2009
@@ -133,7 +133,9 @@
(to (mail-header 'to header))
(newsgroups (mail-header 'newsgroups header))
(x-no-archive (mail-header 'x-no-archive header))
- (subject (gnus-summary-subject-string))
+ (subject (if (eq major-mode 'gnus-article-mode)
+ (message-fetch-field "subject")
+ (gnus-summary-subject-string)))
desc link)
(org-store-link-props :type "gnus" :from from :subject subject
:message-id message-id :group group :to to)
--
finalpatch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: org-gnus.el returns incorrect message subject in article mode
2009-06-05 1:19 org-gnus.el returns incorrect message subject in article mode finalpatch
@ 2009-06-05 7:28 ` Tassilo Horn
2009-06-05 10:08 ` Katsumi Yamaoka
0 siblings, 1 reply; 3+ messages in thread
From: Tassilo Horn @ 2009-06-05 7:28 UTC (permalink / raw)
To: finalpatch, Katsumi Yamaoka, reiner.steib; +Cc: emacs-devel
finalpatch <fengli@gmail.com> writes:
Hi!
> I found that running org-store-link inside a gnus article buffer gives
> out incorrect message subject.
Indeed, that's wrong.
> This is because in gnus-article-mode the gnus-summary-subject-string
> function returns the subject of the next message instead of the
> current one.
Hm, maybe that is a gnus bug? Katsumi or Reiner?
> The following patch fixes this problem for me.
Thanks, I've applied the patch to the git version of org as well as the
version included in emacs.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: org-gnus.el returns incorrect message subject in article mode
2009-06-05 7:28 ` Tassilo Horn
@ 2009-06-05 10:08 ` Katsumi Yamaoka
0 siblings, 0 replies; 3+ messages in thread
From: Katsumi Yamaoka @ 2009-06-05 10:08 UTC (permalink / raw)
To: finalpatch; +Cc: reiner.steib, emacs-devel
>>>>> Tassilo Horn wrote:
> finalpatch <fengli@gmail.com> writes:
>> I found that running org-store-link inside a gnus article buffer gives
>> out incorrect message subject.
> Indeed, that's wrong.
>> This is because in gnus-article-mode the gnus-summary-subject-string
>> function returns the subject of the next message instead of the
>> current one.
> Hm, maybe that is a gnus bug? Katsumi or Reiner?
No, it isn't a Gnus bug, I believe. The `gnus-summary-subject-string'
macro was designed to be used in the summary buffer. So finalpatch's
solution looks correct.
>> The following patch fixes this problem for me.
> Thanks, I've applied the patch to the git version of org as well as the
> version included in emacs.
Since the patch makes it search for the subject in the whole
article body, it might misfetch it if the header doesn't have
the subject but there is the one that looks like the subject in
the body. A better way will be:
--- org-gnus.el~ 2009-06-05 10:01:51 +0000
+++ org-gnus.el 2009-06-05 10:01:26 +0000
@@ -134,7 +134,9 @@
(newsgroups (mail-header 'newsgroups header))
(x-no-archive (mail-header 'x-no-archive header))
(subject (if (eq major-mode 'gnus-article-mode)
- (message-fetch-field "subject")
+ (save-restriction
+ (message-narrow-to-head-1)
+ (message-fetch-field "subject"))
(gnus-summary-subject-string)))
desc link)
(org-store-link-props :type "gnus" :from from :subject subject
Not tested, because I've never used the org-mode.
Regards,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-05 10:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-05 1:19 org-gnus.el returns incorrect message subject in article mode finalpatch
2009-06-05 7:28 ` Tassilo Horn
2009-06-05 10:08 ` Katsumi Yamaoka
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).