comparison lisp/packages/jka-compr.el @ 86:364816949b59 r20-0b93

Import from CVS: tag r20-0b93
author cvs
date Mon, 13 Aug 2007 09:09:02 +0200
parents 131b0175ea99
children fe104dbd9147
comparison
equal deleted inserted replaced
85:c661705957e0 86:364816949b59
63 63
64 64
65 ;; APPLICATION NOTES: 65 ;; APPLICATION NOTES:
66 ;; 66 ;;
67 ;; crypt++ 67 ;; crypt++
68 ;; jka-compr can coexist with crpyt++ if you take all the decompression 68 ;; jka-compr can coexist with crypt++ if you take all the decompression
69 ;; entries out of the crypt-encoding-list. Clearly problems will arise if 69 ;; entries out of the crypt-encoding-list. Clearly problems will arise if
70 ;; you have two programs trying to compress/decompress files. jka-compr 70 ;; you have two programs trying to compress/decompress files. jka-compr
71 ;; will not "work with" crypt++ in the following sense: you won't be able to 71 ;; will not "work with" crypt++ in the following sense: you won't be able to
72 ;; decode encrypted compressed files--that is, files that have been 72 ;; decode encrypted compressed files--that is, files that have been
73 ;; compressed then encrypted (in that order). Theoretically, crypt++ and 73 ;; compressed then encrypted (in that order). Theoretically, crypt++ and
364 364
365 (condition-case () 365 (condition-case ()
366 (delete-file temp) 366 (delete-file temp)
367 (error nil))) 367 (error nil)))
368 368
369 369 ;;; 20.0-b92 change
370 (defun jka-compr-write-region (start end file &optional append visit) 370 ;;; Now receives both `lockname' and `codesys' from Fwrite_region_internal
371 ;;; what makes it compatible with write-region
372 (defun jka-compr-write-region (start end file &optional append visit lockname coding-system)
371 (let* ((filename (expand-file-name file)) 373 (let* ((filename (expand-file-name file))
372 (visit-file (if (stringp visit) (expand-file-name visit) filename)) 374 (visit-file (if (stringp visit) (expand-file-name visit) filename))
373 (info (jka-compr-get-compression-info visit-file))) 375 (info (jka-compr-get-compression-info visit-file)))
374 376
375 (if info 377 (if info
404 (and 406 (and
405 compress-message 407 compress-message
406 (message "%s %s..." compress-message base-name)) 408 (message "%s %s..." compress-message base-name))
407 409
408 (jka-compr-run-real-handler 'write-region 410 (jka-compr-run-real-handler 'write-region
409 (list start end temp-file t 'dont)) 411 (list start end temp-file t 'dont lockname coding-system))
410 412
411 (jka-compr-call-process compress-program 413 (jka-compr-call-process compress-program
412 (concat compress-message 414 (concat compress-message
413 " " base-name) 415 " " base-name)
414 temp-file 416 temp-file
418 420
419 (set-buffer temp-buffer) 421 (set-buffer temp-buffer)
420 (jka-compr-run-real-handler 'write-region 422 (jka-compr-run-real-handler 'write-region
421 (list (point-min) (point-max) 423 (list (point-min) (point-max)
422 filename 424 filename
423 (and append can-append) 'dont)) 425 (and append can-append) 'dont lockname coding-system))
424 (erase-buffer) 426 (erase-buffer)
425 (set-buffer cbuf) 427 (set-buffer cbuf)
426 428
427 (jka-compr-delete-temp-file temp-file) 429 (jka-compr-delete-temp-file temp-file)
428 430
445 (message "Wrote %s" visit-file)) 447 (message "Wrote %s" visit-file))
446 448
447 nil) 449 nil)
448 450
449 (jka-compr-run-real-handler 'write-region 451 (jka-compr-run-real-handler 'write-region
450 (list start end filename append visit))))) 452 (list start end filename append visit lockname coding-system)))))
451 453
452 454
453 (defun jka-compr-insert-file-contents (file &optional visit beg end replace) 455 (defun jka-compr-insert-file-contents (file &optional visit beg end replace)
454 (barf-if-buffer-read-only) 456 (barf-if-buffer-read-only)
455 457