annotate lisp/jka-compr.el @ 66179:6c8bcb760760

* files.texi (Version Systems): Capitalize GNU. * viper.texi (Viper Specials): Likewise.
author Romain Francoise <romain@orebokech.com>
date Tue, 18 Oct 2005 08:01:51 +0000
parents 41bb365f41c4
children 8068044e970e 2d92f5c9d6ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13337
84acc3adcd63 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 13067
diff changeset
1 ;;; jka-compr.el --- reading/writing/loading compressed files
84acc3adcd63 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 13067
diff changeset
2
64762
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64091
diff changeset
3 ;; Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2002, 2003,
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64091
diff changeset
4 ;; 2004, 2005 Free Software Foundation, Inc.
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Author: jka@ece.cmu.edu (Jay K. Adams)
17976
852464ce5d6a Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17441
diff changeset
7 ;; Maintainer: FSF
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; Keywords: data
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
13514
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
10 ;; This file is part of GNU Emacs.
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
11
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
15 ;; any later version.
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
16
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
20 ;; GNU General Public License for more details.
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
21
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
22 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63766
diff changeset
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63766
diff changeset
25 ;; Boston, MA 02110-1301, USA.
13514
0e46e8075a1d (auto-compression-mode): Make arg optional.
Richard M. Stallman <rms@gnu.org>
parents: 13337
diff changeset
26
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 34732
diff changeset
27 ;;; Commentary:
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
29 ;; This package implements low-level support for reading, writing,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
30 ;; and loading compressed files. It hooks into the low-level file
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
31 ;; I/O functions (including write-region and insert-file-contents) so
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
32 ;; that they automatically compress or uncompress a file if the file
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
33 ;; appears to need it (based on the extension of the file name).
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
34 ;; Packages like Rmail, VM, GNUS, and Info should be able to work
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
35 ;; with compressed files without modification.
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
38 ;; INSTRUCTIONS:
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
39 ;;
32497
447210134c3b Doc fix.
Miles Bader <miles@gnu.org>
parents: 32317
diff changeset
40 ;; To use jka-compr, invoke the command `auto-compression-mode' (which
447210134c3b Doc fix.
Miles Bader <miles@gnu.org>
parents: 32317
diff changeset
41 ;; see), or customize the variable of the same name. Its operation
447210134c3b Doc fix.
Miles Bader <miles@gnu.org>
parents: 32317
diff changeset
42 ;; should be transparent to the user (except for messages appearing when
447210134c3b Doc fix.
Miles Bader <miles@gnu.org>
parents: 32317
diff changeset
43 ;; a file is being compressed or uncompressed).
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
44 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
45 ;; The variable, jka-compr-compression-info-list can be used to
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
46 ;; customize jka-compr to work with other compression programs.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
47 ;; The default value of this variable allows jka-compr to work with
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
48 ;; Unix compress and gzip.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
49 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
50 ;; If you are concerned about the stderr output of gzip and other
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
51 ;; compression/decompression programs showing up in your buffers, you
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
52 ;; should set the discard-error flag in the compression-info-list.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
53 ;; This will cause the stderr of all programs to be discarded.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
54 ;; However, it also causes emacs to call compression/uncompression
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
55 ;; programs through a shell (which is specified by jka-compr-shell).
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
56 ;; This may be a drag if, on your system, starting up a shell is
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
57 ;; slow.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
58 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
59 ;; If you don't want messages about compressing and decompressing
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
60 ;; to show up in the echo area, you can set the compress-name and
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
61 ;; decompress-name fields of the jka-compr-compression-info-list to
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
62 ;; nil.
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
65 ;; APPLICATION NOTES:
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
66 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
67 ;; crypt++
45720
c145c11ef3b3 Fix a typo in a comment.
Eli Zaretskii <eliz@gnu.org>
parents: 42461
diff changeset
68 ;; jka-compr can coexist with crypt++ if you take all the decompression
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
69 ;; entries out of the crypt-encoding-list. Clearly problems will arise if
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
70 ;; you have two programs trying to compress/decompress files. jka-compr
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
71 ;; will not "work with" crypt++ in the following sense: you won't be able to
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
72 ;; decode encrypted compressed files--that is, files that have been
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
73 ;; compressed then encrypted (in that order). Theoretically, crypt++ and
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
74 ;; jka-compr could properly handle a file that has been encrypted then
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
75 ;; compressed, but there is little point in trying to compress an encrypted
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
76 ;; file.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
77 ;;
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
80 ;; ACKNOWLEDGMENTS
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
81 ;;
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
82 ;; jka-compr is a V19 adaptation of jka-compr for V18 of Emacs. Many people
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
83 ;; have made helpful suggestions, reported bugs, and even fixed bugs in
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
84 ;; jka-compr. I recall the following people as being particularly helpful.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
85 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
86 ;; Jean-loup Gailly
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
87 ;; David Hughes
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
88 ;; Richard Pieri
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
89 ;; Daniel Quinlan
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
90 ;; Chris P. Ross
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
91 ;; Rick Sladkey
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
92 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
93 ;; Andy Norman's ange-ftp was the inspiration for the original jka-compr for
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
94 ;; Version 18 of Emacs.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
95 ;;
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
96 ;; After I had made progress on the original jka-compr for V18, I learned of a
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
97 ;; package written by Kazushi Jam Marukawa, called jam-zcat, that did exactly
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
98 ;; what I was trying to do. I looked over the jam-zcat source code and
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
99 ;; probably got some ideas from it.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13900
diff changeset
100 ;;
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 ;;; Code:
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103
17411
f0ff96a35eb8 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16940
diff changeset
104 (defcustom jka-compr-shell "sh"
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 "*Shell to be used for calling compression programs.
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 The value of this variable only matters if you want to discard the
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 stderr of a compression/decompression program (see the documentation
17411
f0ff96a35eb8 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16940
diff changeset
108 for `jka-compr-compression-info-list')."
f0ff96a35eb8 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16940
diff changeset
109 :type 'string
f0ff96a35eb8 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16940
diff changeset
110 :group 'jka-compr)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
112 (defvar jka-compr-use-shell
21633
185e8e424ee9 (jka-compr-use-shell) [ms-dos, windows-nt]: Do not use a shell.
Richard M. Stallman <rms@gnu.org>
parents: 20893
diff changeset
113 (not (memq system-type '(ms-dos windows-nt))))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
115 (defvar jka-compr-really-do-compress nil
60781
4dec7a239cfa (jka-compr-really-do-compress): Make variable buffer-local.
Richard M. Stallman <rms@gnu.org>
parents: 54521
diff changeset
116 "Non-nil in a buffer whose visited file was uncompressed on visiting it.
4dec7a239cfa (jka-compr-really-do-compress): Make variable buffer-local.
Richard M. Stallman <rms@gnu.org>
parents: 54521
diff changeset
117 This means compress the data on writing the file, even if the
4dec7a239cfa (jka-compr-really-do-compress): Make variable buffer-local.
Richard M. Stallman <rms@gnu.org>
parents: 54521
diff changeset
118 data appears to be compressed already.")
4dec7a239cfa (jka-compr-really-do-compress): Make variable buffer-local.
Richard M. Stallman <rms@gnu.org>
parents: 54521
diff changeset
119 (make-variable-buffer-local 'jka-compr-really-do-compress)
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
120 (put 'jka-compr-really-do-compress 'permanent-local t)
7617
edc853e14f7b (jka-compr-op-table, jka-compr-file-name-handler-entry): Move defvars.
Richard M. Stallman <rms@gnu.org>
parents: 7616
diff changeset
121
15083
285482e8df41 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
122 ;;; Functions for accessing the return value of jka-compr-get-compression-info
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 (defun jka-compr-info-regexp (info) (aref info 0))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (defun jka-compr-info-compress-message (info) (aref info 1))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (defun jka-compr-info-compress-program (info) (aref info 2))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (defun jka-compr-info-compress-args (info) (aref info 3))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (defun jka-compr-info-uncompress-message (info) (aref info 4))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (defun jka-compr-info-uncompress-program (info) (aref info 5))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (defun jka-compr-info-uncompress-args (info) (aref info 6))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (defun jka-compr-info-can-append (info) (aref info 7))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (defun jka-compr-info-strip-extension (info) (aref info 8))
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
132 (defun jka-compr-info-file-magic-bytes (info) (aref info 9))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (defun jka-compr-get-compression-info (filename)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 "Return information about the compression scheme of FILENAME.
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 The determination as to which compression scheme, if any, to use is
7066
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
138 based on the filename itself and `jka-compr-compression-info-list'."
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (catch 'compression-info
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (let ((case-fold-search nil))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (mapcar
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (function (lambda (x)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (and (string-match (jka-compr-info-regexp x) filename)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (throw 'compression-info x))))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 jka-compr-compression-info-list)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 nil)))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 (put 'compression-error 'error-conditions '(compression-error file-error error))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151
11635
b56f6afa16ec (jka-compr-write-region): Handle the append
Richard M. Stallman <rms@gnu.org>
parents: 11621
diff changeset
152 (defvar jka-compr-acceptable-retval-list '(0 2 141))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (defun jka-compr-error (prog args infile message &optional errfile)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (let ((errbuf (get-buffer-create " *jka-compr-error*"))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (curbuf (current-buffer)))
16940
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
159 (with-current-buffer errbuf
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
160 (widen) (erase-buffer)
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
161 (insert (format "Error while executing \"%s %s < %s\"\n\n"
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
162 prog
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
163 (mapconcat 'identity args " ")
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
164 infile))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165
16940
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
166 (and errfile
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
167 (insert-file-contents errfile)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (display-buffer errbuf))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169
16940
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
170 (signal 'compression-error
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
171 (list "Opening input file" (format "error %s" message) infile)))
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
172
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
173
40782
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
174 (defcustom jka-compr-dd-program "/bin/dd"
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
175 "How to invoke `dd'."
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
176 :type 'string
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
177 :group 'jka-compr)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179
6041
649926e9c1a8 (jka-compr-partial-uncompress): Make dd give you
Richard M. Stallman <rms@gnu.org>
parents: 6002
diff changeset
180 (defvar jka-compr-dd-blocksize 256)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (defun jka-compr-partial-uncompress (prog message args infile beg len)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 "Call program PROG with ARGS args taking input from INFILE.
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 Fourth and fifth args, BEG and LEN, specify which part of the output
8065
31eb7a0e2763 (jka-compr-partial-uncompress): Handle the case where
Richard M. Stallman <rms@gnu.org>
parents: 7976
diff changeset
186 to keep: LEN chars starting BEG chars from the beginning."
40782
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
187 (let ((start (point))
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
188 (prefix beg))
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
189 (if (and jka-compr-use-shell jka-compr-dd-program)
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
190 ;; Put the uncompression output through dd
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
191 ;; to discard the part we don't want.
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
192 (let ((skip (/ beg jka-compr-dd-blocksize))
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
193 (err-file (jka-compr-make-temp-name))
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
194 count)
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
195 ;; Update PREFIX based on the text that we won't read in.
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
196 (setq prefix (- beg (* skip jka-compr-dd-blocksize))
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
197 count (and len (1+ (/ (+ len prefix) jka-compr-dd-blocksize))))
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
198 (unwind-protect
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
199 (or (memq (call-process
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
200 jka-compr-shell infile t nil "-c"
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
201 (format
42231
054cf5ce349b (jka-compr-partial-uncompress): Use null-device instead of a literal
Eli Zaretskii <eliz@gnu.org>
parents: 41102
diff changeset
202 "%s %s 2> %s | %s bs=%d skip=%d %s 2> %s"
40782
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
203 prog
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
204 (mapconcat 'identity args " ")
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
205 err-file
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
206 jka-compr-dd-program
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
207 jka-compr-dd-blocksize
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
208 skip
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
209 ;; dd seems to be unreliable about
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
210 ;; providing the last block. So, always
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
211 ;; read one more than you think you need.
42231
054cf5ce349b (jka-compr-partial-uncompress): Use null-device instead of a literal
Eli Zaretskii <eliz@gnu.org>
parents: 41102
diff changeset
212 (if count (format "count=%d" (1+ count)) "")
054cf5ce349b (jka-compr-partial-uncompress): Use null-device instead of a literal
Eli Zaretskii <eliz@gnu.org>
parents: 41102
diff changeset
213 null-device))
40782
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
214 jka-compr-acceptable-retval-list)
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
215 (jka-compr-error prog args infile message err-file))
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
216 (jka-compr-delete-temp-file err-file)))
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
217 ;; Run the uncompression program directly.
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
218 ;; We get the whole file and must delete what we don't want.
3a4d800ced48 (jka-compr-partial-uncompress): Support an alternative of not using dd.
Richard M. Stallman <rms@gnu.org>
parents: 39829
diff changeset
219 (jka-compr-call-process prog message infile t nil args))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220
8065
31eb7a0e2763 (jka-compr-partial-uncompress): Handle the case where
Richard M. Stallman <rms@gnu.org>
parents: 7976
diff changeset
221 ;; Delete the stuff after what we want, if there is any.
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 (and
6041
649926e9c1a8 (jka-compr-partial-uncompress): Make dd give you
Richard M. Stallman <rms@gnu.org>
parents: 6002
diff changeset
223 len
8065
31eb7a0e2763 (jka-compr-partial-uncompress): Handle the case where
Richard M. Stallman <rms@gnu.org>
parents: 7976
diff changeset
224 (< (+ start prefix len) (point))
6041
649926e9c1a8 (jka-compr-partial-uncompress): Make dd give you
Richard M. Stallman <rms@gnu.org>
parents: 6002
diff changeset
225 (delete-region (+ start prefix len) (point)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226
8065
31eb7a0e2763 (jka-compr-partial-uncompress): Handle the case where
Richard M. Stallman <rms@gnu.org>
parents: 7976
diff changeset
227 ;; Delete the stuff before what we want.
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 (delete-region start (+ start prefix))))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 (defun jka-compr-call-process (prog message infile output temp args)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 (if jka-compr-use-shell
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233
18879
8b226efb9a8b (jka-compr-insert-file-contents): Bind coding-system-for-read.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
234 (let ((err-file (jka-compr-make-temp-name))
18906
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
235 (coding-system-for-read (or coding-system-for-read 'undecided))
22360
09dbe38a603f (jka-compr-write-region): Ensure
Karl Heuer <kwzh@gnu.org>
parents: 22194
diff changeset
236 (coding-system-for-write 'no-conversion))
18879
8b226efb9a8b (jka-compr-insert-file-contents): Bind coding-system-for-read.
Richard M. Stallman <rms@gnu.org>
parents: 17976
diff changeset
237
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 (unwind-protect
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 (or (memq
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 (call-process jka-compr-shell infile
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 (if (stringp output) nil output)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 nil
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 "-c"
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (format "%s %s 2> %s %s"
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 prog
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 (mapconcat 'identity args " ")
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 err-file
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 (if (stringp output)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 (concat "> " output)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 "")))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 jka-compr-acceptable-retval-list)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 (jka-compr-error prog args infile message err-file))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 (jka-compr-delete-temp-file err-file)))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257
53477
79093b308520 * progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents: 53304
diff changeset
258 (or (eq 0
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 (apply 'call-process
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 prog
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 infile
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 (if (stringp output) temp output)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 nil
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 args))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 (jka-compr-error prog args infile message))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 (and (stringp output)
16940
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
268 (with-current-buffer temp
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 (write-region (point-min) (point-max) output)
16940
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
270 (erase-buffer)))))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 ;;; Support for temp files. Much of this was inspired if not lifted
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 ;;; from ange-ftp.
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275
17411
f0ff96a35eb8 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16940
diff changeset
276 (defcustom jka-compr-temp-name-template
22100
eb3f36cc775f (jka-compr-temp-name-template): Use temporary-file-directory.
Richard M. Stallman <rms@gnu.org>
parents: 22090
diff changeset
277 (expand-file-name "jka-com" temporary-file-directory)
17441
41a10d128e3b (jka-compr-temp-name-template): Fix editing error.
Richard M. Stallman <rms@gnu.org>
parents: 17411
diff changeset
278 "Prefix added to all temp files created by jka-compr.
17411
f0ff96a35eb8 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16940
diff changeset
279 There should be no more than seven characters after the final `/'."
f0ff96a35eb8 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16940
diff changeset
280 :type 'string
f0ff96a35eb8 Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents: 16940
diff changeset
281 :group 'jka-compr)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (defun jka-compr-make-temp-name (&optional local-copy)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 "This routine will return the name of a new file."
26039
fb6b9c37cdc4 Use make-temp-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25285
diff changeset
285 (make-temp-file jka-compr-temp-name-template))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
26039
fb6b9c37cdc4 Use make-temp-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 25285
diff changeset
287 (defalias 'jka-compr-delete-temp-file 'delete-file)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (defun jka-compr-write-region (start end file &optional append visit)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 (let* ((filename (expand-file-name file))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (visit-file (if (stringp visit) (expand-file-name visit) filename))
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
293 (info (jka-compr-get-compression-info visit-file))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
294 (magic (and info (jka-compr-info-file-magic-bytes info))))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295
42461
c28b5df30ea0 (jka-compr-write-region): If START = nil, use whole buf.
Richard M. Stallman <rms@gnu.org>
parents: 42231
diff changeset
296 ;; If START is nil, use the whole buffer.
c28b5df30ea0 (jka-compr-write-region): If START = nil, use whole buf.
Richard M. Stallman <rms@gnu.org>
parents: 42231
diff changeset
297 (if (null start)
c28b5df30ea0 (jka-compr-write-region): If START = nil, use whole buf.
Richard M. Stallman <rms@gnu.org>
parents: 42231
diff changeset
298 (setq start 1 end (1+ (buffer-size))))
c28b5df30ea0 (jka-compr-write-region): If START = nil, use whole buf.
Richard M. Stallman <rms@gnu.org>
parents: 42231
diff changeset
299
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
300 ;; If we uncompressed this file when visiting it,
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
301 ;; then recompress it when writing it
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
302 ;; even if the contents look compressed already.
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
303 (if (and jka-compr-really-do-compress
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
304 (eq start 1)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
305 (eq end (1+ (buffer-size))))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
306 (setq magic nil))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
308 (if (and info
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
309 ;; If the contents to be written out
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
310 ;; are properly compressed already,
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
311 ;; don't try to compress them over again.
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
312 (not (and magic
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
313 (equal (if (stringp start)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
314 (substring start 0 (min (length start)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
315 (length magic)))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
316 (buffer-substring start
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
317 (min end
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
318 (+ start (length magic)))))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
319 magic))))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
320 (let ((can-append (jka-compr-info-can-append info))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
321 (compress-program (jka-compr-info-compress-program info))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
322 (compress-message (jka-compr-info-compress-message info))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
323 (compress-args (jka-compr-info-compress-args info))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
324 (base-name (file-name-nondirectory visit-file))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
325 temp-file temp-buffer
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
326 ;; we need to leave `last-coding-system-used' set to its
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
327 ;; value after calling write-region the first time, so
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
328 ;; that `basic-save-buffer' sees the right value.
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
329 (coding-system-used last-coding-system-used))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330
54521
36922d8fd700 (jka-compr-compression-info-list): Add tbz and dz.
Juri Linkov <juri@jurta.org>
parents: 53477
diff changeset
331 (or compress-program
36922d8fd700 (jka-compr-compression-info-list): Add tbz and dz.
Juri Linkov <juri@jurta.org>
parents: 53477
diff changeset
332 (error "No compression program defined"))
36922d8fd700 (jka-compr-compression-info-list): Add tbz and dz.
Juri Linkov <juri@jurta.org>
parents: 53477
diff changeset
333
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
334 (setq temp-buffer (get-buffer-create " *jka-compr-wr-temp*"))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
335 (with-current-buffer temp-buffer
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
336 (widen) (erase-buffer))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
338 (if (and append
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
339 (not can-append)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
340 (file-exists-p filename))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
342 (let* ((local-copy (file-local-copy filename))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
343 (local-file (or local-copy filename)))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
344
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
345 (setq temp-file local-file))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
346
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
347 (setq temp-file (jka-compr-make-temp-name)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
349 (and
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
350 compress-message
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
351 (message "%s %s..." compress-message base-name))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
352
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
353 (jka-compr-run-real-handler 'write-region
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
354 (list start end temp-file t 'dont))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
355 ;; save value used by the real write-region
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
356 (setq coding-system-used last-coding-system-used)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
358 ;; Here we must read the output of compress program as is
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
359 ;; without any code conversion.
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
360 (let ((coding-system-for-read 'no-conversion))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
361 (jka-compr-call-process compress-program
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
362 (concat compress-message
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
363 " " base-name)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
364 temp-file
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
365 temp-buffer
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
366 nil
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
367 compress-args))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
369 (with-current-buffer temp-buffer
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
370 (let ((coding-system-for-write 'no-conversion))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
371 (if (memq system-type '(ms-dos windows-nt))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
372 (setq buffer-file-type t) )
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
373 (jka-compr-run-real-handler 'write-region
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
374 (list (point-min) (point-max)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
375 filename
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
376 (and append can-append) 'dont))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
377 (erase-buffer)) )
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
379 (jka-compr-delete-temp-file temp-file)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
380
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
381 (and
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
382 compress-message
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
383 (message "%s %s...done" compress-message base-name))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
385 (cond
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
386 ((eq visit t)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
387 (setq buffer-file-name filename)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
388 (setq jka-compr-really-do-compress t)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
389 (set-visited-file-modtime))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
390 ((stringp visit)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
391 (setq buffer-file-name visit)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
392 (let ((buffer-file-name filename))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
393 (set-visited-file-modtime))))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
395 (and (or (eq visit t)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
396 (eq visit nil)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
397 (stringp visit))
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
398 (message "Wrote %s" visit-file))
22360
09dbe38a603f (jka-compr-write-region): Ensure
Karl Heuer <kwzh@gnu.org>
parents: 22194
diff changeset
399
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
400 ;; ensure `last-coding-system-used' has an appropriate value
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
401 (setq last-coding-system-used coding-system-used)
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
402
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
403 nil)
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
404
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
405 (jka-compr-run-real-handler 'write-region
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
406 (list start end filename append visit)))))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408
6218
f4d5338c2142 (jka-compr-insert-file-contents): Handle 5th arg.
Richard M. Stallman <rms@gnu.org>
parents: 6041
diff changeset
409 (defun jka-compr-insert-file-contents (file &optional visit beg end replace)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (barf-if-buffer-read-only)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 (and (or beg end)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 visit
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 (error "Attempt to visit less than an entire file"))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 (let* ((filename (expand-file-name file))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 (info (jka-compr-get-compression-info filename)))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (if info
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 (let ((uncompress-message (jka-compr-info-uncompress-message info))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (uncompress-program (jka-compr-info-uncompress-program info))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 (uncompress-args (jka-compr-info-uncompress-args info))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (base-name (file-name-nondirectory filename))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 (notfound nil)
7976
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
426 (local-copy
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
427 (jka-compr-run-real-handler 'file-local-copy (list filename)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 local-file
49377
e5099d153f94 (jka-compr-insert-file-contents): Read a process
Kenichi Handa <handa@m17n.org>
parents: 47180
diff changeset
429 size start)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 (setq local-file (or local-copy filename))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (and
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 visit
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 (setq buffer-file-name filename))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 (unwind-protect ; to make sure local-copy gets deleted
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 (progn
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
440
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 (and
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 uncompress-message
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 (message "%s %s..." uncompress-message base-name))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 (condition-case error-code
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446
49377
e5099d153f94 (jka-compr-insert-file-contents): Read a process
Kenichi Handa <handa@m17n.org>
parents: 47180
diff changeset
447 (let ((coding-system-for-read 'no-conversion))
8774
ade4b542a74c (jka-compr-compression-info-list): Expand regular
Richard M. Stallman <rms@gnu.org>
parents: 8593
diff changeset
448 (if replace
ade4b542a74c (jka-compr-compression-info-list): Expand regular
Richard M. Stallman <rms@gnu.org>
parents: 8593
diff changeset
449 (goto-char (point-min)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 (setq start (point))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 (if (or beg end)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 (jka-compr-partial-uncompress uncompress-program
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 (concat uncompress-message
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 " " base-name)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 uncompress-args
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 local-file
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 (or beg 0)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 (if (and beg end)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 (- end beg)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 end))
11621
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
461 ;; If visiting, bind off buffer-file-name so that
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
462 ;; file-locking will not ask whether we should
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
463 ;; really edit the buffer.
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
464 (let ((buffer-file-name
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
465 (if visit nil buffer-file-name)))
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
466 (jka-compr-call-process uncompress-program
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
467 (concat uncompress-message
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
468 " " base-name)
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
469 local-file
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
470 t
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
471 nil
710b5ce824c2 (jka-compr-insert-file-contents): When visiting,
Richard M. Stallman <rms@gnu.org>
parents: 11296
diff changeset
472 uncompress-args)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 (setq size (- (point) start))
8774
ade4b542a74c (jka-compr-compression-info-list): Expand regular
Richard M. Stallman <rms@gnu.org>
parents: 8593
diff changeset
474 (if replace
51284
55a88703765d (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 49597
diff changeset
475 (delete-region (point) (point-max)))
8774
ade4b542a74c (jka-compr-compression-info-list): Expand regular
Richard M. Stallman <rms@gnu.org>
parents: 8593
diff changeset
476 (goto-char start))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 (error
63766
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
478 ;; If the file we wanted to uncompress does not exist,
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
479 ;; handle that according to VISIT as `insert-file-contents'
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
480 ;; would, maybe signaling the same error it normally would.
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 (if (and (eq (car error-code) 'file-error)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 (eq (nth 3 error-code) local-file))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 (if visit
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 (setq notfound error-code)
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
485 (signal 'file-error
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 (cons "Opening input file"
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 (nthcdr 2 error-code))))
63766
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
488 ;; If the uncompression program can't be found,
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
489 ;; signal that as a non-file error
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
490 ;; so that find-file-noselect-1 won't handle it.
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
491 (if (and (eq (car error-code) 'file-error)
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
492 (equal (cadr error-code) "Searching for program"))
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
493 (error "Uncompression program `%s' not found"
e6ea4d9f64f3 (jka-compr-insert-file-contents):
Richard M. Stallman <rms@gnu.org>
parents: 62108
diff changeset
494 (nth 3 error-code)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 (signal (car error-code) (cdr error-code))))))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 (and
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 local-copy
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 (file-exists-p local-copy)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 (delete-file local-copy)))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501
53304
b9463f85fb04 (jka-compr-insert-file-contents): Avoid error when
Andreas Schwab <schwab@suse.de>
parents: 52401
diff changeset
502 (unless notfound
b9463f85fb04 (jka-compr-insert-file-contents): Avoid error when
Andreas Schwab <schwab@suse.de>
parents: 52401
diff changeset
503 (decode-coding-inserted-region
b9463f85fb04 (jka-compr-insert-file-contents): Avoid error when
Andreas Schwab <schwab@suse.de>
parents: 52401
diff changeset
504 (point) (+ (point) size)
b9463f85fb04 (jka-compr-insert-file-contents): Avoid error when
Andreas Schwab <schwab@suse.de>
parents: 52401
diff changeset
505 (jka-compr-byte-compiler-base-file-name file)
b9463f85fb04 (jka-compr-insert-file-contents): Avoid error when
Andreas Schwab <schwab@suse.de>
parents: 52401
diff changeset
506 visit beg end replace))
49377
e5099d153f94 (jka-compr-insert-file-contents): Read a process
Kenichi Handa <handa@m17n.org>
parents: 47180
diff changeset
507
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 (and
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 visit
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (progn
7976
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
511 (unlock-buffer)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 (setq buffer-file-name filename)
26987
af30e0897839 (jka-compr-info-file-magic-bytes): New function.
Richard M. Stallman <rms@gnu.org>
parents: 26039
diff changeset
513 (setq jka-compr-really-do-compress t)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 (set-visited-file-modtime)))
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
515
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 (and
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 uncompress-message
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 (message "%s %s...done" uncompress-message base-name))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 (and
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 visit
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 notfound
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 (signal 'file-error
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 (cons "Opening input file" (nth 2 notfound))))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525
22484
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
526 ;; This is done in insert-file-contents after we return.
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
527 ;; That is a little weird, but better to go along with it now
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
528 ;; than to change it now.
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
529
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
530 ;;; ;; Run the functions that insert-file-contents would.
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
531 ;;; (let ((p after-insert-file-functions)
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
532 ;;; (insval size))
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
533 ;;; (while p
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
534 ;;; (setq insval (funcall (car p) size))
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
535 ;;; (if insval
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
536 ;;; (progn
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
537 ;;; (or (integerp insval)
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
538 ;;; (signal 'wrong-type-argument
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
539 ;;; (list 'integerp insval)))
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
540 ;;; (setq size insval)))
661650f543ee (jka-compr-insert-file-contents): Don't run
Richard M. Stallman <rms@gnu.org>
parents: 22360
diff changeset
541 ;;; (setq p (cdr p))))
8774
ade4b542a74c (jka-compr-compression-info-list): Expand regular
Richard M. Stallman <rms@gnu.org>
parents: 8593
diff changeset
542
54521
36922d8fd700 (jka-compr-compression-info-list): Add tbz and dz.
Juri Linkov <juri@jurta.org>
parents: 53477
diff changeset
543 (or (jka-compr-info-compress-program info)
36922d8fd700 (jka-compr-compression-info-list): Add tbz and dz.
Juri Linkov <juri@jurta.org>
parents: 53477
diff changeset
544 (message "You can't save this buffer because compression program is not defined"))
36922d8fd700 (jka-compr-compression-info-list): Add tbz and dz.
Juri Linkov <juri@jurta.org>
parents: 53477
diff changeset
545
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 (list filename size))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547
7976
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
548 (jka-compr-run-real-handler 'insert-file-contents
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
549 (list file visit beg end replace)))))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 (defun jka-compr-file-local-copy (file)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 (let* ((filename (expand-file-name file))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 (info (jka-compr-get-compression-info filename)))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 (if info
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 (let ((uncompress-message (jka-compr-info-uncompress-message info))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 (uncompress-program (jka-compr-info-uncompress-program info))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 (uncompress-args (jka-compr-info-uncompress-args info))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 (base-name (file-name-nondirectory filename))
7976
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
562 (local-copy
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
563 (jka-compr-run-real-handler 'file-local-copy (list filename)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 (temp-file (jka-compr-make-temp-name t))
11635
b56f6afa16ec (jka-compr-write-region): Handle the append
Richard M. Stallman <rms@gnu.org>
parents: 11621
diff changeset
565 (temp-buffer (get-buffer-create " *jka-compr-flc-temp*"))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 (notfound nil)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 local-file)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 (setq local-file (or local-copy filename))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 (unwind-protect
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572
16940
6d680b18a47b (jka-compr-error): Use with-current-buffer.
Richard M. Stallman <rms@gnu.org>
parents: 16630
diff changeset
573 (with-current-buffer temp-buffer
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
574
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 (and
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 uncompress-message
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 (message "%s %s..." uncompress-message base-name))
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
578
18906
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
579 ;; Here we must read the output of uncompress program
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
580 ;; and write it to TEMP-FILE without any code
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
581 ;; conversion. An appropriate code conversion (if
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
582 ;; necessary) is done by the later I/O operation
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
583 ;; (e.g. load).
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
584 (let ((coding-system-for-read 'no-conversion)
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
585 (coding-system-for-write 'no-conversion))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586
18906
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
587 (jka-compr-call-process uncompress-program
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
588 (concat uncompress-message
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
589 " " base-name)
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
590 local-file
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
591 t
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
592 nil
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
593 uncompress-args)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594
18906
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
595 (and
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
596 uncompress-message
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
597 (message "%s %s...done" uncompress-message base-name))
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
598
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
599 (write-region
67642fb78fc4 Fix previous changes.
Kenichi Handa <handa@m17n.org>
parents: 18879
diff changeset
600 (point-min) (point-max) temp-file nil 'dont)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 (and
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 local-copy
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 (file-exists-p local-copy)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 (delete-file local-copy))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 (kill-buffer temp-buffer))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 temp-file)
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
610
7976
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
611 (jka-compr-run-real-handler 'file-local-copy (list filename)))))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 ;;; Support for loading compressed files.
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 (defun jka-compr-load (file &optional noerror nomessage nosuffix)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 "Documented as original."
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 (let* ((local-copy (jka-compr-file-local-copy file))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 (load-file (or local-copy file)))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 (unwind-protect
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622
7976
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
623 (let (inhibit-file-name-operation
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
624 inhibit-file-name-handlers)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 (or nomessage
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 (message "Loading %s..." file))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627
12758
a285eaa710ac (jka-compr-load): Bind load-force-doc-strings.
Richard M. Stallman <rms@gnu.org>
parents: 11635
diff changeset
628 (let ((load-force-doc-strings t))
a285eaa710ac (jka-compr-load): Bind load-force-doc-strings.
Richard M. Stallman <rms@gnu.org>
parents: 11635
diff changeset
629 (load load-file noerror t t))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 (or nomessage
27512
b7020186895e (jka-compr-load): Fix up load-history.
Dave Love <fx@gnu.org>
parents: 26987
diff changeset
631 (message "Loading %s...done." file))
b7020186895e (jka-compr-load): Fix up load-history.
Dave Love <fx@gnu.org>
parents: 26987
diff changeset
632 ;; Fix up the load history to point at the right library.
b7020186895e (jka-compr-load): Fix up load-history.
Dave Love <fx@gnu.org>
parents: 26987
diff changeset
633 (let ((l (assoc load-file load-history)))
b7020186895e (jka-compr-load): Fix up load-history.
Dave Love <fx@gnu.org>
parents: 26987
diff changeset
634 ;; Remove .gz and .elc?.
b7020186895e (jka-compr-load): Fix up load-history.
Dave Love <fx@gnu.org>
parents: 26987
diff changeset
635 (while (file-name-extension file)
b7020186895e (jka-compr-load): Fix up load-history.
Dave Love <fx@gnu.org>
parents: 26987
diff changeset
636 (setq file (file-name-sans-extension file)))
b7020186895e (jka-compr-load): Fix up load-history.
Dave Love <fx@gnu.org>
parents: 26987
diff changeset
637 (setcar l file)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 (jka-compr-delete-temp-file local-copy))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 t))
12922
e171a85fd6b0 (jka-compr-byte-compiler-base-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents: 12758
diff changeset
642
e171a85fd6b0 (jka-compr-byte-compiler-base-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents: 12758
diff changeset
643 (defun jka-compr-byte-compiler-base-file-name (file)
e171a85fd6b0 (jka-compr-byte-compiler-base-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents: 12758
diff changeset
644 (let ((info (jka-compr-get-compression-info file)))
e171a85fd6b0 (jka-compr-byte-compiler-base-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents: 12758
diff changeset
645 (if (and info (jka-compr-info-strip-extension info))
e171a85fd6b0 (jka-compr-byte-compiler-base-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents: 12758
diff changeset
646 (save-match-data
e171a85fd6b0 (jka-compr-byte-compiler-base-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents: 12758
diff changeset
647 (substring file 0 (string-match (jka-compr-info-regexp info) file)))
e171a85fd6b0 (jka-compr-byte-compiler-base-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents: 12758
diff changeset
648 file)))
7976
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
649
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
650 (put 'write-region 'jka-compr 'jka-compr-write-region)
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
651 (put 'insert-file-contents 'jka-compr 'jka-compr-insert-file-contents)
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
652 (put 'file-local-copy 'jka-compr 'jka-compr-file-local-copy)
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
653 (put 'load 'jka-compr 'jka-compr-load)
12922
e171a85fd6b0 (jka-compr-byte-compiler-base-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents: 12758
diff changeset
654 (put 'byte-compiler-base-file-name 'jka-compr
e171a85fd6b0 (jka-compr-byte-compiler-base-file-name): New function.
Richard M. Stallman <rms@gnu.org>
parents: 12758
diff changeset
655 'jka-compr-byte-compiler-base-file-name)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656
61946
982afd92d8bb Many functions and vars moved to jka-compr-hook.el.
Richard M. Stallman <rms@gnu.org>
parents: 61601
diff changeset
657 ;;;###autoload
20132
b691f68b0757 (jka-compr-inhibit): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 19004
diff changeset
658 (defvar jka-compr-inhibit nil
b691f68b0757 (jka-compr-inhibit): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 19004
diff changeset
659 "Non-nil means inhibit automatic uncompression temporarily.
b691f68b0757 (jka-compr-inhibit): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 19004
diff changeset
660 Lisp programs can bind this to t to do that.
b691f68b0757 (jka-compr-inhibit): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 19004
diff changeset
661 It is not recommended to set this variable permanently to anything but nil.")
b691f68b0757 (jka-compr-inhibit): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 19004
diff changeset
662
61946
982afd92d8bb Many functions and vars moved to jka-compr-hook.el.
Richard M. Stallman <rms@gnu.org>
parents: 61601
diff changeset
663 ;;;###autoload
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 (defun jka-compr-handler (operation &rest args)
7976
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
665 (save-match-data
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
666 (let ((jka-op (get operation 'jka-compr)))
20132
b691f68b0757 (jka-compr-inhibit): New variable.
Karl Heuer <kwzh@gnu.org>
parents: 19004
diff changeset
667 (if (and jka-op (not jka-compr-inhibit))
7976
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
668 (apply jka-op args)
b72b84744a85 Use plists to record handlers.
Richard M. Stallman <rms@gnu.org>
parents: 7617
diff changeset
669 (jka-compr-run-real-handler operation args)))))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670
7066
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
671 ;; If we are given an operation that we don't handle,
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
672 ;; call the Emacs primitive for that operation,
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
673 ;; and manipulate the inhibit variables
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
674 ;; to prevent the primitive from calling our handler again.
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
675 (defun jka-compr-run-real-handler (operation args)
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
676 (let ((inhibit-file-name-handlers
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
677 (cons 'jka-compr-handler
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
678 (and (eq inhibit-file-name-operation operation)
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
679 inhibit-file-name-handlers)))
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
680 (inhibit-file-name-operation operation))
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
681 (apply operation args)))
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
682
62108
5b31557e355c (jka-compr-uninstall): Add autoload cookie.
Eli Zaretskii <eliz@gnu.org>
parents: 61946
diff changeset
683 ;;;###autoload
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 (defun jka-compr-uninstall ()
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 "Uninstall jka-compr.
7066
de9caaa1de09 Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 6800
diff changeset
686 This removes the entries in `file-name-handler-alist' and `auto-mode-alist'
11296
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
687 and `inhibit-first-line-modes-suffixes' that were added
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
688 by `jka-compr-installed'."
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
689 ;; Delete from inhibit-first-line-modes-suffixes
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
690 ;; what jka-compr-install added.
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
691 (mapcar
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
692 (function (lambda (x)
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
693 (and (jka-compr-info-strip-extension x)
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
694 (setq inhibit-first-line-modes-suffixes
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
695 (delete (jka-compr-info-regexp x)
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
696 inhibit-first-line-modes-suffixes)))))
c271ed10f874 (jka-compr-install): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 11179
diff changeset
697 jka-compr-compression-info-list)
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 (let* ((fnha (cons nil file-name-handler-alist))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 (last fnha))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 (while (cdr last)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 (if (eq (cdr (car (cdr last))) 'jka-compr-handler)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 (setcdr last (cdr (cdr last)))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 (setq last (cdr last))))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 (setq file-name-handler-alist (cdr fnha)))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 (let* ((ama (cons nil auto-mode-alist))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 (last ama)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 entry)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 (while (cdr last)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 (setq entry (car (cdr last)))
9493
0160fca3dee1 (jka-compr-mode-compression-info-list): Add .tgz extension.
Richard M. Stallman <rms@gnu.org>
parents: 9084
diff changeset
715 (if (or (member entry jka-compr-mode-alist-additions)
0160fca3dee1 (jka-compr-mode-compression-info-list): Add .tgz extension.
Richard M. Stallman <rms@gnu.org>
parents: 9084
diff changeset
716 (and (consp (cdr entry))
0160fca3dee1 (jka-compr-mode-compression-info-list): Add .tgz extension.
Richard M. Stallman <rms@gnu.org>
parents: 9084
diff changeset
717 (eq (nth 2 entry) 'jka-compr)))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 (setcdr last (cdr (cdr last)))
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 (setq last (cdr last))))
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
720
19004
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
721 (setq auto-mode-alist (cdr ama)))
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
722
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
723 (let* ((ama (cons nil file-coding-system-alist))
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
724 (last ama)
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
725 entry)
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
726
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
727 (while (cdr last)
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
728 (setq entry (car (cdr last)))
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
729 (if (member entry jka-compr-added-to-file-coding-system-alist)
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
730 (setcdr last (cdr (cdr last)))
f2ce7e947ec9 (jka-compr-added-to-file-coding-system-alist): New var.
Richard M. Stallman <rms@gnu.org>
parents: 18906
diff changeset
731 (setq last (cdr last))))
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49418
diff changeset
732
39829
79ed34b0c0df (jka-compr-load-suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38412
diff changeset
733 (setq file-coding-system-alist (cdr ama)))
79ed34b0c0df (jka-compr-load-suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38412
diff changeset
734
79ed34b0c0df (jka-compr-load-suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38412
diff changeset
735 ;; Remove the suffixes that were added by jka-compr.
79ed34b0c0df (jka-compr-load-suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38412
diff changeset
736 (let ((suffixes nil)
79ed34b0c0df (jka-compr-load-suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38412
diff changeset
737 (re (jka-compr-build-file-regexp)))
79ed34b0c0df (jka-compr-load-suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38412
diff changeset
738 (dolist (suffix load-suffixes)
79ed34b0c0df (jka-compr-load-suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38412
diff changeset
739 (unless (string-match re suffix)
79ed34b0c0df (jka-compr-load-suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38412
diff changeset
740 (push suffix suffixes)))
79ed34b0c0df (jka-compr-load-suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 38412
diff changeset
741 (setq load-suffixes (nreverse suffixes))))
6002
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 (provide 'jka-compr)
7507f44b1e5e Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51284
diff changeset
745 ;;; arch-tag: 3f15b630-e9a7-46c4-a22a-94afdde86ebc
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 34732
diff changeset
746 ;;; jka-compr.el ends here