[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: browse-url and "non-webish" URLs
From: |
Stefan Monnier |
Subject: |
Re: browse-url and "non-webish" URLs |
Date: |
Wed, 22 Aug 2007 14:39:35 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
>> I haven't had time to look into it yet, but I'd like to see the
>> following in browse-url: if the URL refers to a "text file" then use
>> url-insert-file-contents (or if url-handler-mode is ON, just use
>> find-file-other-window).
> Like
> (require 'url-handlers)
> (defun browse-url-emacs (url &optional new-window)
> (let ((file-name-handler-alist
> (cons (cons url-handler-regexp 'url-file-handler)
> file-name-handler-alist)))
> (if new-window
> (find-file-other-window url)
> (find-file url))))
> (setq browse-url-browser-function
> '(("\\.el\\'" . browse-url-emacs)
> ("." . browse-url-firefox)))
> (browse-url
> "http://www.emacswiki.org/cgi-bin/emacs/download/eight-puzzle.el")
Wonderful. I hadn't noticed that browse-url-browser-function can be an
alist of regexp->functions. How 'bout making it the default?
Stefan