aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-09-16 04:54:58 +0000
committerRichard M. Stallman1994-09-16 04:54:58 +0000
commit094cf604a0c93cfb47f90f7aa0d3ee93550d002b (patch)
tree87e089063b01823f40ec9c2519363e90734ae1bb
parentb85fdafb251f64c033441fcd3daaa97ab17d833b (diff)
downloademacs-094cf604a0c93cfb47f90f7aa0d3ee93550d002b.tar.gz
emacs-094cf604a0c93cfb47f90f7aa0d3ee93550d002b.zip
(jka-compr-compression-info-list): Expand regular
expressions to include backup files with version numbers. (jka-compr-insert-file-contents): Run the functions in after-insert-file-functions after the buffer-file-name has been set, not before. (jka-compr-insert-file-contents): Properly handle the 'replace' argument for compressed files.
-rw-r--r--lisp/jka-compr.el36
1 files changed, 23 insertions, 13 deletions
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 768ed52eecf..393bd29bc17 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -2,7 +2,6 @@
2;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. 2;;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
3 3
4;; Author: jka@ece.cmu.edu (Jay K. Adams) 4;; Author: jka@ece.cmu.edu (Jay K. Adams)
5;; Version: 0.11
6;; Keywords: data 5;; Keywords: data
7 6
8;;; Commentary: 7;;; Commentary:
@@ -128,11 +127,11 @@ for `jka-compr-compression-info-list').")
128 ;; compr-message compr-prog compr-args 127 ;; compr-message compr-prog compr-args
129 ;; uncomp-message uncomp-prog uncomp-args 128 ;; uncomp-message uncomp-prog uncomp-args
130 ;; can-append auto-mode-flag] 129 ;; can-append auto-mode-flag]
131 '(["\\.Z~?\\'" 130 '(["\\.Z\\(~\\|\\.~[0-9]+~\\)?\\'"
132 "compressing" "compress" ("-c") 131 "compressing" "compress" ("-c")
133 "uncompressing" "uncompress" ("-c") 132 "uncompressing" "uncompress" ("-c")
134 nil t] 133 nil t]
135 ["\\.gz~?\\'" 134 ["\\.gz\\(~\\|\\.~[0-9]+~\\)?\\'"
136 "zipping" "gzip" ("-c" "-q") 135 "zipping" "gzip" ("-c" "-q")
137 "unzipping" "gzip" ("-c" "-q" "-d") 136 "unzipping" "gzip" ("-c" "-q" "-d")
138 t t]) 137 t t])
@@ -512,6 +511,8 @@ There should be no more than seven characters after the final `/'")
512 (condition-case error-code 511 (condition-case error-code
513 512
514 (progn 513 (progn
514 (if replace
515 (goto-char (point-min)))
515 (setq start (point)) 516 (setq start (point))
516 (if (or beg end) 517 (if (or beg end)
517 (jka-compr-partial-uncompress uncompress-program 518 (jka-compr-partial-uncompress uncompress-program
@@ -531,16 +532,12 @@ There should be no more than seven characters after the final `/'")
531 nil 532 nil
532 uncompress-args)) 533 uncompress-args))
533 (setq size (- (point) start)) 534 (setq size (- (point) start))
534 (goto-char start) 535 (if replace
535 ;; Run the functions that insert-file-contents would. 536 (let* ((del-beg (point))
536 (let ((list after-insert-file-functions) 537 (del-end (+ del-beg size)))
537 (value size)) 538 (delete-region del-beg
538 (while list 539 (min del-end (point-max)))))
539 (setq value (funcall (car list) size)) 540 (goto-char start))
540 (if value
541 (setq size value))
542 (setq list (cdr list)))))
543
544 (error 541 (error
545 (if (and (eq (car error-code) 'file-error) 542 (if (and (eq (car error-code) 'file-error)
546 (eq (nth 3 error-code) local-file)) 543 (eq (nth 3 error-code) local-file))
@@ -573,6 +570,19 @@ There should be no more than seven characters after the final `/'")
573 (signal 'file-error 570 (signal 'file-error
574 (cons "Opening input file" (nth 2 notfound)))) 571 (cons "Opening input file" (nth 2 notfound))))
575 572
573 ;; Run the functions that insert-file-contents would.
574 (let ((p after-insert-file-functions)
575 (insval size))
576 (while p
577 (setq insval (funcall (car p) size))
578 (if insval
579 (progn
580 (or (integerp insval)
581 (signal 'wrong-type-argument
582 (list 'integerp insval)))
583 (setq size insval)))
584 (setq p (cdr p))))
585
576 (list filename size)) 586 (list filename size))
577 587
578 (jka-compr-run-real-handler 'insert-file-contents 588 (jka-compr-run-real-handler 'insert-file-contents