diff options
| author | Gerd Moellmann | 2001-08-24 09:40:22 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-08-24 09:40:22 +0000 |
| commit | a59aecc5342544826f42765252eb421a274f32f3 (patch) | |
| tree | 0eacd8ea5d80ca26658b153c98b8cc6350e9f565 | |
| parent | 3ec6401d7b9b4ca4e27c7365603e2b667f651fb1 (diff) | |
| download | emacs-a59aecc5342544826f42765252eb421a274f32f3.tar.gz emacs-a59aecc5342544826f42765252eb421a274f32f3.zip | |
(gs-load-image): Wait for GHOSTVIEW window property
being reset by Ghostscript. Don't kill the gs process.
From David.Kastrup@neuroinformatik.ruhr-uni-bochum.de.
| -rw-r--r-- | lisp/gs.el | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lisp/gs.el b/lisp/gs.el index 7f5aaadc2a8..19d463de4ec 100644 --- a/lisp/gs.el +++ b/lisp/gs.el | |||
| @@ -153,15 +153,21 @@ the form \"WINDOW-ID PIXMAP-ID\". Value is non-nil if successful." | |||
| 153 | (unwind-protect | 153 | (unwind-protect |
| 154 | (let ((file (plist-get (cdr spec) :file)) | 154 | (let ((file (plist-get (cdr spec) :file)) |
| 155 | gs | 155 | gs |
| 156 | (waiting 0)) | 156 | (timeout 10)) |
| 157 | ;; If another ghostscript is running, wait for it to complete. | 157 | ;; Wait while property gets freed from a previous ghostscript |
| 158 | ;; Two ghostscript processes running at the same time would | 158 | ;; process |
| 159 | ;; use the same window properties, and get confused. | 159 | (while (and (not (zerop (length (x-window-property "GHOSTVIEW" |
| 160 | (while (and (process-status "gs") (< waiting 10)) | 160 | frame)))) |
| 161 | (not (zerop timeout))) | ||
| 161 | (sit-for 0 100 t) | 162 | (sit-for 0 100 t) |
| 162 | (setq waiting (1+ waiting))) | 163 | (setq timeout (1- timeout))) |
| 163 | (when (process-status "gs") | 164 | ;; No use waiting longer. We might want to try killing off |
| 164 | (kill-process "gs")) | 165 | ;; stuck processes, but there is no point in doing so: either |
| 166 | ;; they are stuck for good, in which case the user would | ||
| 167 | ;; probably be responsible for that, and killing them off will | ||
| 168 | ;; make debugging harder, or they are not. In that case, they | ||
| 169 | ;; will cause incomplete displays. But the same will happen | ||
| 170 | ;; if they are killed, anyway. | ||
| 165 | (gs-set-ghostview-window-prop frame spec img-width img-height) | 171 | (gs-set-ghostview-window-prop frame spec img-width img-height) |
| 166 | (gs-set-ghostview-colors-window-prop frame pixel-colors) | 172 | (gs-set-ghostview-colors-window-prop frame pixel-colors) |
| 167 | (setenv "GHOSTVIEW" window-and-pixmap-id) | 173 | (setenv "GHOSTVIEW" window-and-pixmap-id) |