diff options
| author | Jim Blandy | 1992-08-04 04:09:07 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-08-04 04:09:07 +0000 |
| commit | 0b030df78b499fde5f8dd3f20dd24a2e002fe4ee (patch) | |
| tree | ed9cb2a60f8d627b3d7467bd8610533339e8e528 | |
| parent | 29929437a388ae7dc43fab9f1a9f002162eb4348 (diff) | |
| download | emacs-0b030df78b499fde5f8dd3f20dd24a2e002fe4ee.tar.gz emacs-0b030df78b499fde5f8dd3f20dd24a2e002fe4ee.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/cl.el | 84 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 69 | ||||
| -rw-r--r-- | lisp/lpr.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/hideif.el | 2 |
4 files changed, 99 insertions, 60 deletions
diff --git a/lisp/cl.el b/lisp/cl.el index c86b24ffe2b..b675d926fb8 100644 --- a/lisp/cl.el +++ b/lisp/cl.el | |||
| @@ -691,25 +691,34 @@ list accessors: first, second, ..., tenth, rest." | |||
| 691 | (arg (cadr form)) | 691 | (arg (cadr form)) |
| 692 | (valid *cl-valid-named-list-accessors*) | 692 | (valid *cl-valid-named-list-accessors*) |
| 693 | (offsets *cl-valid-nth-offsets*)) | 693 | (offsets *cl-valid-nth-offsets*)) |
| 694 | (if (or (null (cdr form)) (cddr form)) | 694 | (cond |
| 695 | (error "%s needs exactly one argument, seen `%s'" | 695 | |
| 696 | fun (prin1-to-string form))) | 696 | ;; Check that it's a form we're prepared to handle. |
| 697 | (if (not (memq fun valid)) | 697 | ((not (memq fun valid)) |
| 698 | (error "`%s' not in {first, ..., tenth, rest}" fun)) | 698 | (error |
| 699 | (cond ((eq fun 'first) | 699 | "cl.el internal bug: `%s' not in {first, ..., tenth, rest}" |
| 700 | (byte-compile-form arg) | 700 | fun)) |
| 701 | (setq byte-compile-depth (1- byte-compile-depth)) | 701 | |
| 702 | (byte-compile-out byte-car 0)) | 702 | ;; Check the number of arguments. |
| 703 | ((eq fun 'rest) | 703 | ((not (= (length form) 2)) |
| 704 | (byte-compile-form arg) | 704 | (byte-compile-subr-wrong-args form 1)) |
| 705 | (setq byte-compile-depth (1- byte-compile-depth)) | 705 | |
| 706 | (byte-compile-out byte-cdr 0)) | 706 | ;; If the result will simply be tossed, don't generate any code for |
| 707 | (t ;one of the others | 707 | ;; it, and indicate that we have already discarded the value. |
| 708 | (byte-compile-constant (cdr (assoc fun offsets))) | 708 | (for-effect |
| 709 | (byte-compile-form arg) | 709 | (setq for-effect nil)) |
| 710 | (setq byte-compile-depth (1- byte-compile-depth)) | 710 | |
| 711 | (byte-compile-out byte-nth 0) | 711 | ;; Generate code for the call. |
| 712 | )))) | 712 | ((eq fun 'first) |
| 713 | (byte-compile-form arg) | ||
| 714 | (byte-compile-out 'byte-car 0)) | ||
| 715 | ((eq fun 'rest) | ||
| 716 | (byte-compile-form arg) | ||
| 717 | (byte-compile-out 'byte-cdr 0)) | ||
| 718 | (t ;one of the others | ||
| 719 | (byte-compile-constant (cdr (assq fun offsets))) | ||
| 720 | (byte-compile-form arg) | ||
| 721 | (byte-compile-out 'byte-nth 0))))) | ||
| 713 | 722 | ||
| 714 | ;;; Synonyms for list functions | 723 | ;;; Synonyms for list functions |
| 715 | (defun first (x) | 724 | (defun first (x) |
| @@ -851,18 +860,31 @@ To use this functionality for a given function,just give its name a | |||
| 851 | 'byte-car 'byte-cdr))) | 860 | 'byte-car 'byte-cdr))) |
| 852 | (cdr (nreverse (cdr (append (symbol-name fun) nil))))))) | 861 | (cdr (nreverse (cdr (append (symbol-name fun) nil))))))) |
| 853 | ;; SEQ is a list of byte-car and byte-cdr in the correct order. | 862 | ;; SEQ is a list of byte-car and byte-cdr in the correct order. |
| 854 | (if (null seq) | 863 | (cond |
| 855 | (error "internal: `%s' cannot be compiled by byte-compile-ca*d*r" | 864 | |
| 856 | (prin1-to-string form))) | 865 | ;; Is this a function we can handle? |
| 857 | (if (or (null (cdr form)) (cddr form)) | 866 | ((null seq) |
| 858 | (error "%s needs exactly one argument, seen `%s'" | 867 | (error |
| 859 | fun (prin1-to-string form))) | 868 | "cl.el internal bug: `%s' cannot be compiled by byte-compile-ca*d*r" |
| 860 | (byte-compile-form arg) | 869 | (prin1-to-string form))) |
| 861 | (setq byte-compile-depth (1- byte-compile-depth)) | 870 | |
| 862 | ;; the rest of this code doesn't change the stack depth! | 871 | ;; Are we passing this function the correct number of arguments? |
| 863 | (while seq | 872 | ((or (null (cdr form)) (cddr form)) |
| 864 | (byte-compile-out (car seq) 0) | 873 | (byte-compile-subr-wrong-args form 1)) |
| 865 | (setq seq (cdr seq))))) | 874 | |
| 875 | ;; Are we evaluating this expression for effect only? | ||
| 876 | (for-effect | ||
| 877 | |||
| 878 | ;; We needn't generate any actual code, as long as we tell the rest | ||
| 879 | ;; of the compiler that we didn't push anything on the stack. | ||
| 880 | (setq for-effect nil)) | ||
| 881 | |||
| 882 | ;; Generate code for the function. | ||
| 883 | (t | ||
| 884 | (byte-compile-form arg) | ||
| 885 | (while seq | ||
| 886 | (byte-compile-out (car seq) 0) | ||
| 887 | (setq seq (cdr seq))))))) | ||
| 866 | 888 | ||
| 867 | (defun caar (X) | 889 | (defun caar (X) |
| 868 | "Return the car of the car of X." | 890 | "Return the car of the car of X." |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 344abcb5d11..f9bbf4d6464 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -242,7 +242,8 @@ If it is 'byte, then only byte-level optimizations will be logged.") | |||
| 242 | of `message.'") | 242 | of `message.'") |
| 243 | 243 | ||
| 244 | (defconst byte-compile-warning-types '(redefine callargs free-vars unresolved)) | 244 | (defconst byte-compile-warning-types '(redefine callargs free-vars unresolved)) |
| 245 | (defvar byte-compile-warnings (not noninteractive) | 245 | (defvar byte-compile-warnings (if noninteractive nil |
| 246 | (delq 'free-vars byte-compile-warning-types)) | ||
| 246 | "*List of warnings that the byte-compiler should issue (t for all). | 247 | "*List of warnings that the byte-compiler should issue (t for all). |
| 247 | Valid elements of this list are: | 248 | Valid elements of this list are: |
| 248 | `free-vars' (references to variables not in the | 249 | `free-vars' (references to variables not in the |
| @@ -734,6 +735,14 @@ otherwise pop it") | |||
| 734 | ;;; (message "Warning: %s" format)) | 735 | ;;; (message "Warning: %s" format)) |
| 735 | )) | 736 | )) |
| 736 | 737 | ||
| 738 | ;;; This function should be used to report errors that have halted | ||
| 739 | ;;; compilation of the current file. | ||
| 740 | (defun byte-compile-report-error (error-info) | ||
| 741 | (setq format (format (if (cdr error-info) "%s (%s)" "%s") | ||
| 742 | (get (car error-info) 'error-message) | ||
| 743 | (prin1-to-string (cdr error-info)))) | ||
| 744 | (byte-compile-log-1 (concat "!! " format))) | ||
| 745 | |||
| 737 | ;;; Used by make-obsolete. | 746 | ;;; Used by make-obsolete. |
| 738 | (defun byte-compile-obsolete (form) | 747 | (defun byte-compile-obsolete (form) |
| 739 | (let ((new (get (car form) 'byte-obsolete-info))) | 748 | (let ((new (get (car form) 'byte-obsolete-info))) |
| @@ -1004,7 +1013,11 @@ otherwise pop it") | |||
| 1004 | (save-excursion | 1013 | (save-excursion |
| 1005 | (set-buffer (get-buffer-create "*Compile-Log*")) | 1014 | (set-buffer (get-buffer-create "*Compile-Log*")) |
| 1006 | (point-max))))) | 1015 | (point-max))))) |
| 1007 | (list 'unwind-protect (cons 'progn body) | 1016 | (list 'unwind-protect |
| 1017 | (list 'condition-case 'error-info | ||
| 1018 | (cons 'progn body) | ||
| 1019 | '(error | ||
| 1020 | (byte-compile-report-error error-info))) | ||
| 1008 | '(save-excursion | 1021 | '(save-excursion |
| 1009 | ;; If there were compilation warnings, display them. | 1022 | ;; If there were compilation warnings, display them. |
| 1010 | (set-buffer "*Compile-Log*") | 1023 | (set-buffer "*Compile-Log*") |
| @@ -1090,28 +1103,31 @@ With prefix arg (noninteractively: 2nd arg), load the file after compiling." | |||
| 1090 | (set-auto-mode) | 1103 | (set-auto-mode) |
| 1091 | (setq filename buffer-file-name)) | 1104 | (setq filename buffer-file-name)) |
| 1092 | (kill-buffer (prog1 (current-buffer) | 1105 | (kill-buffer (prog1 (current-buffer) |
| 1093 | (set-buffer (byte-compile-from-buffer (current-buffer))))) | 1106 | (set-buffer |
| 1107 | (byte-compile-from-buffer (current-buffer))))) | ||
| 1094 | (goto-char (point-max)) | 1108 | (goto-char (point-max)) |
| 1095 | (insert "\n") ; aaah, unix. | 1109 | (insert "\n") ; aaah, unix. |
| 1096 | (let ((vms-stmlf-recfm t)) | 1110 | (let ((vms-stmlf-recfm t)) |
| 1097 | (setq target-file (byte-compile-dest-file filename)) | 1111 | (setq target-file (byte-compile-dest-file filename)) |
| 1098 | ;; (or byte-compile-overwrite-file | 1112 | ;; (or byte-compile-overwrite-file |
| 1099 | ;; (condition-case () | 1113 | ;; (condition-case () |
| 1100 | ;; (delete-file target-file) | 1114 | ;; (delete-file target-file) |
| 1101 | ;; (error nil))) | 1115 | ;; (error nil))) |
| 1102 | (if (file-writable-p target-file) | 1116 | (if (file-writable-p target-file) |
| 1103 | (let ((kanji-flag nil)) ; for nemacs, from Nakagawa Takayuki | 1117 | (let ((kanji-flag nil)) ; for nemacs, from Nakagawa Takayuki |
| 1104 | (write-region 1 (point-max) target-file)) | 1118 | (write-region 1 (point-max) target-file)) |
| 1105 | ;; This is just to give a better error message than write-region | 1119 | ;; This is just to give a better error message than |
| 1106 | (signal 'file-error (list "Opening output file" | 1120 | ;; write-region |
| 1107 | (if (file-exists-p target-file) | 1121 | (signal 'file-error |
| 1108 | "cannot overwrite file" | 1122 | (list "Opening output file" |
| 1109 | "directory not writable or nonexistent") | 1123 | (if (file-exists-p target-file) |
| 1110 | target-file))) | 1124 | "cannot overwrite file" |
| 1111 | ;; (or byte-compile-overwrite-file | 1125 | "directory not writable or nonexistent") |
| 1112 | ;; (condition-case () | 1126 | target-file))) |
| 1113 | ;; (set-file-modes target-file (file-modes filename)) | 1127 | ;; (or byte-compile-overwrite-file |
| 1114 | ;; (error nil))) | 1128 | ;; (condition-case () |
| 1129 | ;; (set-file-modes target-file (file-modes filename)) | ||
| 1130 | ;; (error nil))) | ||
| 1115 | ) | 1131 | ) |
| 1116 | (kill-buffer (current-buffer))) | 1132 | (kill-buffer (current-buffer))) |
| 1117 | (if (and byte-compile-generate-call-tree | 1133 | (if (and byte-compile-generate-call-tree |
| @@ -1180,17 +1196,17 @@ With argument, insert value in current buffer after the form." | |||
| 1180 | (byte-compile-depth 0) | 1196 | (byte-compile-depth 0) |
| 1181 | (byte-compile-maxdepth 0) | 1197 | (byte-compile-maxdepth 0) |
| 1182 | (byte-compile-output nil) | 1198 | (byte-compile-output nil) |
| 1183 | ;; #### This is bound in b-c-close-variables. | 1199 | ;; #### This is bound in b-c-close-variables. |
| 1184 | ;;(byte-compile-warnings (if (eq byte-compile-warnings t) | 1200 | ;; (byte-compile-warnings (if (eq byte-compile-warnings t) |
| 1185 | ;; byte-compile-warning-types | 1201 | ;; byte-compile-warning-types |
| 1186 | ;; byte-compile-warnings)) | 1202 | ;; byte-compile-warnings)) |
| 1187 | ) | 1203 | ) |
| 1188 | (byte-compile-close-variables | 1204 | (byte-compile-close-variables |
| 1189 | (save-excursion | 1205 | (save-excursion |
| 1190 | (setq outbuffer | 1206 | (setq outbuffer |
| 1191 | (set-buffer (get-buffer-create " *Compiler Output*"))) | 1207 | (set-buffer (get-buffer-create " *Compiler Output*"))) |
| 1192 | (erase-buffer) | 1208 | (erase-buffer) |
| 1193 | ;; (emacs-lisp-mode) | 1209 | ;; (emacs-lisp-mode) |
| 1194 | (setq case-fold-search nil)) | 1210 | (setq case-fold-search nil)) |
| 1195 | (displaying-byte-compile-warnings | 1211 | (displaying-byte-compile-warnings |
| 1196 | (save-excursion | 1212 | (save-excursion |
| @@ -1206,8 +1222,9 @@ With argument, insert value in current buffer after the form." | |||
| 1206 | (byte-compile-flush-pending) | 1222 | (byte-compile-flush-pending) |
| 1207 | (and (not eval) (byte-compile-insert-header)) | 1223 | (and (not eval) (byte-compile-insert-header)) |
| 1208 | (byte-compile-warn-about-unresolved-functions) | 1224 | (byte-compile-warn-about-unresolved-functions) |
| 1209 | ;; always do this? When calling multiple files, it would be useful | 1225 | ;; always do this? When calling multiple files, it |
| 1210 | ;; to delay this warning until all have been compiled. | 1226 | ;; would be useful to delay this warning until all have |
| 1227 | ;; been compiled. | ||
| 1211 | (setq byte-compile-unresolved-functions nil))) | 1228 | (setq byte-compile-unresolved-functions nil))) |
| 1212 | (save-excursion | 1229 | (save-excursion |
| 1213 | (set-buffer outbuffer) | 1230 | (set-buffer outbuffer) |
diff --git a/lisp/lpr.el b/lisp/lpr.el index 5dad2f86c0c..52f5abc5220 100644 --- a/lisp/lpr.el +++ b/lisp/lpr.el | |||
| @@ -76,7 +76,7 @@ See definition of `print-region-1' for calling conventions.") | |||
| 76 | (if page-headers | 76 | (if page-headers |
| 77 | (if (eq system-type 'usg-unix-v) | 77 | (if (eq system-type 'usg-unix-v) |
| 78 | (progn | 78 | (progn |
| 79 | (print-region-new-buffer) | 79 | (print-region-new-buffer start end) |
| 80 | (call-process-region start end "pr" t t nil)) | 80 | (call-process-region start end "pr" t t nil)) |
| 81 | ;; On BSD, use an option to get page headers. | 81 | ;; On BSD, use an option to get page headers. |
| 82 | (setq switches (cons "-p" switches)))) | 82 | (setq switches (cons "-p" switches)))) |
| @@ -92,7 +92,7 @@ See definition of `print-region-1' for calling conventions.") | |||
| 92 | ;; into a new buffer, makes that buffer current, | 92 | ;; into a new buffer, makes that buffer current, |
| 93 | ;; and sets start and end to the buffer bounds. | 93 | ;; and sets start and end to the buffer bounds. |
| 94 | ;; start and end are used free. | 94 | ;; start and end are used free. |
| 95 | (defun print-region-new-buffer () | 95 | (defun print-region-new-buffer (start end) |
| 96 | (or (string= (buffer-name) " *spool temp*") | 96 | (or (string= (buffer-name) " *spool temp*") |
| 97 | (let ((oldbuf (current-buffer))) | 97 | (let ((oldbuf (current-buffer))) |
| 98 | (set-buffer (get-buffer-create " *spool temp*")) | 98 | (set-buffer (get-buffer-create " *spool temp*")) |
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index b29ebe6bf56..16178c018e2 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el | |||
| @@ -582,7 +582,7 @@ NOT including one on this line." | |||
| 582 | (hif-endif-to-ifdef)) | 582 | (hif-endif-to-ifdef)) |
| 583 | ((hif-looking-at-ifX) | 583 | ((hif-looking-at-ifX) |
| 584 | 'done) | 584 | 'done) |
| 585 | (t ; never gets here))) | 585 | (t))) ; never gets here |
| 586 | 586 | ||
| 587 | 587 | ||
| 588 | (defun forward-ifdef (&optional arg) | 588 | (defun forward-ifdef (&optional arg) |