Mercurial > hg > xemacs-beta
comparison lisp/code-files.el @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | 8626e4521993 |
children | de805c49cfc1 |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
3 ;; Copyright (C) 1992,93,94,95 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992,93,94,95 Free Software Foundation, Inc. |
4 ;; Copyright (C) 1995 Amdahl Corporation. | 4 ;; Copyright (C) 1995 Amdahl Corporation. |
5 ;; Copyright (C) 1995 Sun Microsystems. | 5 ;; Copyright (C) 1995 Sun Microsystems. |
6 | 6 |
7 ;; This file is part of XEmacs. | 7 ;; This file is part of XEmacs. |
8 | |
9 ;; This file is very similar to mule-files.el | |
10 | 8 |
11 ;; XEmacs is free software; you can redistribute it and/or modify it | 9 ;; XEmacs is free software; you can redistribute it and/or modify it |
12 ;; under the terms of the GNU General Public License as published by | 10 ;; under the terms of the GNU General Public License as published by |
13 ;; the Free Software Foundation; either version 2, or (at your option) | 11 ;; the Free Software Foundation; either version 2, or (at your option) |
14 ;; any later version. | 12 ;; any later version. |
21 ;; You should have received a copy of the GNU General Public License | 19 ;; You should have received a copy of the GNU General Public License |
22 ;; along with XEmacs; see the file COPYING. If not, write to the | 20 ;; along with XEmacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
24 ;; Boston, MA 02111-1307, USA. | 22 ;; Boston, MA 02111-1307, USA. |
25 | 23 |
24 ;;; Synched up with: Not synched. | |
25 | |
26 ;;; Commentary: | 26 ;;; Commentary: |
27 | 27 |
28 ;;; Derived from mule.el in the original Mule but heavily modified | 28 ;; Derived from mule.el in the original Mule but heavily modified |
29 ;;; by Ben Wing. | 29 ;; by Ben Wing. |
30 | 30 |
31 ;; 1997/3/11 modified by MORIOKA Tomohiko to sync with Emacs 20 API. | 31 ;; 1997/3/11 modified by MORIOKA Tomohiko to sync with Emacs 20 API. |
32 | 32 |
33 ;; This file was derived from the former mule-files.el which has been removed | |
34 ;; as of XEmacs 21.2.15. | |
35 | |
33 ;;; Code: | 36 ;;; Code: |
34 | 37 |
35 (setq-default buffer-file-coding-system 'no-conversion) | 38 (setq-default buffer-file-coding-system 'raw-text) |
36 (put 'buffer-file-coding-system 'permanent-local t) | 39 (put 'buffer-file-coding-system 'permanent-local t) |
37 | 40 |
38 (define-obsolete-variable-alias | 41 (define-obsolete-variable-alias |
39 'file-coding-system | 42 'file-coding-system |
40 'buffer-file-coding-system) | 43 'buffer-file-coding-system) |
269 (if handler | 272 (if handler |
270 (funcall handler 'load filename noerror nomessage nosuffix) | 273 (funcall handler 'load filename noerror nomessage nosuffix) |
271 (if (or (<= (length filename) 0) | 274 (if (or (<= (length filename) 0) |
272 (null (setq path | 275 (null (setq path |
273 (locate-file filename load-path | 276 (locate-file filename load-path |
274 (and (not nosuffix) ".elc:.el:"))))) | 277 (and (not nosuffix) '(".elc" ".el" "")))))) |
275 (and (null noerror) | 278 (and (null noerror) |
276 (signal 'file-error (list "Cannot open load file" filename))) | 279 (signal 'file-error (list "Cannot open load file" filename))) |
277 ;; now use the internal load to actually load the file. | 280 ;; now use the internal load to actually load the file. |
278 (load-internal | 281 (load-internal |
279 file noerror nomessage nosuffix | 282 file noerror nomessage nosuffix |
282 (or (and (not elc) coding-system-for-read) ; prefer for source file | 285 (or (and (not elc) coding-system-for-read) ; prefer for source file |
283 ;; find magic-cookie | 286 ;; find magic-cookie |
284 (save-excursion | 287 (save-excursion |
285 (set-buffer (get-buffer-create " *load*")) | 288 (set-buffer (get-buffer-create " *load*")) |
286 (erase-buffer) | 289 (erase-buffer) |
287 (let ((coding-system-for-read 'no-conversion)) | 290 (let ((coding-system-for-read 'raw-text)) |
288 (insert-file-contents path nil 1 3001)) | 291 (insert-file-contents path nil 1 3001)) |
289 (find-coding-system-magic-cookie)) | 292 (find-coding-system-magic-cookie)) |
290 (if elc | 293 (if elc |
291 ;; if reading a byte-compiled file and we didn't find | 294 ;; if reading a byte-compiled file and we didn't find |
292 ;; a coding-system magic cookie, then use `binary'. | 295 ;; a coding-system magic cookie, then use `binary'. |
369 it means replace the current buffer contents (in the accessible portion) | 372 it means replace the current buffer contents (in the accessible portion) |
370 with the file contents. This is better than simply deleting and inserting | 373 with the file contents. This is better than simply deleting and inserting |
371 the whole thing because (1) it preserves some marker positions | 374 the whole thing because (1) it preserves some marker positions |
372 and (2) it puts less data in the undo list. | 375 and (2) it puts less data in the undo list. |
373 | 376 |
374 NOTE: When Mule support is enabled, the REPLACE argument is | |
375 currently ignored. | |
376 | |
377 The coding system used for decoding the file is determined as follows: | 377 The coding system used for decoding the file is determined as follows: |
378 | 378 |
379 1. `coding-system-for-read', if non-nil. | 379 1. `coding-system-for-read', if non-nil. |
380 2. The result of `insert-file-contents-pre-hook', if non-nil. | 380 2. The result of `insert-file-contents-pre-hook', if non-nil. |
381 3. The matching value for this filename from | 381 3. The matching value for this filename from |
382 `file-coding-system-alist', if any. | 382 `file-coding-system-alist', if any. |
383 4. `buffer-file-coding-system-for-read', if non-nil. | 383 4. `buffer-file-coding-system-for-read', if non-nil. |
384 5. The coding system 'no-conversion. | 384 5. The coding system 'raw-text. |
385 | 385 |
386 If a local value for `buffer-file-coding-system' in the current buffer | 386 If a local value for `buffer-file-coding-system' in the current buffer |
387 does not exist, it is set to the coding system which was actually used | 387 does not exist, it is set to the coding system which was actually used |
388 for reading. | 388 for reading. |
389 | 389 |
408 ;; #3. | 408 ;; #3. |
409 (find-file-coding-system-for-read-from-filename filename) | 409 (find-file-coding-system-for-read-from-filename filename) |
410 ;; #4. | 410 ;; #4. |
411 buffer-file-coding-system-for-read | 411 buffer-file-coding-system-for-read |
412 ;; #5. | 412 ;; #5. |
413 'no-conversion)) | 413 'raw-text)) |
414 (if (consp coding-system) | 414 (if (consp coding-system) |
415 (setq return-val coding-system) | 415 (setq return-val coding-system) |
416 (if (null (find-coding-system coding-system)) | 416 (if (null (find-coding-system coding-system)) |
417 (progn | 417 (progn |
418 (message | 418 (message |
553 coding-system))) | 553 coding-system))) |
554 (run-hook-with-args 'write-region-post-hook | 554 (run-hook-with-args 'write-region-post-hook |
555 start end filename append visit lockname | 555 start end filename append visit lockname |
556 coding-system))) | 556 coding-system))) |
557 | 557 |
558 ;;; mule-files.el ends here | 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 |