From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/85211 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 08:29:28 -0700 Message-ID: <87ioj01cmf.fsf@ericabrahamsen.net> References: <87fve4iqve.fsf@gmail.com> <87fve4fwnc.fsf@gmail.com> <8738a4imtt.fsf@gmail.com> <877fzg2ug9.fsf@ericabrahamsen.net> <878ujwgtd7.fsf@mailbox.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1414769088 4709 80.91.229.3 (31 Oct 2014 15:24:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2014 15:24:48 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M33455@lists.math.uh.edu Fri Oct 31 16:24:41 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 1XkE45-00028k-Qs for ding-account@gmane.org; Fri, 31 Oct 2014 16:24:39 +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 1XkE42-000420-TP; Fri, 31 Oct 2014 10:24:34 -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 1XkE41-00041k-J0 for ding@lists.math.uh.edu; Fri, 31 Oct 2014 10:24:33 -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 1XkE40-0007rV-Bj for ding@lists.math.uh.edu; Fri, 31 Oct 2014 10:24:33 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1XkE3y-0006jA-AF for ding@gnus.org; Fri, 31 Oct 2014 16:24:30 +0100 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XkE3y-00021w-6B for ding@gnus.org; Fri, 31 Oct 2014 16:24:30 +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 16:24:30 +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 16:24:30 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 52 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:OOieUnDa+d/arftWwRvbR2jTi3Q= X-Spam-Score: -3.5 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:85211 Archived-At: Alexander Baier writes: > On 2014-10-31 15:19 Eric Abrahamsen wrote: >> 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. > > I tried that and the buffer is never live. Ah, I wasn't sure if that would be the case. Good to know, I guess...