Mercurial > hg > xemacs-beta
comparison lisp/code-files.el @ 380:8626e4521993 r21-2-5
Import from CVS: tag r21-2-5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:07:10 +0200 |
parents | cc15677e0335 |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
379:76b7d63099ad | 380:8626e4521993 |
---|---|
55 (define-obsolete-variable-alias | 55 (define-obsolete-variable-alias |
56 'file-coding-system-for-read | 56 'file-coding-system-for-read |
57 'buffer-file-coding-system-for-read) | 57 'buffer-file-coding-system-for-read) |
58 | 58 |
59 (defvar file-coding-system-alist | 59 (defvar file-coding-system-alist |
60 '(("\\.elc$" . (binary . binary)) | 60 `( |
61 ;; This must not be neccessary, slb suggests -kkm | 61 ;; This must not be necessary, slb suggests -kkm |
62 ;; ("loaddefs.el$" . (binary . binary)) | 62 ;; ("loaddefs.el$" . (binary . binary)) |
63 ("\\.tar$" . (binary . binary)) | 63 ,@(mapcar |
64 ("\\.\\(tif\\|tiff\\)$" . (binary . binary)) | 64 #'(lambda (regexp) (cons regexp 'binary)) binary-file-regexps) |
65 ("\\.png$" . (binary . binary)) | 65 ("TUTORIAL\\.\\(?:hr\\|pl\\|ro\\)\\'" . iso-8859-2) |
66 ("\\.gif$" . (binary . binary)) | |
67 ("\\.\\(jpeg\\|jpg\\)$" . (binary . binary)) | |
68 ("TUTORIAL\\.hr$" . iso-8859-2) | |
69 ("TUTORIAL\\.pl$" . iso-8859-2) | |
70 ("TUTORIAL\\.ro$" . iso-8859-2) | |
71 ;; ("\\.\\(el\\|emacs\\|info\\(-[0-9]+\\)?\\|texi\\)$" . iso-2022-8) | 66 ;; ("\\.\\(el\\|emacs\\|info\\(-[0-9]+\\)?\\|texi\\)$" . iso-2022-8) |
72 ;; ("\\(ChangeLog\\|CHANGES-beta\\)$" . iso-2022-8) | 67 ;; ("\\(ChangeLog\\|CHANGES-beta\\)$" . iso-2022-8) |
73 ("\\.\\(gz\\|Z\\)$" . binary) | |
74 ("/spool/mail/.*$" . convert-mbox-coding-system)) | 68 ("/spool/mail/.*$" . convert-mbox-coding-system)) |
75 "Alist to decide a coding system to use for a file I/O operation. | 69 "Alist to decide a coding system to use for a file I/O operation. |
76 The format is ((PATTERN . VAL) ...), | 70 The format is ((PATTERN . VAL) ...), |
77 where PATTERN is a regular expression matching a file name, | 71 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. | 72 VAL is a coding system, a cons of coding systems, or a function symbol. |
104 | 98 |
105 (defun toggle-buffer-file-coding-system () | 99 (defun toggle-buffer-file-coding-system () |
106 "Set EOL type of buffer-file-coding-system of the current buffer to | 100 "Set EOL type of buffer-file-coding-system of the current buffer to |
107 something other than what it is at the moment." | 101 something other than what it is at the moment." |
108 (interactive) | 102 (interactive) |
109 (let ((eol-type | 103 (let ((eol-type |
110 (coding-system-eol-type buffer-file-coding-system))) | 104 (coding-system-eol-type buffer-file-coding-system))) |
111 (setq buffer-file-coding-system | 105 (setq buffer-file-coding-system |
112 (subsidiary-coding-system | 106 (subsidiary-coding-system |
113 (coding-system-base buffer-file-coding-system) | 107 (coding-system-base buffer-file-coding-system) |
114 (cond ((eq eol-type 'lf) 'crlf) | 108 (cond ((eq eol-type 'lf) 'crlf) |
151 The return value will be nil (no applicable entry) or a coding system | 145 The return value will be nil (no applicable entry) or a coding system |
152 object (the entry specified a coding system)." | 146 object (the entry specified a coding system)." |
153 (let ((alist file-coding-system-alist) | 147 (let ((alist file-coding-system-alist) |
154 (found nil) | 148 (found nil) |
155 (codesys nil)) | 149 (codesys nil)) |
156 (let ((case-fold-search (eq system-type 'vax-vms))) | 150 (let ((case-fold-search nil)) |
157 (setq filename (file-name-sans-versions filename)) | 151 (setq filename (file-name-sans-versions filename)) |
158 (while (and (not found) alist) | 152 (while (and (not found) alist) |
159 (if (string-match (car (car alist)) filename) | 153 (if (string-match (car (car alist)) filename) |
160 (setq codesys (cdr (car alist)) | 154 (setq codesys (cdr (car alist)) |
161 found t)) | 155 found t)) |
177 The return value will be nil (no applicable entry) or a coding system | 171 The return value will be nil (no applicable entry) or a coding system |
178 object (the entry specified a coding system)." | 172 object (the entry specified a coding system)." |
179 (let ((alist file-coding-system-alist) | 173 (let ((alist file-coding-system-alist) |
180 (found nil) | 174 (found nil) |
181 (codesys nil)) | 175 (codesys nil)) |
182 (let ((case-fold-search (eq system-type 'vax-vms))) | 176 (let ((case-fold-search nil)) |
183 (setq filename (file-name-sans-versions filename)) | 177 (setq filename (file-name-sans-versions filename)) |
184 (while (and (not found) alist) | 178 (while (and (not found) alist) |
185 (if (string-match (car (car alist)) filename) | 179 (if (string-match (car (car alist)) filename) |
186 (setq codesys (cdr (car alist)) | 180 (setq codesys (cdr (car alist)) |
187 found t)) | 181 found t)) |
394 for reading. | 388 for reading. |
395 | 389 |
396 See also `insert-file-contents-access-hook', | 390 See also `insert-file-contents-access-hook', |
397 `insert-file-contents-pre-hook', `insert-file-contents-error-hook', | 391 `insert-file-contents-pre-hook', `insert-file-contents-error-hook', |
398 and `insert-file-contents-post-hook'." | 392 and `insert-file-contents-post-hook'." |
399 (let (return-val coding-system used-codesys conversion-func) | 393 (let (return-val coding-system used-codesys) |
400 ;; OK, first load the file. | 394 ;; OK, first load the file. |
401 (condition-case err | 395 (condition-case err |
402 (progn | 396 (progn |
403 (run-hook-with-args 'insert-file-contents-access-hook | 397 (run-hook-with-args 'insert-file-contents-access-hook |
404 filename visit) | 398 filename visit) |