Gnus development mailing list
 help / color / mirror / Atom feed
From: Sebastian Christ <rudolfo.christ@gmail.com>
To: ding@gnus.org
Subject: Re: insert a link to an article in gmane
Date: Sat, 07 May 2016 22:40:47 +0200	[thread overview]
Message-ID: <m2eg9deh4g.fsf@gmail.com> (raw)
In-Reply-To: <874ma9y7l7.fsf@mat.ucm.es>

On 2016-05-07 19:46, Uwe Brauer <oub@mat.ucm.es> wrote:
 > Could you send me this function, please? thanks

(defun fyi-article-get-header (header &optional skip-bounds)
  "Return HEADER of article in the current `gnus-article-buffer'.

If SKIP-BOUNDS is non-nil, skip the first and the last character from the header
value. This is useful if you want to omit some '<' and '>' that some headers
have (e.g. Message-ID)."
  (gnus-summary-verbose-headers 1)
  (prog1
      (with-current-buffer gnus-article-buffer
        (let ((nnmail-extra-headers (cons header
                                          nnmail-extra-headers)))
          (let ((header-value (cdr (assoc header
                                          (mail-header-extra (nnheader-parse-head t))))))
            (when header-value
              (apply #'substring-no-properties
                     header-value
                     (when skip-bounds
                       (list 1 -1)))))))
    (gnus-summary-verbose-headers -1)))

(defun fyi-article-archived-at ()
  "Return archived-at header of article in the current `gnus-article-buffer'."
  (fyi-article-get-header 'Archived-at t))

(defvar fyi-last-gmane-message-link nil)

(defun fyi-copy-gmane-link ()
  (interactive)
  (setq fyi-last-gmane-message-link (fyi-article-archived-at)))

(defun fyi-insert-gmane-link ()
  (interactive)
  (insert fyi-last-gmane-message-link))

But beware. This is very hacky and not really tested. It works, but can
sure easily break I guess. So use with caution.

Regards,
Sebastian 


-- 
Sebastian (Rudolfo) Christ
http://rudolfochrist.github.io
GPG Fingerprint: 306D 8FD3 DFB6 4E44 5061
                 CE71 6407 D6F8 2AC5 55DD




  reply	other threads:[~2016-05-07 20:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-07 16:02 Uwe Brauer
2016-05-07 19:16 ` Sebastian Christ
2016-05-07 19:46   ` Uwe Brauer
2016-05-07 20:40     ` Sebastian Christ [this message]
2016-05-07 21:28       ` Uwe Brauer

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=m2eg9deh4g.fsf@gmail.com \
    --to=rudolfo.christ@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).