comparison lisp/code-files.el @ 367:a4f53d9b3154 r21-1-13

Import from CVS: tag r21-1-13
author cvs
date Mon, 13 Aug 2007 11:01:07 +0200
parents 3b3709405255
children cc15677e0335
comparison
equal deleted inserted replaced
366:83d76f480a59 367:a4f53d9b3154
69 ("TUTORIAL\\.pl$" . iso-8859-2) 69 ("TUTORIAL\\.pl$" . iso-8859-2)
70 ("TUTORIAL\\.ro$" . iso-8859-2) 70 ("TUTORIAL\\.ro$" . iso-8859-2)
71 ;; ("\\.\\(el\\|emacs\\|info\\(-[0-9]+\\)?\\|texi\\)$" . iso-2022-8) 71 ;; ("\\.\\(el\\|emacs\\|info\\(-[0-9]+\\)?\\|texi\\)$" . iso-2022-8)
72 ;; ("\\(ChangeLog\\|CHANGES-beta\\)$" . iso-2022-8) 72 ;; ("\\(ChangeLog\\|CHANGES-beta\\)$" . iso-2022-8)
73 ("\\.\\(gz\\|Z\\)$" . binary) 73 ("\\.\\(gz\\|Z\\)$" . binary)
74 ("/spool/mail/.*$" . convert-mbox-coding-system)) 74
75 ;; This idea is totally broken, and the code didn't work anyway.
76 ;; Mailboxes should be decoded by mail clients, who actually know
77 ;; how to deal with them. Otherwise, their contents should be
78 ;; treated as `binary'.
79 ;("/spool/mail/.*$" . convert-mbox-coding-system)
80 )
75 "Alist to decide a coding system to use for a file I/O operation. 81 "Alist to decide a coding system to use for a file I/O operation.
76 The format is ((PATTERN . VAL) ...), 82 The format is ((PATTERN . VAL) ...),
77 where PATTERN is a regular expression matching a file name, 83 where PATTERN is a regular expression matching a file name,
78 VAL is a coding system, a cons of coding systems, or a function symbol. 84 VAL is a coding system, a cons of coding systems, or a function symbol.
79 If VAL is a coding system, it is used for both decoding and encoding 85 If VAL is a coding system, it is used for both decoding and encoding
192 ) 198 )
193 (cond ((consp codesys) (find-coding-system (cdr codesys))) 199 (cond ((consp codesys) (find-coding-system (cdr codesys)))
194 ((find-coding-system codesys)) 200 ((find-coding-system codesys))
195 )))) 201 ))))
196 202
197 (defun convert-mbox-coding-system (filename visit start end) 203 ;; This is completely broken, not only in implementation (does not
198 "Decoding function for Unix mailboxes. 204 ;; understand MIME), but in concept -- such high-level decoding should
199 Does separate detection and decoding on each message, since each 205 ;; be done by mail readers, not by IO code!
200 message might be in a different encoding." 206
201 (let ((buffer-read-only nil)) 207 ;(defun convert-mbox-coding-system (filename visit start end)
202 (save-restriction 208 ;...
203 (narrow-to-region start end)
204 (goto-char (point-min))
205 (while (not (eobp))
206 (let ((start (point))
207 end)
208 (forward-char 1)
209 (if (re-search-forward "^From" nil 'move)
210 (beginning-of-line))
211 (setq end (point))
212 (decode-coding-region start end 'undecided))))))
213 209
214 (defun find-coding-system-magic-cookie () 210 (defun find-coding-system-magic-cookie ()
215 "Look for the coding-system magic cookie in the current buffer.\n" 211 "Look for the coding-system magic cookie in the current buffer.\n"
216 "The coding-system magic cookie is the exact string\n" 212 "The coding-system magic cookie is the exact string\n"
217 "\";;;###coding system: \" followed by a valid coding system symbol,\n" 213 "\";;;###coding system: \" followed by a valid coding system symbol,\n"