Gnus development mailing list
 help / color / mirror / Atom feed
* accessing article information
@ 2011-07-06  8:17 lee
  2011-07-19 16:16 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: lee @ 2011-07-06  8:17 UTC (permalink / raw)
  To: ding

Hi,

how do you access information about an article from within a
`gnus-user-format-function-*' called when generating the summary buffer?
The documentation says:

,---- [ info (gnus) Summary Buffer Lines ]
| `u'
|      User defined specifier.  The next character in the format string
|      should be a letter.  Gnus will call the function
|      `gnus-user-format-function-X', where X is the letter following
|      `%u'.  The function will be passed the current header as argument.
|      The function should return a string, which will be inserted into
|      the summary just like information from any other summary specifier.
`----

What does the header passed to the function look like?

What I'm trying to do is to write a function to display article marks:


(defun gnus-user-format-function-M (header)
  (let ( (str "#") )
    (if (equal gnus-tmp-unread gnus-unread-mark)
	(setq str (concat str "U"))
      (setq str (concat str "~")))
    (if (equal gnus-tmp-read gnus-read-mark)
	(setq str (concat str "R"))
      (setq str (concat str "~")))))


This function doesn't work.  When I try to enter a group that calls it via
"%uM" in `gnus-summary-line-format', gnus says "no unread news".

Remove the second "if" statement and it works.  I've searched the
documentation, looked at the source and googled, and I haven't found out
what's available in the ominous header passed to the function.



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

* Re: accessing article information
  2011-07-06  8:17 accessing article information lee
@ 2011-07-19 16:16 ` Lars Magne Ingebrigtsen
  2011-07-19 18:24   ` lee
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-19 16:16 UTC (permalink / raw)
  To: ding

lee <lee@yun.yagibdah.de> writes:

> how do you access information about an article from within a
> `gnus-user-format-function-*' called when generating the summary buffer?
> The documentation says:
>
> ,---- [ info (gnus) Summary Buffer Lines ]
> | `u'
> |      User defined specifier.  The next character in the format string
> |      should be a letter.  Gnus will call the function
> |      `gnus-user-format-function-X', where X is the letter following
> |      `%u'.  The function will be passed the current header as argument.
> |      The function should return a string, which will be inserted into
> |      the summary just like information from any other summary specifier.
> `----
>
> What does the header passed to the function look like?

It's a header vector.  Use `mail-header-number' etc to access the slots.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




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

* Re: accessing article information
  2011-07-19 16:16 ` Lars Magne Ingebrigtsen
@ 2011-07-19 18:24   ` lee
  2011-07-19 18:27     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: lee @ 2011-07-19 18:24 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> lee <lee@yun.yagibdah.de> writes:
>
>> how do you access information about an article from within a
>> `gnus-user-format-function-*' called when generating the summary buffer?
>> The documentation says:
>>
>> ,---- [ info (gnus) Summary Buffer Lines ]
>> | `u'
>> |      User defined specifier.  The next character in the format string
>> |      should be a letter.  Gnus will call the function
>> |      `gnus-user-format-function-X', where X is the letter following
>> |      `%u'.  The function will be passed the current header as argument.
>> |      The function should return a string, which will be inserted into
>> |      the summary just like information from any other summary specifier.
>> `----
>>
>> What does the header passed to the function look like?
>
> It's a header vector.  Use `mail-header-number' etc to access the slots.

Thanks!  When I look at the macros defined in nnheader.el, there don't
seem to be any macros to access the marks an article has.  Can I use
`gnus-summary-article-mark' as defined in gnus-sum.el in a
`gnus-user-format-function-*' to find out the marks?

Hm, looking at the .marks files, where does gnus store marks like
killed, caught up with, etc.?



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

* Re: accessing article information
  2011-07-19 18:24   ` lee
@ 2011-07-19 18:27     ` Lars Magne Ingebrigtsen
  2011-07-19 22:50       ` lee
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-19 18:27 UTC (permalink / raw)
  To: ding

lee <lee@yun.yagibdah.de> writes:

> Thanks!  When I look at the macros defined in nnheader.el, there don't
> seem to be any macros to access the marks an article has.

The marks aren't in the header vector.

> Can I use `gnus-summary-article-mark' as defined in gnus-sum.el in a
> `gnus-user-format-function-*' to find out the marks?

I think so.

> Hm, looking at the .marks files, where does gnus store marks like
> killed, caught up with, etc.?

In the .newsrc.eld file.  

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




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

* Re: accessing article information
  2011-07-19 18:27     ` Lars Magne Ingebrigtsen
@ 2011-07-19 22:50       ` lee
  0 siblings, 0 replies; 5+ messages in thread
From: lee @ 2011-07-19 22:50 UTC (permalink / raw)
  To: ding

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> lee <lee@yun.yagibdah.de> writes:
>
>> Can I use `gnus-summary-article-mark' as defined in gnus-sum.el in a
>> `gnus-user-format-function-*' to find out the marks?
>
> I think so.

(defun gnus-user-format-function-M (header)
  (gnus-summary-article-mark (mail-header-number header)))

... works and yields numbers that correspond to marks.  It gives one
number per article, like the one for `gnus-ancient-mark' for read
articles.

>> Hm, looking at the .marks files, where does gnus store marks like
>> killed, caught up with, etc.?
>
> In the .newsrc.eld file.  

And how do you access them?  I suspect they are the second of the
numbers in `gnus-newsgroup-data' ... but then, what if an article has
several marks ... something to trace further tomorrow.  It's always good
to have the sources :)



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

end of thread, other threads:[~2011-07-19 22:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-06  8:17 accessing article information lee
2011-07-19 16:16 ` Lars Magne Ingebrigtsen
2011-07-19 18:24   ` lee
2011-07-19 18:27     ` Lars Magne Ingebrigtsen
2011-07-19 22:50       ` lee

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).