Configuring emacs/ilisp to work with w3

Bob Rogers <[email protected]>
Newsgroups gmane.lisp.ilisp.devel
Message-ID <[email protected]>
   From: Tiago Maduro-Dias <[email protected]>
   Date: 11 May 2003 16:11:48 +0100

   Hello,

   This isn't really a dev question but you'll probably be able to help me.
   I have emacs configured to work with mozilla:

   ;; browser configuration
   (setq browse-url-browser-function 'browse-url-netscape
	   browse-url-netscape-program "mozilla")

   It works perfectly.

   But afterwards I installed w3 and I'm having trouble figuring out
   exactly how to redirect the hyperspec apropos help thing to w3 instead
   of the configured browser.

   If anyone could show me how to configure it it would be very much
   obliged :).

   Thanks in advance,
   Tiago Maduro-Dias

Here's a truncated version of what I use; it also intercepts "mailto:"
URLs and handles those within emacs.  The Hyperspec code is new; it
doesn't quite work for me, because I still don't have w3 installed
correctly for Emacs 21.  Sigh.


					-- Bob

------------------------------------------------------------------------
(defun rgr-browse-url-netscape (url &optional new-window-p)
  ;; We're trying to add a "create browser on remote host if necessary" daemon
  ;; to the browse-url-netscape function.  We do this by encapsulating this
  ;; function (albeit clumsily).  [Now intercepts "mailto:" URLs so that they
  ;; can be handled within emacs.  -- rgr, 9-Apr-03.]
  (cond ((string-match "^mailto:" url)
	  ;; [bug: this doesn't handle e.g. "&subject=auto+reply" parameters,
	  ;; undoing urlencoding.  -- rgr, 8-Apr-03.]
	  (let ((address (substring url (match-end 0))))
	    ;; prefer vm if it's loaded (or autoloadable).
	    (if (fboundp 'vm-mail)
		(vm-mail address)
		(mail t address))))
	((and (boundp 'common-lisp-hyperspec-root)
	      (> (length url) (length common-lisp-hyperspec-root))
	      (string-equal
	        (substring url 0 (length common-lisp-hyperspec-root))
		common-lisp-hyperspec-root))
	  ;; this is e.g.
	  ;; "http://www.xanalys.com/software_tools/reference/HyperSpec/"
	  (w3-fetch url))
	(t
	  (browse-url-netscape url new-window-p))))

(setq browse-url-browser-function 'rgr-browse-url-netscape)


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.