aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-01-27 02:40:00 +0000
committerRichard M. Stallman1997-01-27 02:40:00 +0000
commit75e9c107ee12a46b088644cf3dadef53eed8c9b8 (patch)
tree339f5ffaf2df6dd2bbca6ace84e74815ae8e6797
parentfd4bc671965a92e3e986a0f338771aa34a6c81e0 (diff)
downloademacs-75e9c107ee12a46b088644cf3dadef53eed8c9b8.tar.gz
emacs-75e9c107ee12a46b088644cf3dadef53eed8c9b8.zip
(jka-compr-error): Use with-current-buffer.
(jka-compr-call-process, jka-compr-file-local-copy) (jka-compr-write-region): Use with-current-buffer.
-rw-r--r--lisp/jka-compr.el58
1 files changed, 24 insertions, 34 deletions
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index ef1a25f591a..cc0a03a5491 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -206,20 +206,19 @@ based on the filename itself and `jka-compr-compression-info-list'."
206 206
207 (let ((errbuf (get-buffer-create " *jka-compr-error*")) 207 (let ((errbuf (get-buffer-create " *jka-compr-error*"))
208 (curbuf (current-buffer))) 208 (curbuf (current-buffer)))
209 (set-buffer errbuf) 209 (with-current-buffer errbuf
210 (widen) (erase-buffer) 210 (widen) (erase-buffer)
211 (insert (format "Error while executing \"%s %s < %s\"\n\n" 211 (insert (format "Error while executing \"%s %s < %s\"\n\n"
212 prog 212 prog
213 (mapconcat 'identity args " ") 213 (mapconcat 'identity args " ")
214 infile)) 214 infile))
215 215
216 (and errfile 216 (and errfile
217 (insert-file-contents errfile)) 217 (insert-file-contents errfile)))
218
219 (set-buffer curbuf)
220 (display-buffer errbuf)) 218 (display-buffer errbuf))
221 219
222 (signal 'compression-error (list "Opening input file" (format "error %s" message) infile))) 220 (signal 'compression-error
221 (list "Opening input file" (format "error %s" message) infile)))
223 222
224 223
225(defvar jka-compr-dd-program 224(defvar jka-compr-dd-program
@@ -305,11 +304,9 @@ to keep: LEN chars starting BEG chars from the beginning."
305 (jka-compr-error prog args infile message)) 304 (jka-compr-error prog args infile message))
306 305
307 (and (stringp output) 306 (and (stringp output)
308 (let ((cbuf (current-buffer))) 307 (with-current-buffer temp
309 (set-buffer temp)
310 (write-region (point-min) (point-max) output) 308 (write-region (point-min) (point-max) output)
311 (erase-buffer) 309 (erase-buffer)))))
312 (set-buffer cbuf)))))
313 310
314 311
315;;; Support for temp files. Much of this was inspired if not lifted 312;;; Support for temp files. Much of this was inspired if not lifted
@@ -381,13 +378,11 @@ There should be no more than seven characters after the final `/'")
381 (compress-args (jka-compr-info-compress-args info)) 378 (compress-args (jka-compr-info-compress-args info))
382 (uncompress-args (jka-compr-info-uncompress-args info)) 379 (uncompress-args (jka-compr-info-uncompress-args info))
383 (base-name (file-name-nondirectory visit-file)) 380 (base-name (file-name-nondirectory visit-file))
384 temp-file cbuf temp-buffer) 381 temp-file temp-buffer)
385 382
386 (setq cbuf (current-buffer) 383 (setq temp-buffer (get-buffer-create " *jka-compr-wr-temp*"))
387 temp-buffer (get-buffer-create " *jka-compr-wr-temp*")) 384 (with-current-buffer temp-buffer
388 (set-buffer temp-buffer) 385 (widen) (erase-buffer))
389 (widen) (erase-buffer)
390 (set-buffer cbuf)
391 386
392 (if (and append 387 (if (and append
393 (not can-append) 388 (not can-append)
@@ -415,13 +410,12 @@ There should be no more than seven characters after the final `/'")
415 nil 410 nil
416 compress-args) 411 compress-args)
417 412
418 (set-buffer temp-buffer) 413 (with-current-buffer temp-buffer
419 (jka-compr-run-real-handler 'write-region 414 (jka-compr-run-real-handler 'write-region
420 (list (point-min) (point-max) 415 (list (point-min) (point-max)
421 filename 416 filename
422 (and append can-append) 'dont)) 417 (and append can-append) 'dont))
423 (erase-buffer) 418 (erase-buffer))
424 (set-buffer cbuf)
425 419
426 (jka-compr-delete-temp-file temp-file) 420 (jka-compr-delete-temp-file temp-file)
427 421
@@ -586,20 +580,17 @@ There should be no more than seven characters after the final `/'")
586 (temp-file (jka-compr-make-temp-name t)) 580 (temp-file (jka-compr-make-temp-name t))
587 (temp-buffer (get-buffer-create " *jka-compr-flc-temp*")) 581 (temp-buffer (get-buffer-create " *jka-compr-flc-temp*"))
588 (notfound nil) 582 (notfound nil)
589 (cbuf (current-buffer))
590 local-file) 583 local-file)
591 584
592 (setq local-file (or local-copy filename)) 585 (setq local-file (or local-copy filename))
593 586
594 (unwind-protect 587 (unwind-protect
595 588
596 (progn 589 (with-current-buffer temp-buffer
597 590
598 (and 591 (and
599 uncompress-message 592 uncompress-message
600 (message "%s %s..." uncompress-message base-name)) 593 (message "%s %s..." uncompress-message base-name))
601
602 (set-buffer temp-buffer)
603 594
604 (jka-compr-call-process uncompress-program 595 (jka-compr-call-process uncompress-program
605 (concat uncompress-message 596 (concat uncompress-message
@@ -621,7 +612,6 @@ There should be no more than seven characters after the final `/'")
621 (file-exists-p local-copy) 612 (file-exists-p local-copy)
622 (delete-file local-copy)) 613 (delete-file local-copy))
623 614
624 (set-buffer cbuf)
625 (kill-buffer temp-buffer)) 615 (kill-buffer temp-buffer))
626 616
627 temp-file) 617 temp-file)