Gnus development mailing list
 help / color / mirror / Atom feed
From: Jonas Steverud <tvrud@bredband.net>
Subject: Re: Adulterate summary lines
Date: Tue, 17 Aug 2004 09:41:10 +0200	[thread overview]
Message-ID: <m2fz6m5i09.fsf@c-ed5372d5.036-4-67626721.cust.bredbandsbolaget.se> (raw)
In-Reply-To: <m3isbibm74.fsf@newsguy.com> (Harry Putnam's message of "Mon, 16 Aug 2004 20:14:07 -0500")

Harry Putnam <reader@newsguy.com> writes:

> Jonas Steverud <tvrud@bredband.net> writes:
[...]
> I don't see the stuff you posted as a result of your function.  What I
> see is a summary buffer that looks like:

I didn't document/comment sufficiently, sorry.

> ?  [  59: test] Adulterate summary lines
> RA     [  90: test] 
> R      [  28: test] Gnus for information storage (Was: Adulterate summary lines)
>
> Line one is my post, line 2 is your answer and line 3 is another
> message from you about using gnus as info storage tool.
>
> I have not the slightest clue how or what is coding this.
>
> It would be handy if you provided some notes as to what is doing what.
> (defun gnus-user-format-function-x (STR)
>     (message (prin1-to-string STR))
>   "test")

What is happening is that when Gnus encounter %u it concatenates
"gnus-user-format-function-" with the letter following %u, in our
example it is %ux, i.e. gnus-user-format-function-x is called. So far
so good.

According to the docs, as you have pointed out, something is sent to
the function - and I wanted to find out what it was. prin1-to-string
takes a lisp symbol/expression and converts it to a string and the
message function takes whatever arguments it gets and puts it in the
*Messages* buffer. This is so I can get a debug printout, similar to a
printf() in a C program.

It turns out that what is sent to the gnus-user-format-function-x
function is a vector of a number of the values of the headers in the
message. I do not know which value is which header except one can
deduce which value is the subject, from and the date. But there are a
number of helper functions, e.g. mail-header-date returns the date field.

Since the result of gnus-user-format-function-x should be a string and
that string is inserted in the *Summary* buffer I added a dummy result
"test" to make sure that it returned a string and that my *Summary*
buffer wasn't bogged down with very long strings - IIRC message
returns its argument and if the message function call was the last in
the function, it might return a very long string indeed depending on
which arguments was passed to gnus-user-format-function-x.

> As I posted to start the manual says "function would be passed the
> current header"
>
> What header is being passed?

The values/fields of the header in the current message. That is not
header as in "the Date header" but as in "the header of the
message". In my example this was passed to gnus-user-format-function-x
as a vector (i.e. what ended up in the *Messages* buffer):

[1841 "Adulterate summary lines" "Harry Putnam <reader@newsguy.com>"
"Mon, 16 Aug 2004 06:12:31 -0500" "<m3pt5rl4kg.fsf@newsguy.com>" ""
4863 59 "c-ed5372d5.036-4-67626721.cust.bredbandsbolaget.se Ding:1841"
((To . "ding@gnus.org") (User-Agent . "Gnus/5.110003 (No Gnus v0.3)
Emacs/21.3.50 (gnu/linux)"))]

My guess is that it is the value of all the header fields that you has
deemed interesting, i.e.  the headers that ends up in the *Article*
buffer when you read the message. In my case I have added a couple of
extra headers (e.g. To) to my gnus-extra-headers, which ends up in the
alist at the end of the vector.



I have assumed that you are an experienced Emacs Lisp/Gnus programmer,
the "homeboy indexing system" made me think this was the case. In case
I'm mistaken I can easily elaborate more on my code. :-)

-- 
(        http://hem.bredband.net/steverud/        !     Wei Wu Wei     )
(        Meaning of U2 Lyrics, Roleplaying        !  To Do Without Do  )




  reply	other threads:[~2004-08-17  7:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-16 11:12 Harry Putnam
2004-08-16 15:40 ` Jonas Steverud
2004-08-17  0:15   ` Harry Putnam
2004-08-17  1:14   ` Harry Putnam
2004-08-17  7:41     ` Jonas Steverud [this message]
2004-08-17 11:29       ` Harry Putnam
2004-08-16 15:52 ` Gnus for information storage (Was: Adulterate summary lines) Robert Epprecht

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

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

  git send-email \
    --in-reply-to=m2fz6m5i09.fsf@c-ed5372d5.036-4-67626721.cust.bredbandsbolaget.se \
    --to=tvrud@bredband.net \
    /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.
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).