From: Kevin Brubeck Unhammer <unhammer@fsfe.org>
To: info-gnus-english@gnu.org
Subject: Re: Browsing to original article in gwene?
Date: Mon, 08 Oct 2012 10:13:48 +0200 [thread overview]
Message-ID: <87mwzxjs8z.fsf@fsfe.org> (raw)
In-Reply-To: <87fw5qj8o8.fsf@toke.dk>
[-- Attachment #1.1: Type: text/plain, Size: 1764 bytes --]
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
[-- Attachment #1.2: Type: application/pgp-signature, Size: 489 bytes --]
[-- Attachment #2: Type: text/plain, Size: 162 bytes --]
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
next prev parent reply other threads:[~2012-10-08 8:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 2:05 Haider Rizvi
2012-10-05 4:25 ` William Gardella
2012-10-05 4:32 ` William Gardella
2012-10-05 13:25 ` Memnon Anon
2012-10-05 15:06 ` Haider Rizvi
2012-10-07 21:04 ` Toke Høiland-Jørgensen
2012-10-08 6:46 ` Reiner Steib
2012-10-08 16:10 ` Haider Rizvi
2012-10-08 17:07 ` Haider Rizvi
2012-10-08 19:11 ` Reiner Steib
2012-10-08 8:13 ` Kevin Brubeck Unhammer [this message]
2012-10-08 8:39 ` Kevin Brubeck Unhammer
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=87mwzxjs8z.fsf@fsfe.org \
--to=unhammer@fsfe.org \
--cc=info-gnus-english@gnu.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).