comparison lisp/bytecomp.el @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 3ecd8885ac67
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
1520 (insert "\n") ; aaah, unix. 1520 (insert "\n") ; aaah, unix.
1521 (setq target-file (byte-compile-dest-file filename)) 1521 (setq target-file (byte-compile-dest-file filename))
1522 (unless byte-compile-overwrite-file 1522 (unless byte-compile-overwrite-file
1523 (ignore-file-errors (delete-file target-file))) 1523 (ignore-file-errors (delete-file target-file)))
1524 (if (file-writable-p target-file) 1524 (if (file-writable-p target-file)
1525 (progn 1525 (write-region 1 (point-max) target-file)
1526 (when (memq system-type '(ms-dos windows-nt))
1527 (defvar buffer-file-type)
1528 (setq buffer-file-type t))
1529 (write-region 1 (point-max) target-file))
1530 ;; This is just to give a better error message than write-region 1526 ;; This is just to give a better error message than write-region
1531 (signal 'file-error 1527 (signal 'file-error
1532 (list "Opening output file" 1528 (list "Opening output file"
1533 (if (file-exists-p target-file) 1529 (if (file-exists-p target-file)
1534 "cannot overwrite file" 1530 "cannot overwrite file"
1747 ;; file if under Mule. If there are any extended characters in the 1743 ;; file if under Mule. If there are any extended characters in the
1748 ;; input file, use `escape-quoted' to make sure that both binary and 1744 ;; input file, use `escape-quoted' to make sure that both binary and
1749 ;; extended characters are output properly and distinguished properly. 1745 ;; extended characters are output properly and distinguished properly.
1750 ;; Otherwise, use `raw-text' for maximum portability with non-Mule 1746 ;; Otherwise, use `raw-text' for maximum portability with non-Mule
1751 ;; Emacsen. 1747 ;; Emacsen.
1752 (when (featurep 'mule) 1748 (when (featurep '(or mule file-coding))
1753 (defvar buffer-file-coding-system) 1749 (defvar buffer-file-coding-system)
1754 (if (save-excursion 1750 (if (or (featurep '(not mule)) ;; Don't scan buffer if we are not muleized
1755 (set-buffer byte-compile-inbuffer) 1751 (save-excursion
1756 (goto-char (point-min)) 1752 (set-buffer byte-compile-inbuffer)
1757 ;; mrb- There must be a better way than skip-chars-forward 1753 (goto-char (point-min))
1758 (skip-chars-forward (concat (char-to-string 0) "-" 1754 ;; mrb- There must be a better way than skip-chars-forward
1759 (char-to-string 255))) 1755 (skip-chars-forward (concat (char-to-string 0) "-"
1760 (eq (point) (point-max))) 1756 (char-to-string 255)))
1761 (setq buffer-file-coding-system 'raw-text) 1757 (eq (point) (point-max))))
1758 (setq buffer-file-coding-system 'raw-text-unix)
1762 (insert "(require 'mule)\n;;;###coding system: escape-quoted\n") 1759 (insert "(require 'mule)\n;;;###coding system: escape-quoted\n")
1763 (setq buffer-file-coding-system 'escape-quoted) 1760 (setq buffer-file-coding-system 'escape-quoted)
1764 ;; #### Lazy loading not yet implemented for MULE files 1761 ;; #### Lazy loading not yet implemented for MULE files
1765 ;; mrb - Fix this someday. 1762 ;; mrb - Fix this someday.
1766 (save-excursion 1763 (save-excursion
1965 (let ((form form)) 1962 (let ((form form))
1966 ;; all forms are constant 1963 ;; all forms are constant
1967 (while (if (setq form (cdr form)) 1964 (while (if (setq form (cdr form))
1968 (byte-compile-constp (car form)))) 1965 (byte-compile-constp (car form))))
1969 (null form))) 1966 (null form)))
1970 ;; eval the macro autoload into the compilation enviroment 1967 ;; eval the macro autoload into the compilation environment
1971 (eval form)) 1968 (eval form))
1972 1969
1973 (if name 1970 (if name
1974 (let ((old (assq name byte-compile-autoload-environment))) 1971 (let ((old (assq name byte-compile-autoload-environment)))
1975 (cond (old 1972 (cond (old