Mercurial > hg > xemacs-beta
comparison lisp/mule/mule-files.el @ 120:cca96a509cfe r20-1b12
Import from CVS: tag r20-1b12
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:25:29 +0200 |
parents | 48d667d6f17f |
children | 6608ceec7cf8 |
comparison
equal
deleted
inserted
replaced
119:d101af7320b8 | 120:cca96a509cfe |
---|---|
41 (setq-default buffer-file-coding-system 'iso-2022-8) | 41 (setq-default buffer-file-coding-system 'iso-2022-8) |
42 (put 'buffer-file-coding-system 'permanent-local t) | 42 (put 'buffer-file-coding-system 'permanent-local t) |
43 | 43 |
44 (define-obsolete-variable-alias 'file-coding-system 'buffer-file-coding-system) | 44 (define-obsolete-variable-alias 'file-coding-system 'buffer-file-coding-system) |
45 | 45 |
46 (defvar coding-system-for-write nil | 46 (defvar buffer-file-coding-system-for-read 'automatic-conversion |
47 "Overriding coding system used when writing a file. | |
48 You should *bind* this, not set it. If this is non-nil, it specifies | |
49 the coding system that will be used when a file is wrote in, and | |
50 overrides `buffer-file-coding-system', | |
51 `insert-file-contents-pre-hook', etc. Use those variables instead of | |
52 this one for permanent changes to the environment.") | |
53 | |
54 (defvar coding-system-for-read nil | |
55 "Overriding coding system used when reading a file. | |
56 You should *bind* this, not set it. If this is non-nil, it specifies | |
57 the coding system that will be used when a file is read in, and | |
58 overrides `buffer-file-coding-system-for-read', | |
59 `buffer-file-coding-system-alist', etc. Use those variables instead | |
60 of this one for permanent changes to the environment.") | |
61 | |
62 (defvar buffer-file-coding-system-for-read 'autodetect | |
63 "Coding system used when reading a file. | 47 "Coding system used when reading a file. |
64 This provides coarse-grained control; for finer-grained control, | 48 This provides coarse-grained control; for finer-grained control, |
65 use `buffer-file-coding-system-alist'. From a Lisp program, if you wish | 49 use `buffer-file-coding-system-alist'. From a Lisp program, if you wish |
66 to unilaterally specify the coding system used for one | 50 to unilaterally specify the coding system used for one |
67 particular operation, you should bind the variable | 51 particular operation, you should bind the variable |
174 end) | 158 end) |
175 (forward-char 1) | 159 (forward-char 1) |
176 (if (re-search-forward "^From" nil 'move) | 160 (if (re-search-forward "^From" nil 'move) |
177 (beginning-of-line)) | 161 (beginning-of-line)) |
178 (setq end (point)) | 162 (setq end (point)) |
179 (decode-coding-region start end 'autodetect)))))) | 163 (decode-coding-region start end 'automatic-conversion)))))) |
180 | 164 |
181 (defun find-coding-system-magic-cookie () | 165 (defun find-coding-system-magic-cookie () |
182 "Look for the coding-system magic cookie in the current buffer.\n" | 166 "Look for the coding-system magic cookie in the current buffer.\n" |
183 "The coding-system magic cookie is the exact string\n" | 167 "The coding-system magic cookie is the exact string\n" |
184 "\";;;###coding system: \" followed by a valid coding system symbol,\n" | 168 "\";;;###coding system: \" followed by a valid coding system symbol,\n" |
362 'no-conversion)) | 346 'no-conversion)) |
363 (if (consp coding-system) | 347 (if (consp coding-system) |
364 (setq return-val coding-system) | 348 (setq return-val coding-system) |
365 (if (null (find-coding-system coding-system)) | 349 (if (null (find-coding-system coding-system)) |
366 (progn | 350 (progn |
367 (message "Invalid coding-system (%s), using 'autodetect" | 351 (message |
368 coding-system) | 352 "Invalid coding-system (%s), using 'automatic-conversion" |
369 (setq coding-system 'autodetect))) | 353 coding-system) |
354 (setq coding-system 'automatic-conversion))) | |
370 (setq return-val | 355 (setq return-val |
371 (insert-file-contents-internal filename visit beg end | 356 (insert-file-contents-internal filename visit beg end |
372 replace coding-system | 357 replace coding-system |
373 ;; store here! | 358 ;; store here! |
374 'used-codesys)) | 359 'used-codesys)) |