From: Alexander Baier <alexander.baier@mailbox.org>
To: ding@gnus.org
Subject: Re: function to access raw article
Date: Fri, 31 Oct 2014 14:38:18 +0100 [thread overview]
Message-ID: <87ppd8gy0l.fsf@mailbox.org> (raw)
In-Reply-To: <87lhnwe6vl.fsf@lifelogs.com> (Ted Zlatanov's message of "Fri, 31 Oct 2014 08:55:10 -0400")
On 2014-10-31 13:55 Ted Zlatanov wrote:
> On Fri, 31 Oct 2014 09:29:41 +0100 Alexander Baier
> <alexander.baier@mailbox.org> wrote:
>
> AB> I want to access the raw (unwashed) version of an article from emacs
> AB> lisp to search for a regexp. I do this in order to extract information
> AB> from the body of the article to be used in the summary line. I used
> AB> `gnus-summary-show-raw-article' which did not seem to work. What is the
> AB> preferred way of doing this?
>
> Try `spam-get-article-as-string' in spam.el, which is used by spam
> backends that need the full article. But as others said, it may not
> work :)
>
This is it! The following works like a charm. It is designed to extract
the title of the video from a mail you get from youtube when someone you
are subscribed to uploads a new video.
#+BEGIN_SRC emacs-lisp
(defun gnus-user-format-function-Y (header)
"Returns the title of a youtube video."
(let ((body (spam-get-article-as-string (elt header 0))))
(string-match "\n.*just uploaded a video\n\\(.*\\)\nhttp:.*" body)
(match-string-no-properties 1 body)))
#+END_SRC
Thank you Ted, Steinar and Igor! :)
Regards,
--
Alexander Baier
next prev parent reply other threads:[~2014-10-31 13:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 8:29 Alexander Baier
2014-10-31 8:53 ` Igor Sosa Mayor
2014-10-31 9:57 ` Alexander Baier
2014-10-31 11:04 ` Steinar Bang
2014-10-31 11:43 ` Alexander Baier
2014-10-31 11:45 ` Igor Sosa Mayor
2014-10-31 11:50 ` Alexander Baier
2014-10-31 14:19 ` Eric Abrahamsen
2014-10-31 15:18 ` Alexander Baier
2014-10-31 15:29 ` Eric Abrahamsen
2014-10-31 12:55 ` Ted Zlatanov
2014-10-31 13:38 ` Alexander Baier [this message]
2014-10-31 14:01 ` Alexander Baier
2014-10-31 14:22 ` Peter Münster
2014-10-31 15:20 ` Alexander Baier
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=87ppd8gy0l.fsf@mailbox.org \
--to=alexander.baier@mailbox.org \
--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).