aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorGlenn Morris2014-05-11 23:59:30 -0700
committerGlenn Morris2014-05-11 23:59:30 -0700
commitbbbabffe06d4c763534d5be92844c48a3f8746e2 (patch)
treea6fffb13638948223f3142e5209cbce57282fbbd /lisp/net
parentffd6d9c4d321e93e301f9cafd1fe054389898978 (diff)
parent96b894717caa773aa6d98ff57385f1c7537e8972 (diff)
downloademacs-bbbabffe06d4c763534d5be92844c48a3f8746e2.tar.gz
emacs-bbbabffe06d4c763534d5be92844c48a3f8746e2.zip
Merge from emacs-24; up to 2014-05-12T06:15:47Z!rgm@gnu.org
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/browse-url.el41
1 files changed, 21 insertions, 20 deletions
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 4364490f431..33f4eda9604 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -1333,31 +1333,32 @@ used instead of `browse-url-new-window-flag'."
1333 (let ((pidfile (expand-file-name browse-url-mosaic-pidfile)) 1333 (let ((pidfile (expand-file-name browse-url-mosaic-pidfile))
1334 pid) 1334 pid)
1335 (if (file-readable-p pidfile) 1335 (if (file-readable-p pidfile)
1336 (save-excursion 1336 (with-temp-buffer
1337 (find-file pidfile) 1337 (insert-file-contents pidfile)
1338 (goto-char (point-min)) 1338 (setq pid (read (current-buffer)))))
1339 (setq pid (read (current-buffer))) 1339 (if (and (integerp pid) (zerop (signal-process pid 0))) ; Mosaic running
1340 (kill-buffer nil))) 1340 (progn
1341 (if (and pid (zerop (signal-process pid 0))) ; Mosaic running 1341 (with-temp-buffer
1342 (save-excursion 1342 (insert (if (browse-url-maybe-new-window new-window)
1343 ;; This is a predictable temp-file name, which is bad, 1343 "newwin\n"
1344 ;; but it is what Mosaic uses/used. 1344 "goto\n")
1345 ;; So it's not Emacs's problem. http://bugs.debian.org/747100 1345 url "\n")
1346 (find-file (format "/tmp/Mosaic.%d" pid)) 1346 (let ((umask (default-file-modes)))
1347 (erase-buffer) 1347 (unwind-protect
1348 (insert (if (browse-url-maybe-new-window new-window) 1348 (progn
1349 "newwin\n" 1349 (set-default-file-modes ?\700)
1350 "goto\n") 1350 (if (file-exists-p
1351 url "\n") 1351 (setq pidfile (format "/tmp/Mosaic.%d" pid)))
1352 (save-buffer) 1352 (delete-file pidfile))
1353 (kill-buffer nil) 1353 ;; http://debbugs.gnu.org/17428. Use O_EXCL.
1354 (write-region nil nil pidfile nil 'silent nil 'excl))
1355 (set-default-file-modes umask))))
1354 ;; Send signal SIGUSR to Mosaic 1356 ;; Send signal SIGUSR to Mosaic
1355 (message "Signaling Mosaic...") 1357 (message "Signaling Mosaic...")
1356 (signal-process pid 'SIGUSR1) 1358 (signal-process pid 'SIGUSR1)
1357 ;; Or you could try: 1359 ;; Or you could try:
1358 ;; (call-process "kill" nil 0 nil "-USR1" (int-to-string pid)) 1360 ;; (call-process "kill" nil 0 nil "-USR1" (int-to-string pid))
1359 (message "Signaling Mosaic...done") 1361 (message "Signaling Mosaic...done"))
1360 )
1361 ;; Mosaic not running - start it 1362 ;; Mosaic not running - start it
1362 (message "Starting %s..." browse-url-mosaic-program) 1363 (message "Starting %s..." browse-url-mosaic-program)
1363 (apply 'start-process "xmosaic" nil browse-url-mosaic-program 1364 (apply 'start-process "xmosaic" nil browse-url-mosaic-program