Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Change article "From" field
@ 2008-02-06  4:12 William Xu
  0 siblings, 0 replies; 6+ messages in thread
From: William Xu @ 2008-02-06  4:12 UTC (permalink / raw)
  To: info-gnus-english

I tried to set current article's "From" field based on its contents. For
example, if the article content looks like: 

,----
| Timestamp: 2008/02/06
| Author: william
`----

I want to use the Author line to set "From" field, so that it does not
display as "nobody". (This is a RSS group) I tried doing this in
gnus-article-prepare-hook, calling something like:

,----
| (gnus-summary-edit-article 2)
| (goto-char (point-min))
| (insert (format "From: %s\n" author))
| (gnus-article-edit-done)
`----

But it looks like this will be called again and again. Am I using the
wrong hook?

-- 
William

http://williamxu.net9.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Change article "From" field
       [not found] ` <foed64$g7c$1@news.sap-ag.de>
@ 2008-02-08  8:31   ` William Xu
  0 siblings, 0 replies; 6+ messages in thread
From: William Xu @ 2008-02-08  8:31 UTC (permalink / raw)
  To: info-gnus-english

Klaus Straubinger <KSNetz@UseNet.ArcorNews.DE> writes:

> According to nnrss-check-group, this should already work if the
> RSS file has specified an author (or dc:creator or dc:contributor) node:
> |	(setq author (or (nnrss-node-text rss-ns 'author item)
> |			 (nnrss-node-text dc-ns 'creator item)
> |			 (nnrss-node-text dc-ns 'contributor item)))
>
> An example for this is "http://www.guardian.co.uk/rssfeed/0,,1,00.xml".
>
> You could advise the function nnrss-fetch to modify something if your
> site uses yet another node name.

I looked into the RSS source, most of them actually does not contain an
author field.  The reason is that only those who have set author info on
the trac site will have a valid author tag in the RSS...

-- 
William

http://williamxu.net9.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Change article "From" field
  2008-02-06 20:27   ` Reiner Steib
@ 2008-02-07  7:34     ` William Xu
  0 siblings, 0 replies; 6+ messages in thread
From: William Xu @ 2008-02-07  7:34 UTC (permalink / raw)
  To: info-gnus-english

Reiner Steib <reinersteib+gmane@imap.cc> writes:

> Wouldn't it make more sense to define a user format function that
> fetches "Author:" from the body and display it in the Summary buffer?

Yes, you are right.  I realized it myself shortly after.  But there is
another thing.  For fetching "Author:" from the body, does it mean that
Gnus has to scan through all the message bodies?

To explain things a bit more, I subscribed to a trac project RSS
changelog page. (The adm refuses to add a mailing list for recording
changes) In Gnus, each RSS item(or article in Gnus) only contains a href
"link". So to figure out author, I have to visit that "link" first,
which could be a bit time consuming. 

-- 
William

http://williamxu.net9.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Change article "From" field
  2008-02-06  6:36 ` Katsumi Yamaoka
  2008-02-06  8:54   ` William Xu
@ 2008-02-06 20:27   ` Reiner Steib
  2008-02-07  7:34     ` William Xu
  1 sibling, 1 reply; 6+ messages in thread
From: Reiner Steib @ 2008-02-06 20:27 UTC (permalink / raw)
  To: info-gnus-english

On Wed, Feb 06 2008, Katsumi Yamaoka wrote:

>>>>>> William Xu wrote:
>> ,----
>>| (gnus-summary-edit-article 2)
>>| (goto-char (point-min))
>>| (insert (format "From: %s\n" author))
>>| (gnus-article-edit-done)
>> `----
[...]
> (let ((gnus-article-prepare-hook nil))
>   (gnus-article-edit-done))

Wouldn't it make more sense to define a user format function that
fetches "Author:" from the body and display it in the Summary buffer?

In
<http://theotp1.physik.uni-ulm.de/~ste/comp/emacs/gnus/rs-gnus-summary.el>
you can find some examples display e.g. infos from arbitrary headers.
I'm not sure if doing it similar in this case (for body and RSS)
works.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Change article "From" field
  2008-02-06  6:36 ` Katsumi Yamaoka
@ 2008-02-06  8:54   ` William Xu
  2008-02-06 20:27   ` Reiner Steib
  1 sibling, 0 replies; 6+ messages in thread
From: William Xu @ 2008-02-06  8:54 UTC (permalink / raw)
  To: info-gnus-english

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> `gnus-article-edit-done' calls `gnus-article-prepare-hook' when
> re-displaying the article, so this will help:
>
> (let ((gnus-article-prepare-hook nil))
>   (gnus-article-edit-done))

This resolves my problem. Thanks ! 

-- 
William

http://williamxu.net9.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Change article "From" field
       [not found] <mailman.7018.1202271207.18990.info-gnus-english@gnu.org>
@ 2008-02-06  6:36 ` Katsumi Yamaoka
  2008-02-06  8:54   ` William Xu
  2008-02-06 20:27   ` Reiner Steib
       [not found] ` <foed64$g7c$1@news.sap-ag.de>
  1 sibling, 2 replies; 6+ messages in thread
From: Katsumi Yamaoka @ 2008-02-06  6:36 UTC (permalink / raw)
  To: info-gnus-english

>>>>> William Xu wrote:
[...]
> gnus-article-prepare-hook, calling something like:

> ,----
>| (gnus-summary-edit-article 2)
>| (goto-char (point-min))
>| (insert (format "From: %s\n" author))
>| (gnus-article-edit-done)
> `----

> But it looks like this will be called again and again. Am I using the
> wrong hook?

`gnus-article-edit-done' calls `gnus-article-prepare-hook' when
re-displaying the article, so this will help:

(let ((gnus-article-prepare-hook nil))
  (gnus-article-edit-done))

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-08  8:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-06  4:12 Change article "From" field William Xu
     [not found] <mailman.7018.1202271207.18990.info-gnus-english@gnu.org>
2008-02-06  6:36 ` Katsumi Yamaoka
2008-02-06  8:54   ` William Xu
2008-02-06 20:27   ` Reiner Steib
2008-02-07  7:34     ` William Xu
     [not found] ` <foed64$g7c$1@news.sap-ag.de>
2008-02-08  8:31   ` William Xu

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 NNTP newsgroup(s).