From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/85205 Path: news.gmane.org!not-for-mail From: Alexander Baier Newsgroups: gmane.emacs.gnus.general Subject: Re: function to access raw article Date: Fri, 31 Oct 2014 14:38:18 +0100 Message-ID: <87ppd8gy0l.fsf@mailbox.org> References: <87fve4iqve.fsf@gmail.com> <87lhnwe6vl.fsf@lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1414762804 26210 80.91.229.3 (31 Oct 2014 13:40:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2014 13:40:04 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M33449@lists.math.uh.edu Fri Oct 31 14:39:57 2014 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XkCQm-0000l0-NK for ding-account@gmane.org; Fri, 31 Oct 2014 14:39:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1XkCPv-0003K1-Hb; Fri, 31 Oct 2014 08:39:03 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1XkCPt-0003Jq-Vq for ding@lists.math.uh.edu; Fri, 31 Oct 2014 08:39:01 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1XkCPr-0007He-3j for ding@lists.math.uh.edu; Fri, 31 Oct 2014 08:39:00 -0500 Original-Received: from mx2.mailbox.org ([80.241.60.215]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1XkCPl-0003Zq-1Q for ding@gnus.org; Fri, 31 Oct 2014 14:38:53 +0100 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id B04794025B for ; Fri, 31 Oct 2014 14:38:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-type:content-type:mime-version:user-agent:message-id :in-reply-to:date:date:references:subject:subject:from:from :received; s=mail20140220; t=1414762726; bh=9AUnyws9TiKdM2i2EDuL N5WRItJhOVzNZtF7+TaybMM=; b=cZFo/cedzYoJvH4NBlCx6OlomTLVst1brpx+ sU6ydOZkwzaDQ6mpWr5q0JX4TNlYVpCv4PrTG2bSkf6O47dqiWbDwD3nQbwK7na4 XXex301KqgzNdpFLNqjzJ1XLIn7wnM9wGTg2TiwGkZcn7BKkPfaFu/1XuXQtWk4Y K4OJ65WbKbTcHXhLOWcT9Bm4MOK2lTMfDx2WzVmIFyxsGrBjTtXp1PMTZWTMxxxr X/ry2YbMSmSMpsDI34pNYgClqva98UP47uikUj/j97VKnYmg9A2cXXa8tDt2jVOS mbFLharNK1NaEavqRFm9o9PaP/PSlJwGpiiDB7TZfyi60BsOcg5DV9O+aB8/+SXX rhoQ432P5oMmVrD7lc7gc6WsGIj2jJdvuC+6/xH2JFN0xLvZFPZW8p8EX+fpJcdY 5MOwxT4t/yZsCOp+EWS1iQ8RfDBKAUAoSfVJq9a9DEDhx/R6dSmiEEE3ary8Wewk hhmI8efsmSqOvviGonBluH9jKcOO3Sa9+G5gleZr+44teeymXjIzCD8RLuS0DsD1 +WWY2p3rqJ4e+kpFlmkHp4G/nzkGpCOFY6nxlike63b5C X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) (using TLS with cipher AES256-GCM-SHA384) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTPS id tyYP-weA_ADn for ; Fri, 31 Oct 2014 14:38:46 +0100 (CET) Mail-Followup-To: ding@gnus.org In-Reply-To: <87lhnwe6vl.fsf@lifelogs.com> (Ted Zlatanov's message of "Fri, 31 Oct 2014 08:55:10 -0400") User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.4 (gnu/linux) X-Spam-Score: -5.6 (-----) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:85205 Archived-At: On 2014-10-31 13:55 Ted Zlatanov wrote: > On Fri, 31 Oct 2014 09:29:41 +0100 Alexander Baier > 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