Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Using a script to diplay web links
@ 2005-10-01  9:37 David Sumbler
  2005-10-02 13:33 ` Reiner Steib
  0 siblings, 1 reply; 4+ messages in thread
From: David Sumbler @ 2005-10-01  9:37 UTC (permalink / raw)


I use Gnus on a virtual console under Linux.  I have
(setq mm-text-html-renderer 'w3m) in my .gnus file.  The display of
HTML emails is fine.  The problem I have is with links contained in
some emails.

I have a bash script which takes a URL as a parameter and displays the
relevant page in a new tab in Firefox.  I want this to be used if I
decide to follow a link in an email.

I have looked at various sections of the Gnus Manual, but can't seem
to find how to do this, although I'm sure it is probably a simple
addition to the .gnus file.

I'd be grateful if someone can tell me how to do this, or how to find
out.

David

-- 

David Sumbler

Please reply with a followup to the newsgroup.

However, if you _really_ want to send me an e-mail,
replace "nospam" in my address with "aeolia".


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

* Re: Using a script to diplay web links
  2005-10-01  9:37 Using a script to diplay web links David Sumbler
@ 2005-10-02 13:33 ` Reiner Steib
  2005-10-02 19:00   ` David Sumbler
  0 siblings, 1 reply; 4+ messages in thread
From: Reiner Steib @ 2005-10-02 13:33 UTC (permalink / raw)


On Sat, Oct 01 2005, David Sumbler wrote:

> I use Gnus on a virtual console under Linux.  I have
> (setq mm-text-html-renderer 'w3m) in my .gnus file.  The display of
> HTML emails is fine.  The problem I have is with links contained in
> some emails.
>
> I have a bash script which takes a URL as a parameter and displays the
> relevant page in a new tab in Firefox.  I want this to be used if I
> decide to follow a link in an email.

(setq browse-url-generic-program "xsel.sh" ;; replace with your script
      browse-url-browser-function 'browse-url-generic)

(defun rs-w3m-view-this-url ()
  "View the URL of the link under point.
Use `browse-url' when in a Gnus article buffer, else use
`w3m-safe-view-this-url'."
  (interactive)
  (if (string-equal gnus-article-buffer (buffer-name))
      (let ((url (w3m-url-valid (w3m-anchor))))
	(if url
	    (browse-url url)
	  (w3m-message "No URL at point")))
    (w3m-safe-view-this-url)))
;; Map it to RET and/or <right>:
(define-key w3m-minor-mode-map (kbd "RET")     'rs-w3m-view-this-url)
(define-key w3m-minor-mode-map (kbd "<right>") 'rs-w3m-view-this-url)

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


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

* Re: Using a script to diplay web links
  2005-10-02 13:33 ` Reiner Steib
@ 2005-10-02 19:00   ` David Sumbler
  2005-10-03 21:20     ` Reiner Steib
  0 siblings, 1 reply; 4+ messages in thread
From: David Sumbler @ 2005-10-02 19:00 UTC (permalink / raw)


Reiner Steib <reinersteib+from-uce@imap.cc> writes:

> On Sat, Oct 01 2005, David Sumbler wrote:
>
>> I use Gnus on a virtual console under Linux.  I have
>> (setq mm-text-html-renderer 'w3m) in my .gnus file.  The display of
>> HTML emails is fine.  The problem I have is with links contained in
>> some emails.
>>
>> I have a bash script which takes a URL as a parameter and displays the
>> relevant page in a new tab in Firefox.  I want this to be used if I
>> decide to follow a link in an email.
>
> (setq browse-url-generic-program "xsel.sh" ;; replace with your script
>       browse-url-browser-function 'browse-url-generic)
>
> (defun rs-w3m-view-this-url ()
>   "View the URL of the link under point.
> Use `browse-url' when in a Gnus article buffer, else use
> `w3m-safe-view-this-url'."
>   (interactive)
>   (if (string-equal gnus-article-buffer (buffer-name))
>       (let ((url (w3m-url-valid (w3m-anchor))))
> 	(if url
> 	    (browse-url url)
> 	  (w3m-message "No URL at point")))
>     (w3m-safe-view-this-url)))
> ;; Map it to RET and/or <right>:
> (define-key w3m-minor-mode-map (kbd "RET")     'rs-w3m-view-this-url)
> (define-key w3m-minor-mode-map (kbd "<right>") 'rs-w3m-view-this-url)

Thanks - seems to work like a dream!

David

-- 

David Sumbler

Please reply with a followup to the newsgroup.

However, if you _really_ want to send me an e-mail,
replace "nospam" in my address with "aeolia".


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

* Re: Using a script to diplay web links
  2005-10-02 19:00   ` David Sumbler
@ 2005-10-03 21:20     ` Reiner Steib
  0 siblings, 0 replies; 4+ messages in thread
From: Reiner Steib @ 2005-10-03 21:20 UTC (permalink / raw)


On Sun, Oct 02 2005, David Sumbler wrote:

> Reiner Steib <reinersteib+from-uce@imap.cc> writes:
>> (defun rs-w3m-view-this-url ()
[...]
>> (define-key w3m-minor-mode-map (kbd "RET")     'rs-w3m-view-this-url)
>> (define-key w3m-minor-mode-map (kbd "<right>") 'rs-w3m-view-this-url)
>
> Thanks - seems to work like a dream!

On a second thought, the following seems to be more simple and cleaner
(you need to remove the previous code):

--8<---------------cut here---------------start------------->8---
(setq browse-url-generic-program "xsel.sh" ;; replace with your script
      browse-url-browser-function 'browse-url-generic)

(add-hook 'gnus-article-mode-hook
	  (lambda ()
	    (set (make-local-variable 'w3m-goto-article-function)
		 'browse-url)))
--8<---------------cut here---------------end--------------->8---

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


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

end of thread, other threads:[~2005-10-03 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-01  9:37 Using a script to diplay web links David Sumbler
2005-10-02 13:33 ` Reiner Steib
2005-10-02 19:00   ` David Sumbler
2005-10-03 21:20     ` Reiner Steib

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