From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/85207 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.gnus.general Subject: Re: function to access raw article Date: Fri, 31 Oct 2014 07:19:02 -0700 Message-ID: <877fzg2ug9.fsf@ericabrahamsen.net> References: <87fve4iqve.fsf@gmail.com> <87fve4fwnc.fsf@gmail.com> <8738a4imtt.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1414764894 28946 80.91.229.3 (31 Oct 2014 14:14:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2014 14:14:54 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M33451@lists.math.uh.edu Fri Oct 31 15:14:48 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 1XkCyT-0007dN-LP for ding-account@gmane.org; Fri, 31 Oct 2014 15:14:47 +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 1XkCxs-0003ZE-8V; Fri, 31 Oct 2014 09:14:08 -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 1XkCxq-0003Z1-GT for ding@lists.math.uh.edu; Fri, 31 Oct 2014 09:14:06 -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 1XkCxp-0007RL-8K for ding@lists.math.uh.edu; Fri, 31 Oct 2014 09:14:06 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1XkCxn-0004bM-AE for ding@gnus.org; Fri, 31 Oct 2014 15:14:03 +0100 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XkCxm-0007A7-Rn for ding@gnus.org; Fri, 31 Oct 2014 15:14:02 +0100 Original-Received: from c-76-28-195-250.hsd1.wa.comcast.net ([76.28.195.250]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Oct 2014 15:14:02 +0100 Original-Received: from eric by c-76-28-195-250.hsd1.wa.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Oct 2014 15:14:02 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-76-28-195-250.hsd1.wa.comcast.net User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:C0i/e0Nom+xx6WtL4PnIZICqvzs= X-Spam-Score: -3.5 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:85207 Archived-At: Alexander Baier writes: > On 2014-10-31 09:53 Igor Sosa Mayor wrote: >> Alexander Baier writes: >> >>> Hello, >>> >>> I want to access the raw (unwashed) version of an article from emacs >>> lisp to search for a regexp. I do this in order to extract information >>> from the body of the article to be used in the summary line. I used >>> `gnus-summary-show-raw-article' which did not seem to work. What is the >>> preferred way of doing this? >> >> I think gnus-summary-show-raw-article should work... >> >> But in any way, I don't think this is necessary to get the summary line >> (do you mean 'subject')? What do you want to achieve exactly? > > I have information in the body of the the article that I want to display > in the summary line. To do this, I wrote a function > gnus-user-format-function-Y that extracts said information from the > body. I then include %uY in my gnus-summary-line-format to include the > information in the summary line. My current function looks like this: > > #+BEGIN_SRC emacs-lisp > (defun gnus-user-format-function-Y (header) > "Returns the title of a youtube video." > (with-current-buffer gnus-article-buffer > (gnus-summary-show-raw-article) > (gnus-summary-select-article-buffer) > (goto-char (point-min)) > (search-forward-regexp "\n.*just uploaded a video\n\\(.*\\)\nhttp:.*") > (match-string-no-properties 1))) > #+END_SRC Try something like this: (when (buffer-live-p (get-buffer gnus-original-article-buffer)) (with-current-buffer gnus-original-article-buffer (goto-char (point-min)) ;;etc )) At any rate, I'm pretty sure you want to be using gnus-original-article-buffer. HTH, Eric