Gnus development mailing list
 help / color / mirror / Atom feed
* insert a link to an article in gmane
@ 2016-05-07 16:02 Uwe Brauer
  2016-05-07 19:16 ` Sebastian Christ
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2016-05-07 16:02 UTC (permalink / raw)
  To: ding

Hello

Sometimes I see that people insert references to message of a newsgroups
in form of clickable links (I presume they use Emacs/gnus).

Which function/package provide such a functionality??

I tried out org-insert-line (using also org-gnus.el) and had set
org-gnus-prefer-web-links either to t or to nil.

It did not work. I googled but did not find a solution (maybe I did not
search for the correct search string).

thanks

Uwe Brauer 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: insert a link to an article in gmane
  2016-05-07 16:02 insert a link to an article in gmane Uwe Brauer
@ 2016-05-07 19:16 ` Sebastian Christ
  2016-05-07 19:46   ` Uwe Brauer
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Christ @ 2016-05-07 19:16 UTC (permalink / raw)
  To: ding

On 2016-05-07 16:2, Uwe Brauer <oub@mat.ucm.es> wrote:
 > 
 > Hello
 > Sometimes I see that people insert references to message of a newsgroups
 > in form of clickable links (I presume they use Emacs/gnus).
 > 
 > Which function/package provide such a functionality??
 > 
 > I tried out org-insert-line (using also org-gnus.el) and had set
 > org-gnus-prefer-web-links either to t or to nil.
 > 
 > It did not work. I googled but did not find a solution (maybe I did not
 > search for the correct search string).
 > 
 > thanks
 > 
 > Uwe Brauer 
 > 
 > 

Hi Uwe,

for Gmane I've written a function to first copy and the insert the
'Archived-At' header of the message I want to link.

Regards,
Sebastian

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: insert a link to an article in gmane
  2016-05-07 19:16 ` Sebastian Christ
@ 2016-05-07 19:46   ` Uwe Brauer
  2016-05-07 20:40     ` Sebastian Christ
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Brauer @ 2016-05-07 19:46 UTC (permalink / raw)
  To: ding


   > On 2016-05-07 16:2, Uwe Brauer <oub@mat.ucm.es> wrote:

   > Hi Uwe,

   > for Gmane I've written a function to first copy and the insert the
   > 'Archived-At' header of the message I want to link.

Could you send me this function, please? thanks

Uwe 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: insert a link to an article in gmane
  2016-05-07 19:46   ` Uwe Brauer
@ 2016-05-07 20:40     ` Sebastian Christ
  2016-05-07 21:28       ` Uwe Brauer
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Christ @ 2016-05-07 20:40 UTC (permalink / raw)
  To: ding

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: insert a link to an article in gmane
  2016-05-07 20:40     ` Sebastian Christ
@ 2016-05-07 21:28       ` Uwe Brauer
  0 siblings, 0 replies; 5+ messages in thread
From: Uwe Brauer @ 2016-05-07 21:28 UTC (permalink / raw)
  To: ding

>>> "Sebastian" == Sebastian Christ <rudolfo.christ@gmail.com> writes:

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

Thanks, it works.

Meanwhile I found the following in

https://gist.githubusercontent.com/gnusosa/b4800ca313e862def12f/raw/2136a51e0ad61a1cb9b12cf7d7910f7d2b68b67b/gnus-gmane-link.el


I modified however his function to copy the result into the ring not
calling a browser.

(defun gnus-gmane-link ()
  "Grabs the article name and generates a url found in Gmane. 
  If successful, sends it to the local web browser."
  (interactive)
  (let ((url
         (with-current-buffer gnus-article-buffer
           (let ((msgids (split-string (aref gnus-current-headers 8) "[ :]")))
             (cond ((and (equal (substring (second msgids) 0 6)
                              "gwene.")
                       (goto-char (point-max))
                       (search-backward "Link" (point-min) 'noerror))
                    (shr-copy-url)
                    (current-kill 0))
                   ((equal (substring (second msgids) 0 6)
                           "gmane.")
                    (concat "http://comments.gmane.org/" (second msgids) "/" (third msgids))))))))
    (if url
	(progn
	  (kill-new url)
	  (message "Url is now the kill ring: Use Kill-browse-ring"))
      (message "Couldn't find any likely url"))))




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-07 21:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-07 16:02 insert a link to an article in gmane Uwe Brauer
2016-05-07 19:16 ` Sebastian Christ
2016-05-07 19:46   ` Uwe Brauer
2016-05-07 20:40     ` Sebastian Christ
2016-05-07 21:28       ` Uwe Brauer

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).