From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/15877 Path: news.gmane.org!not-for-mail From: Kevin Brubeck Unhammer Newsgroups: gmane.emacs.gnus.user Subject: Re: Browsing to original article in gwene? Date: Mon, 08 Oct 2012 10:13:48 +0200 Message-ID: <87mwzxjs8z.fsf@fsfe.org> References: <87r4pdsfyh.fsf@gmail.com> <87ipapt5mg.fsf@mean.albasani.net> <87fw5qj8o8.fsf@toke.dk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1323163903463347095==" X-Trace: ger.gmane.org 1349684099 13302 80.91.229.3 (8 Oct 2012 08:14:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Oct 2012 08:14:59 +0000 (UTC) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Mon Oct 08 10:15:06 2012 Return-path: Envelope-to: gegu-info-gnus-english@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TL8UT-0000Kh-SM for gegu-info-gnus-english@m.gmane.org; Mon, 08 Oct 2012 10:15:05 +0200 Original-Received: from localhost ([::1]:33701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL8UN-0003Ss-Mq for gegu-info-gnus-english@m.gmane.org; Mon, 08 Oct 2012 04:14:59 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL8UL-0003S9-87 for info-gnus-english@gnu.org; Mon, 08 Oct 2012 04:14:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TL8UF-0005Jj-Ei for info-gnus-english@gnu.org; Mon, 08 Oct 2012 04:14:57 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:56596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TL8UF-0005Je-81 for info-gnus-english@gnu.org; Mon, 08 Oct 2012 04:14:51 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TL8UI-0000Gp-LU for info-gnus-english@gnu.org; Mon, 08 Oct 2012 10:14:54 +0200 Original-Received: from cde31bf51.dhcp.as2116.net ([81.191.49.222]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 08 Oct 2012 10:14:54 +0200 Original-Received: from unhammer by cde31bf51.dhcp.as2116.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 08 Oct 2012 10:14:54 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 87 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: cde31bf51.dhcp.as2116.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:VUzD9/hY+sidO6mTgstqCPPtJu4= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Original-Sender: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.gnus.user:15877 Archived-At: --===============1323163903463347095== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Toke H=C3=B8iland-J=C3=B8rgensen writes: > Memnon Anon 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: [=E2=80=A6] 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) 'noerr= or) (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=20 #+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) 'noerr= or) (match-string 1))))) (if url (browse-url url) (message "Couldn't find any likely url")))) #+end_src =2D-=20 Kevin Brubeck Unhammer GPG: 0x766AC60C --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJQcos8AAoJEHQmBt52asYMzroIAMrcl4WivnH1BXMFHSdf5dux CwiSSXZ5TU4t3rcD1BJb5tIOl7Ifc2dufA10nFx2JvHNz9mdXE4CJlIEOOuC9FDW uSHdrESZQAELfPMsmLcYj9Ild19pnnxlFHmVnSpZkuhvUILGb+FaXOs/H/Q1cMpd rhOcXSp1NqwEKz71vAtqXAx5U52i+Za7jivClvomhUEYbd8hoyDD+t8yitwxVDzv JvTTBJ/GIsEYuHPHCu9r4PcyLyrbv6c0DWKlPAHN4PBv0jY/LUjvDZNZo8468/yM uaEQkDysR5SWg8s7ikcKMtT5MUtiulva2jiulMcBMK0m0DWH6KOq/BCit/EitHs= =0x/x -----END PGP SIGNATURE----- --=-=-=-- --===============1323163903463347095== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english --===============1323163903463347095==--