Gnus development mailing list
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: ding@gnus.org
Subject: Re: couple of questions about api
Date: Mon, 26 Nov 2012 10:46:24 +0800	[thread overview]
Message-ID: <87ip8tqdxb.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87d2z4eagy.fsf@redhat.com>

Nikola Pajkovsky <npajkovs@redhat.com> writes:

> Hey folks,
>
> Let's say I have these mails in summary
>
>    [  31: Mark Brown  ] [PATCH 0/5] mfd: arizona: Updates for v3.7
>        [ 553: Mark Brown  ] [PATCH 1/5] mfd: wm5102: Update register patch for latest evaluation
>            [  27: Mark Brown  ] [PATCH 2/5] mfd: wm5110: Disable control interface error report for WM5110 rev B
>            [  34: Mark Brown  ] [PATCH 3/5] mfd: arizona: Use correct array for ARRAY_SIZE in mfd_add_devices call
>            [  37: Mark Brown  ] [PATCH 4/5] mfd: arizona: Correctly report when AIF2/AIF1 is underclocked
>            [  45: Mark Brown  ] [PATCH 5/5] mfd: arizona: Sync regcache after reset
>
> I found the function gnus-fetch-field which works fine in Article
> buffer, but not in Summary buffer. See code
>
> (global-set-key (kbd "\C-xpg") 'get-message-id)
>
> (defun get-message-id ()
>   (car (nthcdr 1 (mail-extract-address-components
> 		  (gnus-fetch-field "message-id")))))
>
>
> What do I have to call to get message-id from mail header from Summary
> buffer?

You can use `(mail-header-id (gnus-summary-article-header))' from the
summary buffer to get the id. That's probably as clean as it gets...

When messing with articles in the summary buffer, I've found one of the
best approaches is to use the variable `gnus-newsgroup-data', which
contains a list of small data structures representing all the visible
messages. The data structures contain the article number and the basic
headers (including Message-Id) for each message, and there's a set of
`gnus-data-*' functions for working with those structures. Similar
structures show up repeatedly with different functions -- the
`gnus-summary-article-header' function I mentioned above returns
something very like a `gnus-newsgroup-data' entry for the message under
point, and many other functions know what to do with those entries.

Good to know about `gnus-summary-work-articles', I hadn't got that far
yet...

E




  parent reply	other threads:[~2012-11-26  2:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-23 13:05 Nikola Pajkovsky
2012-11-26  2:06 ` Dave Goldberg
2012-11-26 20:26   ` Andreas Schwab
2012-11-27 18:50     ` Reiner Steib
2012-11-26  2:46 ` Eric Abrahamsen [this message]
2012-11-27  8:24 ` Nikola Pajkovsky
2012-12-21 19:48 ` Ted Zlatanov

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=87ip8tqdxb.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=ding@gnus.org \
    /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).