comparison lisp/code-files.el @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 3ecd8885ac67
children 576fb035e263
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
66 ,@(mapcar 66 ,@(mapcar
67 #'(lambda (regexp) (cons regexp 'binary)) binary-file-regexps) 67 #'(lambda (regexp) (cons regexp 'binary)) binary-file-regexps)
68 ("TUTORIAL\\.\\(?:hr\\|pl\\|ro\\)\\'" . iso-8859-2) 68 ("TUTORIAL\\.\\(?:hr\\|pl\\|ro\\)\\'" . iso-8859-2)
69 ;; ("\\.\\(el\\|emacs\\|info\\(-[0-9]+\\)?\\|texi\\)$" . iso-2022-8) 69 ;; ("\\.\\(el\\|emacs\\|info\\(-[0-9]+\\)?\\|texi\\)$" . iso-2022-8)
70 ;; ("\\(ChangeLog\\|CHANGES-beta\\)$" . iso-2022-8) 70 ;; ("\\(ChangeLog\\|CHANGES-beta\\)$" . iso-2022-8)
71 ("/spool/mail/.*$" . convert-mbox-coding-system)) 71
72 ;; This idea is totally broken, and the code didn't work anyway.
73 ;; Mailboxes should be decoded by mail clients, who actually know
74 ;; how to deal with them. Otherwise, their contents should be
75 ;; treated as `binary'.
76 ;("/spool/mail/.*$" . convert-mbox-coding-system)
77 )
72 "Alist to decide a coding system to use for a file I/O operation. 78 "Alist to decide a coding system to use for a file I/O operation.
73 The format is ((PATTERN . VAL) ...), 79 The format is ((PATTERN . VAL) ...),
74 where PATTERN is a regular expression matching a file name, 80 where PATTERN is a regular expression matching a file name,
75 VAL is a coding system, a cons of coding systems, or a function symbol. 81 VAL is a coding system, a cons of coding systems, or a function symbol.
76 If VAL is a coding system, it is used for both decoding and encoding 82 If VAL is a coding system, it is used for both decoding and encoding
189 ) 195 )
190 (cond ((consp codesys) (find-coding-system (cdr codesys))) 196 (cond ((consp codesys) (find-coding-system (cdr codesys)))
191 ((find-coding-system codesys)) 197 ((find-coding-system codesys))
192 )))) 198 ))))
193 199
194 (defun convert-mbox-coding-system (filename visit start end) 200 ;; This is completely broken, not only in implementation (does not
195 "Decoding function for Unix mailboxes. 201 ;; understand MIME), but in concept -- such high-level decoding should
196 Does separate detection and decoding on each message, since each 202 ;; be done by mail readers, not by IO code!
197 message might be in a different encoding." 203
198 (let ((buffer-read-only nil)) 204 ;(defun convert-mbox-coding-system (filename visit start end)
199 (save-restriction 205 ;...
200 (narrow-to-region start end)
201 (goto-char (point-min))
202 (while (not (eobp))
203 (let ((start (point))
204 end)
205 (forward-char 1)
206 (if (re-search-forward "^From" nil 'move)
207 (beginning-of-line))
208 (setq end (point))
209 (decode-coding-region start end 'undecided))))))
210 206
211 (defun find-coding-system-magic-cookie () 207 (defun find-coding-system-magic-cookie ()
212 "Look for the coding-system magic cookie in the current buffer.\n" 208 "Look for the coding-system magic cookie in the current buffer.\n"
213 "The coding-system magic cookie is the exact string\n" 209 "The coding-system magic cookie is the exact string\n"
214 "\";;;###coding system: \" followed by a valid coding system symbol,\n" 210 "\";;;###coding system: \" followed by a valid coding system symbol,\n"
553 coding-system))) 549 coding-system)))
554 (run-hook-with-args 'write-region-post-hook 550 (run-hook-with-args 'write-region-post-hook
555 start end filename append visit lockname 551 start end filename append visit lockname
556 coding-system))) 552 coding-system)))
557 553
558 ;;; The following was all that remained in mule-files.el, so I moved it
559 ;;; here for neatness. -sb
560 (when (featurep 'mule)
561 (setq-default buffer-file-coding-system 'iso-2022-8))
562
563 ;;; code-files.el ends here 554 ;;; code-files.el ends here