Mercurial > emacs
comparison lisp/emacs-lisp/bytecomp.el @ 2853:5f56b1f00c57
(byte-compile-file): Don't write output if error.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 18 May 1993 02:30:21 +0000 |
parents | e2f296263868 |
children | b858b91dff34 |
comparison
equal
deleted
inserted
replaced
2852:e80e6e533533 | 2853:5f56b1f00c57 |
---|---|
1157 ;; It is important that input-buffer not be current at this call, | 1157 ;; It is important that input-buffer not be current at this call, |
1158 ;; so that the value of point set in input-buffer | 1158 ;; so that the value of point set in input-buffer |
1159 ;; within byte-compile-from-buffer lingers in that buffer. | 1159 ;; within byte-compile-from-buffer lingers in that buffer. |
1160 (setq output-buffer (byte-compile-from-buffer input-buffer)) | 1160 (setq output-buffer (byte-compile-from-buffer input-buffer)) |
1161 (or byte-compiler-error-flag | 1161 (or byte-compiler-error-flag |
1162 (kill-buffer input-buffer)) | 1162 (kill-buffer input-buffer) |
1163 (save-excursion | 1163 (save-excursion |
1164 (set-buffer output-buffer) | 1164 (set-buffer output-buffer) |
1165 (goto-char (point-max)) | 1165 (goto-char (point-max)) |
1166 (insert "\n") ; aaah, unix. | 1166 (insert "\n") ; aaah, unix. |
1167 (let ((vms-stmlf-recfm t)) | 1167 (let ((vms-stmlf-recfm t)) |
1168 (setq target-file (byte-compile-dest-file filename)) | 1168 (setq target-file (byte-compile-dest-file filename)) |
1169 ;; (or byte-compile-overwrite-file | 1169 ;; (or byte-compile-overwrite-file |
1170 ;; (condition-case () | 1170 ;; (condition-case () |
1171 ;; (delete-file target-file) | 1171 ;; (delete-file target-file) |
1172 ;; (error nil))) | 1172 ;; (error nil))) |
1173 (if (file-writable-p target-file) | 1173 (if (file-writable-p target-file) |
1174 (let ((kanji-flag nil)) ; for nemacs, from Nakagawa Takayuki | 1174 (let ((kanji-flag nil)) ; for nemacs, from Nakagawa Takayuki |
1175 (write-region 1 (point-max) target-file)) | 1175 (write-region 1 (point-max) target-file)) |
1176 ;; This is just to give a better error message than | 1176 ;; This is just to give a better error message than |
1177 ;; write-region | 1177 ;; write-region |
1178 (signal 'file-error | 1178 (signal 'file-error |
1179 (list "Opening output file" | 1179 (list "Opening output file" |
1180 (if (file-exists-p target-file) | 1180 (if (file-exists-p target-file) |
1181 "cannot overwrite file" | 1181 "cannot overwrite file" |
1182 "directory not writable or nonexistent") | 1182 "directory not writable or nonexistent") |
1183 target-file))) | 1183 target-file))) |
1184 ;; (or byte-compile-overwrite-file | 1184 ;; (or byte-compile-overwrite-file |
1185 ;; (condition-case () | 1185 ;; (condition-case () |
1186 ;; (set-file-modes target-file (file-modes filename)) | 1186 ;; (set-file-modes target-file (file-modes filename)) |
1187 ;; (error nil))) | 1187 ;; (error nil))) |
1188 ) | 1188 ) |
1189 (kill-buffer (current-buffer))) | 1189 (kill-buffer (current-buffer))) |
1190 (if (and byte-compile-generate-call-tree | 1190 (if (and byte-compile-generate-call-tree |
1191 (or (eq t byte-compile-generate-call-tree) | 1191 (or (eq t byte-compile-generate-call-tree) |
1192 (y-or-n-p (format "Report call tree for %s? " filename)))) | 1192 (y-or-n-p (format "Report call tree for %s? " filename)))) |
1193 (save-excursion | 1193 (save-excursion |
1194 (display-call-tree filename))) | 1194 (display-call-tree filename))) |
1195 (if load | 1195 (if load |
1196 (load target-file))) | 1196 (load target-file)))) |
1197 t) | 1197 t) |
1198 | 1198 |
1199 ;;(defun byte-compile-and-load-file (&optional filename) | 1199 ;;(defun byte-compile-and-load-file (&optional filename) |
1200 ;; "Compile a file of Lisp code named FILENAME into a file of byte code, | 1200 ;; "Compile a file of Lisp code named FILENAME into a file of byte code, |
1201 ;;and then load it. The output file's name is made by appending \"c\" to | 1201 ;;and then load it. The output file's name is made by appending \"c\" to |