Gnus development mailing list
 help / color / mirror / Atom feed
From: Haider Rizvi <harizvi@gmail.com>
To: ding@gnus.org
Subject: Re: From Elisp: Do stuff with article at point
Date: Wed, 08 Jan 2014 12:22:53 -0500	[thread overview]
Message-ID: <m18uuq75hu.fsf@thinkhr.torolab.ibm.com> (raw)
In-Reply-To: <87eh4ie9pm.fsf@gmail.com>

Alexander Baier <lexi.baier@gmail.com> writes:

> I do not want to save the article to disk, I merely want to do some
> searching and copying in the buffer containing the article in
> question.  So I "just" need a fuction that gives me the buffer name
> or buffer object of the current article at point, so that I can use
> it with `with-current-buffer'.

Sounds like the following may help you. I have coded ';' to
my-gnus-browse in gnus-summary-mode-map, which is an overloaded
function as follows. For the various scenarios, it tries to build an
appropriate url from the article, and then browse-url it.

(defun my-gnus-browse (arg)
  (interactive "p")
  (cond ((string-match ":\\(gwene\\|gmane\\)\\." gnus-newsgroup-name)
         (hr/gnus-browse-archived-at))
        ((string-match "^nnrss\." gnus-newsgroup-name)
         (browse-nnrss-url arg))
        ((string-match "^w3Forums\\|CommunitiesCategory\\|MyForums" gnus-newsgroup-name)
         (hr/gnus-browse-messageid-ibmconnections))
        ((string-match "salpha" (mail-header-from gnus-current-headers))
         (hr/gnus-browse-said-salpha))
        ))

;; this came from the gnus manual, I believe
(defun browse-nnrss-url( arg )
  (interactive "p")
  (let ((url (assq nnrss-url-field
                   (mail-header-extra
                    (gnus-data-header
                     (assq (gnus-summary-article-number)
                           gnus-newsgroup-data))))))
    (if url
        (progn
          (browse-url (cdr url))
          (gnus-summary-mark-as-read-forward 1))
      (gnus-summary-scroll-up arg))))
(add-to-list 'nnmail-extra-headers nnrss-url-field)

(defun hr/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))))


Regards, 
-- 
Haider




  reply	other threads:[~2014-01-08 17:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 21:29 Alexander Baier
2014-01-08 15:16 ` Ted Zlatanov
2014-01-08 16:09   ` Alexander Baier
2014-01-08 17:22     ` Haider Rizvi [this message]
2014-01-08 21:13     ` Ted Zlatanov
2014-01-09 12:07       ` Alexander Baier
2014-01-08 20:59 ` Jan Tatarik

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=m18uuq75hu.fsf@thinkhr.torolab.ibm.com \
    --to=harizvi@gmail.com \
    --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).