comparison lisp/packages/jka-compr.el @ 189:489f57a838ef r20-3b21

Import from CVS: tag r20-3b21
author cvs
date Mon, 13 Aug 2007 09:57:07 +0200
parents 43dd3413c7c7
children e45d5e7c476e
comparison
equal deleted inserted replaced
188:e29a8e7498d9 189:489f57a838ef
103 103
104 (defgroup compression nil 104 (defgroup compression nil
105 "Data compression utilities" 105 "Data compression utilities"
106 :group 'data) 106 :group 'data)
107 107
108 (progn 108 (defgroup jka-compr nil
109 (defgroup jka-compr nil 109 "jka-compr customization"
110 "jka-compr customization" 110 :group 'compression)
111 :group 'compression)
112 )
113 111
114 112
115 (defcustom jka-compr-shell "sh" 113 (defcustom jka-compr-shell "sh"
116 "*Shell to be used for calling compression programs. 114 "*Shell to be used for calling compression programs.
117 The value of this variable only matters if you want to discard the 115 The value of this variable only matters if you want to discard the
173 before attempting to set the mode. 171 before attempting to set the mode.
174 172
175 Because of the way `call-process' is defined, discarding the stderr output of 173 Because of the way `call-process' is defined, discarding the stderr output of
176 a program adds the overhead of starting a shell each time the program is 174 a program adds the overhead of starting a shell each time the program is
177 invoked." 175 invoked."
178 :type '(repeat (vector regexp 176 :type '(repeat (vector :tag "Compression Technique"
177 regexp
179 (choice :tag "Compress Message" 178 (choice :tag "Compress Message"
180 (string :format "%v") 179 (string :format "%v")
181 (const :tag "No Message" nil)) 180 (const :tag "No Message" nil))
182 (string :tag "Compress Program") 181 (string :tag "Compress Program")
183 (repeat :tag "Compress Arguments" string) 182 (repeat :tag "Compress Arguments" string)
229 228
230 (defvar jka-compr-acceptable-retval-list '(0 2 141)) 229 (defvar jka-compr-acceptable-retval-list '(0 2 141))
231 230
232 231
233 (defun jka-compr-error (prog args infile message &optional errfile) 232 (defun jka-compr-error (prog args infile message &optional errfile)
234
235 (let ((errbuf (get-buffer-create " *jka-compr-error*")) 233 (let ((errbuf (get-buffer-create " *jka-compr-error*"))
236 (curbuf (current-buffer))) 234 (curbuf (current-buffer)))
237 (set-buffer errbuf) 235 (set-buffer errbuf)
238 (widen) (erase-buffer) 236 (widen) (erase-buffer)
239 (insert (format "Error while executing \"%s %s < %s\"\n\n" 237 (insert (format "Error while executing \"%s %s < %s\"\n\n"
244 (and errfile 242 (and errfile
245 (insert-file-contents errfile)) 243 (insert-file-contents errfile))
246 244
247 (set-buffer curbuf) 245 (set-buffer curbuf)
248 (display-buffer errbuf)) 246 (display-buffer errbuf))
249 247 (signal 'compression-error (list "Opening input file"
250 (signal 'compression-error (list "Opening input file" (format "error %s" message) infile))) 248 (format "error %s" message)
251 249 infile)))
252 250
251
253 (defvar jka-compr-dd-program 252 (defvar jka-compr-dd-program
254 "/bin/dd") 253 "/bin/dd")
255 254
256 255
257 (defvar jka-compr-dd-blocksize 256) 256 (defvar jka-compr-dd-blocksize 256)
860 "Return non-nil if jka-compr is installed. 859 "Return non-nil if jka-compr is installed.
861 The return value is the entry in `file-name-handler-alist' for jka-compr." 860 The return value is the entry in `file-name-handler-alist' for jka-compr."
862 (rassq 'jka-compr-handler file-name-handler-alist)) 861 (rassq 'jka-compr-handler file-name-handler-alist))
863 862
864 863
865 ;;; Add the file I/O hook if it does not already exist. 864 ;; No no no no!
866 ;;; Make sure that jka-compr-file-name-handler-entry is eq to the 865 ;(jka-compr-install)
867 ;;; entry for jka-compr in file-name-handler-alist.
868 (and (jka-compr-installed-p)
869 (jka-compr-uninstall))
870
871 (jka-compr-install)
872 866
873 867
874 (provide 'jka-compr) 868 (provide 'jka-compr)
875 869
876 ;; jka-compr.el ends here. 870 ;; jka-compr.el ends here.