;; Use this function by: ;; (setq browse-url-browser-function 'browse-url-safari) (defun browse-url-safari (url &optional new-window) (interactive) (let ((osascript (executable-find "osascript")) (rc (concat "tell application \"Safari\"\n" "set doc to (the first document whose URL begins with \"file://%s\")\n" "try\n set URL of doc to \"%s\"\n on error\n" "make new document with properties {URL:\"%s\"}\n" "set bounds of front window to {0, 0, 500, 600}\n" "end try\nend tell"))) (start-process (concat "OS X default browser: " url) nil osascript (concat "-e " (format rc idlwave-html-help-location url url)))))