]> code.delx.au - gnu-emacs/blobdiff - lisp/net/browse-url.el
Update copyright year to 2015
[gnu-emacs] / lisp / net / browse-url.el
index 80dffb3fa4a8123017fb9fc9d7b9bd00460c1fb2..42fb954925547f9b99952bfd79ff2b0cf9793025 100644 (file)
@@ -1,6 +1,6 @@
 ;;; browse-url.el --- pass a URL to a WWW browser
 
-;; Copyright (C) 1995-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2015 Free Software Foundation, Inc.
 
 ;; Author: Denis Howe <dbh@doc.ic.ac.uk>
 ;; Maintainer: emacs-devel@gnu.org
@@ -807,15 +807,15 @@ first, if that exists."
   (interactive (browse-url-interactive-arg "URL: "))
   (unless (called-interactively-p 'interactive)
     (setq args (or args (list browse-url-new-window-flag))))
+  (when (and url-handler-mode (not (file-name-absolute-p url)))
+    (setq url (expand-file-name url)))
   (let ((process-environment (copy-sequence process-environment))
        (function (or (and (string-match "\\`mailto:" url)
                           browse-url-mailto-function)
                      browse-url-browser-function))
        ;; Ensure that `default-directory' exists and is readable (b#6077).
-       (default-directory (if (and (file-directory-p default-directory)
-                                   (file-readable-p default-directory))
-                              default-directory
-                            (expand-file-name "~/"))))
+       (default-directory (or (unhandled-file-name-directory default-directory)
+                              (expand-file-name "~/"))))
     ;; When connected to various displays, be careful to use the display of
     ;; the currently selected frame, rather than the original start display,
     ;; which may not even exist any more.
@@ -1343,10 +1343,12 @@ used instead of `browse-url-new-window-flag'."
                         "newwin\n"
                       "goto\n")
                     url "\n")
-            (if (file-exists-p (setq pidfile (format "/tmp/Mosaic.%d" pid)))
-                (delete-file pidfile))
-            ;; http://debbugs.gnu.org/17428.  Use O_EXCL.
-            (write-region nil nil pidfile nil 'silent nil 'excl))
+            (with-file-modes ?\700
+              (if (file-exists-p
+                   (setq pidfile (format "/tmp/Mosaic.%d" pid)))
+                  (delete-file pidfile))
+              ;; http://debbugs.gnu.org/17428.  Use O_EXCL.
+              (write-region nil nil pidfile nil 'silent nil 'excl)))
          ;; Send signal SIGUSR to Mosaic
          (message "Signaling Mosaic...")
          (signal-process pid 'SIGUSR1)