[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Browsing to original article in gwene?
From: |
Kevin Brubeck Unhammer |
Subject: |
Re: Browsing to original article in gwene? |
Date: |
Mon, 08 Oct 2012 10:13:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Toke Høiland-Jørgensen <toke@toke.dk> writes:
> Memnon Anon <gegendosenfleisch@googlemail.com> writes:
>
>> Something like this?
>
> I modified that function a tiny bit to make sure it doesn't throw an
> error if an invalid buffer shows up in the list, and so it doesn't leave
> the article unformatted if it can't find the archive-at header. It now
> looks like this:
[…]
Note that gnus has this handy macro `gnus-with-article-buffer' that lets
you do away with the whole buffer-list loop:
#+begin_src emacs-lisp
(defun my-gnus-browse-gwene ()
"Start a browser for current gwene article"
(interactive)
(gnus-summary-show-article '(4))
(let ((url
(gnus-with-article-buffer
(goto-char (point-min))
(when (re-search-forward "^Archived-at: <\\(.*\\)>$" (point-max)
'noerror)
(match-string 1)))))
(gnus-summary-show-article)
(if url
(browse-url url)
(message "Couldn't find any likely url"))))
#+end_src
Of course, if gnus had an even handier macro like
#+begin_src emacs-lisp
(defmacro gnus-with-raw-article-buffer (&rest forms)
`(progn
(gnus-summary-show-article '(4))
(prog1 (gnus-with-article-buffer ,@forms)
(gnus-summary-show-article))))
#+end_src
then you could simplify that even further to
#+begin_src emacs-lisp
(defun my-gnus-browse-gwene ()
"Start a browser for current gwene article"
(interactive)
(let ((url
(gnus-with-raw-article-buffer
(goto-char (point-min))
(when (re-search-forward "^Archived-at: <\\(.*\\)>$" (point-max)
'noerror)
(match-string 1)))))
(if url
(browse-url url)
(message "Couldn't find any likely url"))))
#+end_src
--
Kevin Brubeck Unhammer
GPG: 0x766AC60C
pgpbd_gyqvLtE.pgp
Description: PGP signature
- Browsing to original article in gwene?, Haider Rizvi, 2012/10/04
- Re: Browsing to original article in gwene?, William Gardella, 2012/10/05
- Re: Browsing to original article in gwene?, William Gardella, 2012/10/05
- Re: Browsing to original article in gwene?, Memnon Anon, 2012/10/05
- Re: Browsing to original article in gwene?, Haider Rizvi, 2012/10/05
- Re: Browsing to original article in gwene?, Toke Høiland-Jørgensen, 2012/10/07
- Re: Browsing to original article in gwene?, Reiner Steib, 2012/10/08
- Re: Browsing to original article in gwene?, Haider Rizvi, 2012/10/08
- Re: Browsing to original article in gwene?, Haider Rizvi, 2012/10/08
- Re: Browsing to original article in gwene?, Reiner Steib, 2012/10/08
- Re: Browsing to original article in gwene?,
Kevin Brubeck Unhammer <=
- Re: Browsing to original article in gwene?, Kevin Brubeck Unhammer, 2012/10/08