info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Browsing to original article in gwene?


From: Reiner Steib
Subject: Re: Browsing to original article in gwene?
Date: Mon, 08 Oct 2012 08:46:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

On Sun, Oct 07 2012, Toke Høiland-Jørgensen wrote:

> #+begin_src emacs-lisp
> (defun my-gnus-browse-gwene ()
> "Start a browser for current gwene article"

AFAIK, Archived-at is not specific to Gwene.

>   (interactive)
>   (dolist (buf (buffer-list))
>     (when (buffer-live-p buf)
>       (with-current-buffer buf
>         (when (eq major-mode 'gnus-article-mode)

This might get the wrong article if `gnus-single-article-buffer' is
nil.

>           (gnus-summary-show-article '(4))

Use `gnus-original-article-buffer' ...

>           (switch-to-buffer buf)

... and `with-current-buffer'.

>           (goto-char (point-min))
>           (when (re-search-forward "^Archived-at: <\\(.*\\)>$" (point-max) t)

There is `gnus-fetch-field'.

>             (browse-url (match-string 1)))
>           (gnus-summary-show-article))))))
> #+end_src

I'd suggest something like this:

#+begin_src emacs-lisp
(defun rs-gnus-browse-archived-at ()
  "Browse \"Archived-at\" URL of the current article."
  (interactive)
  (let (url)
    (with-current-buffer gnus-original-article-buffer
      (setq url (gnus-fetch-field "Archived-at")))
    (if (not (stringp url))
        (gnus-message 1 "No \"Archived-at\" header found.")
      (setq url (gnus-replace-in-string url "^<\\|>$" ""))
      (browse-url url))))
#+end_src

Probably it should be expanded to handle process marked articles etc.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]