comparison lisp/international/mule-util.el @ 18875:754d9d9e851e

(modify-coding-system-alist): Move to mule.el
author Geoff Voelker <voelker@cs.washington.edu>
date Sun, 20 Jul 1997 01:32:15 +0000
parents 8b4a66c66dd6
children 8f73ca5bbaeb
comparison
equal deleted inserted replaced
18874:e44ac570f54f 18875:754d9d9e851e
277 (setcdr tail (cdr (cdr tail))) 277 (setcdr tail (cdr (cdr tail)))
278 (setq tail (cdr tail)))) 278 (setq tail (cdr tail))))
279 codings))) 279 codings)))
280 280
281 ;;;###autoload 281 ;;;###autoload
282 (defun modify-coding-system-alist (target-type regexp coding-system)
283 "Modify one of look up tables for finding a coding system on I/O operation.
284 There are three of such tables, file-coding-system-alist,
285 process-coding-system-alist, and network-coding-system-alist.
286
287 TARGET-TYPE specifies which of them to modify.
288 If it is `file', it affects file-coding-system-alist (which see).
289 If it is `process', it affects process-coding-system-alist (which see).
290 If it is `network', it affects network-codign-system-alist (which see).
291
292 REGEXP is a regular expression matching a target of I/O operation.
293 The target is a file name if TARGET-TYPE is `file', a program name if
294 TARGET-TYPE is `process', or a network service name or a port number
295 to connect to if TARGET-TYPE is `network'.
296
297 CODING-SYSTEM is a coding system to perform code conversion on the I/O
298 operation, or a cons of coding systems for decoding and encoding
299 respectively, or a function symbol which returns the cons."
300 (or (memq target-type '(file process network))
301 (error "Invalid target type: %s" target-type))
302 (or (stringp regexp)
303 (and (eq target-type 'network) (integerp regexp))
304 (error "Invalid regular expression: %s" regexp))
305 (if (symbolp coding-system)
306 (if (not (fboundp coding-system))
307 (progn
308 (check-coding-system coding-system)
309 (setq coding-system (cons coding-system coding-system))))
310 (check-coding-system (car coding-system))
311 (check-coding-system (cdr coding-system)))
312 (cond ((eq target-type 'file)
313 (let ((slot (assoc regexp file-coding-system-alist)))
314 (if slot
315 (setcdr slot coding-system)
316 (setq file-coding-system-alist
317 (cons (cons regexp coding-system)
318 file-coding-system-alist)))))
319 ((eq target-type 'process)
320 (let ((slot (assoc regexp process-coding-system-alist)))
321 (if slot
322 (setcdr slot coding-system)
323 (setq process-coding-system-alist
324 (cons (cons regexp coding-system)
325 process-coding-system-alist)))))
326 (t
327 (let ((slot (assoc regexp network-coding-system-alist)))
328 (if slot
329 (setcdr slot coding-system)
330 (setq network-coding-system-alist
331 (cons (cons regexp coding-system)
332 network-coding-system-alist)))))))
333
334 ;;;###autoload
335 (defun coding-system-plist (coding-system) 282 (defun coding-system-plist (coding-system)
336 "Return property list of CODING-SYSTEM." 283 "Return property list of CODING-SYSTEM."
337 (let ((found nil) 284 (let ((found nil)
338 coding-spec eol-type 285 coding-spec eol-type
339 post-read-conversion pre-write-conversion 286 post-read-conversion pre-write-conversion