diff options
| author | Lute Kamstra | 2005-03-14 14:05:13 +0000 |
|---|---|---|
| committer | Lute Kamstra | 2005-03-14 14:05:13 +0000 |
| commit | 623374a56874ced0df041c8e137e501ebf08ddd8 (patch) | |
| tree | 38019b34f2b9b18ee07238a974af90f982050794 | |
| parent | 43314bf6ef825063701459dae7575506b6f70c35 (diff) | |
| download | emacs-623374a56874ced0df041c8e137e501ebf08ddd8.tar.gz emacs-623374a56874ced0df041c8e137e501ebf08ddd8.zip | |
(macro-declaration-function): Move from subr.el.
(dont-compile, eval-when-compile, eval-and-compile): Use declare to
specify indentation.
| -rw-r--r-- | lisp/emacs-lisp/byte-run.el | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index ef426494b68..60fc862676d 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el | |||
| @@ -31,12 +31,36 @@ | |||
| 31 | 31 | ||
| 32 | ;;; Code: | 32 | ;;; Code: |
| 33 | 33 | ||
| 34 | ;; We define macro-declaration-function here because it is needed to | ||
| 35 | ;; handle declarations in macro definitions and this is the first file | ||
| 36 | ;; loaded by loadup.el that uses declarations in macros. | ||
| 37 | |||
| 38 | (defun macro-declaration-function (macro decl) | ||
| 39 | "Process a declaration found in a macro definition. | ||
| 40 | This is set as the value of the variable `macro-declaration-function'. | ||
| 41 | MACRO is the name of the macro being defined. | ||
| 42 | DECL is a list `(declare ...)' containing the declarations. | ||
| 43 | The return value of this function is not used." | ||
| 44 | ;; We can't use `dolist' or `cadr' yet for bootstrapping reasons. | ||
| 45 | (let (d) | ||
| 46 | ;; Ignore the first element of `decl' (it's always `declare'). | ||
| 47 | (while (setq decl (cdr decl)) | ||
| 48 | (setq d (car decl)) | ||
| 49 | (cond ((and (consp d) (eq (car d) 'indent)) | ||
| 50 | (put macro 'lisp-indent-function (car (cdr d)))) | ||
| 51 | ((and (consp d) (eq (car d) 'debug)) | ||
| 52 | (put macro 'edebug-form-spec (car (cdr d)))) | ||
| 53 | (t | ||
| 54 | (message "Unknown declaration %s" d)))))) | ||
| 55 | |||
| 56 | (setq macro-declaration-function 'macro-declaration-function) | ||
| 57 | |||
| 58 | |||
| 34 | ;; Redefined in byte-optimize.el. | 59 | ;; Redefined in byte-optimize.el. |
| 35 | ;; This is not documented--it's not clear that we should promote it. | 60 | ;; This is not documented--it's not clear that we should promote it. |
| 36 | (fset 'inline 'progn) | 61 | (fset 'inline 'progn) |
| 37 | (put 'inline 'lisp-indent-function 0) | 62 | (put 'inline 'lisp-indent-function 0) |
| 38 | 63 | ||
| 39 | |||
| 40 | ;;; Interface to inline functions. | 64 | ;;; Interface to inline functions. |
| 41 | 65 | ||
| 42 | ;; (defmacro proclaim-inline (&rest fns) | 66 | ;; (defmacro proclaim-inline (&rest fns) |
| @@ -105,11 +129,10 @@ was first made obsolete, for example a date or a release number." | |||
| 105 | (put variable 'byte-obsolete-variable (cons new when)) | 129 | (put variable 'byte-obsolete-variable (cons new when)) |
| 106 | variable) | 130 | variable) |
| 107 | 131 | ||
| 108 | (put 'dont-compile 'lisp-indent-function 0) | ||
| 109 | (defmacro dont-compile (&rest body) | 132 | (defmacro dont-compile (&rest body) |
| 110 | "Like `progn', but the body always runs interpreted (not compiled). | 133 | "Like `progn', but the body always runs interpreted (not compiled). |
| 111 | If you think you need this, you're probably making a mistake somewhere." | 134 | If you think you need this, you're probably making a mistake somewhere." |
| 112 | (declare (debug t)) | 135 | (declare (debug t) (indent 0)) |
| 113 | (list 'eval (list 'quote (if (cdr body) (cons 'progn body) (car body))))) | 136 | (list 'eval (list 'quote (if (cdr body) (cons 'progn body) (car body))))) |
| 114 | 137 | ||
| 115 | 138 | ||
| @@ -118,19 +141,17 @@ If you think you need this, you're probably making a mistake somewhere." | |||
| 118 | ;;; definition in the file overrides the magic definitions on the | 141 | ;;; definition in the file overrides the magic definitions on the |
| 119 | ;;; byte-compile-macro-environment. | 142 | ;;; byte-compile-macro-environment. |
| 120 | 143 | ||
| 121 | (put 'eval-when-compile 'lisp-indent-function 0) | ||
| 122 | (defmacro eval-when-compile (&rest body) | 144 | (defmacro eval-when-compile (&rest body) |
| 123 | "Like `progn', but evaluates the body at compile time. | 145 | "Like `progn', but evaluates the body at compile time. |
| 124 | The result of the body appears to the compiler as a quoted constant." | 146 | The result of the body appears to the compiler as a quoted constant." |
| 125 | (declare (debug t)) | 147 | (declare (debug t) (indent 0)) |
| 126 | ;; Not necessary because we have it in b-c-initial-macro-environment | 148 | ;; Not necessary because we have it in b-c-initial-macro-environment |
| 127 | ;; (list 'quote (eval (cons 'progn body))) | 149 | ;; (list 'quote (eval (cons 'progn body))) |
| 128 | (cons 'progn body)) | 150 | (cons 'progn body)) |
| 129 | 151 | ||
| 130 | (put 'eval-and-compile 'lisp-indent-function 0) | ||
| 131 | (defmacro eval-and-compile (&rest body) | 152 | (defmacro eval-and-compile (&rest body) |
| 132 | "Like `progn', but evaluates the body at compile time and at load time." | 153 | "Like `progn', but evaluates the body at compile time and at load time." |
| 133 | (declare (debug t)) | 154 | (declare (debug t) (indent 0)) |
| 134 | ;; Remember, it's magic. | 155 | ;; Remember, it's magic. |
| 135 | (cons 'progn body)) | 156 | (cons 'progn body)) |
| 136 | 157 | ||