help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] w32-shell-execute for IE?


From: David J. Biesack
Subject: Re: [h-e-w] w32-shell-execute for IE?
Date: Wed, 10 Aug 2005 10:51:58 -0400 (EDT)

> Date: Wed, 10 Aug 2005 10:34:11 -0400
> From: Chris McMahan <address@hidden>
> Cc: address@hidden
> 
> I'm in the same boat as you. I've been using the Firefox extension
> IEView, which reroutes specified pages into IE.
> 
> An elisp solution would be very nice. You might look at a package
> called WebJump to modify. ...

webjump does not match what I need, which is primarily using goto-url to 
highlight URL's in RMAIL
or other text -- click on them to invoke browse-url . I also have an 
"autobrowse" function which
runs when I copy a URL within a buffer (when goto-url is not active). 
autobrowse prompts me
if I want to view the URL via browse-url (or does so without prompting, if 
configured).
I'm trying to choose the appropriate browser based on the URL patterns.

Here is the rough draft I have so far. (The URL patterns are for our intranet 
sites, so
they won't apply elsewhere...)

(defun browse-url-with-selected-browser (url &optional new-window)
 "Invoke the shell-execute-helper program to call ShellExecute and launch
or re-direct a web browser on the specified url. However if URL's match
patterns in browse-url-special-browsers, use the associated browse function
instead."
   (interactive "sURL: ")
   (let (browser (patterns browse-url-special-browsers))
     (while (and patterns (not browser))
       (if (string-match (caar patterns) url)
           (setq browser (cdar patterns)))
       (setq patterns (cdr patterns)))
     (if browser
         (funcall browser url)
       (browse-url-shellex url))
     )
)

(defvar browse-url-special-browsers
  
'(("\\(itswss.na.sas.com\\|rdwss.na.sas.com\\|batman.na.sas.com\\|download.na.sas.com\\|misapps.na.sas.com/apps/PTE\\)"
 . browse-url-ie))
  "A list of pairs which indicate URL's which should be browsed via custom 
browsers rather than
the default browse function.")

(defun browse-url-shellex (url &optional new-window)
 "Use the Windows shell to invoke the default web browser on the specified url."
   (interactive "sURL: ")
   (w32-shell-execute "open" url))

(defvar win32-internet-explorer "C:\\Program Files\\Internet 
Explorer\\IEXPLORE.EXE"
  "*Location of Internet Explorer")

(defun browse-url-ie (url) ;; (browse-url-ie "http://www.sas.com";)
  "Browse a URL with Internet Explorer"
  (start-process "Internet Explorer" nil win32-internet-explorer url))

(setq browse-url-browser-function 'browse-url-with-selected-browser)
 
> - Chris
> 
> David J. Biesack writes:
> >
> >I'm extending the browse-url function I use so that it can select a specific 
> >browser
> >to use based on the URL. (While I prefer Firefox, unfortunately there are 
> >many sites
> >which use IE specific features or incorrect HTML which renders OK in IE but 
> >not
> >in Firefox.)


-- 
David J. Biesack     SAS Institute Inc.
(919) 531-7771       SAS Campus Drive
http://www.sas.com   Cary, NC 27513





reply via email to

[Prev in Thread] Current Thread [Next in Thread]