From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: ding@gnus.org
Subject: Re: function to access raw article
Date: Fri, 31 Oct 2014 08:29:28 -0700 [thread overview]
Message-ID: <87ioj01cmf.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <878ujwgtd7.fsf@mailbox.org>
Alexander Baier <alexander.baier@mailbox.org> writes:
> On 2014-10-31 15:19 Eric Abrahamsen wrote:
>> Alexander Baier <alexander.baier@mailbox.org> writes:
>>
>>> On 2014-10-31 09:53 Igor Sosa Mayor wrote:
>>>> Alexander Baier <alexander.baier@mailbox.org> 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...
next prev parent reply other threads:[~2014-10-31 15:29 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 [this message]
2014-10-31 12:55 ` Ted Zlatanov
2014-10-31 13:38 ` Alexander Baier
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=87ioj01cmf.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).