defun/defmacro autoload generation
[bpt/emacs.git] / lisp / emacs-lisp / byte-run.el
index da1a440..6e6cfc7 100644 (file)
@@ -193,9 +193,11 @@ The return value is undefined.
                          (message "Warning: Unknown macro property %S in %S"
                                   (car x) name))))
                  decls)))
-          (if declarations
-              (cons 'prog1 (cons def declarations))
-            def))))))
+           (list 'progn
+                 (list 'eval-when '(:compile-toplevel :load-toplevel :execute)
+                       def
+                       (cons 'progn declarations))
+                 (list 'quote name)))))))
 
 ;; Now that we defined defmacro we can use it!
 (defmacro defun (name arglist &optional docstring &rest body)
@@ -232,14 +234,7 @@ The return value is undefined.
                    ((and (featurep 'cl)
                          (memq (car x)  ;C.f. cl-do-proclaim.
                                '(special inline notinline optimize warn)))
-                    (push (list 'declare x)
-                          (if (stringp docstring)
-                              (if (eq (car-safe (cadr body)) 'interactive)
-                                  (cddr body)
-                                (cdr body))
-                            (if (eq (car-safe (car body)) 'interactive)
-                                (cdr body)
-                              body)))
+                    (setq body (cons (list 'declare x) body))
                     nil)
                    (t (message "Warning: Unknown defun property `%S' in %S"
                                (car x) name)))))
@@ -249,14 +244,22 @@ The return value is undefined.
                      (list 'function
                            (cons 'lambda
                                  (cons arglist body))))))
-      (if declarations
-          (cons 'prog1 (cons def declarations))
-          def))))
-
+      (list 'progn
+            def
+            (cons 'progn declarations)
+            :autoload-end
+            (list 'funcall
+                  (list '@ '(guile) 'set-procedure-property!)
+                  (list 'symbol-function (list 'quote name))
+                  (list 'quote 'name)
+                  (list 'quote name))
+            (list 'quote name)))))
 \f
 ;; Redefined in byte-optimize.el.
 ;; This is not documented--it's not clear that we should promote it.
-(fset 'inline 'progn)
+
+(defmacro inline (&rest body)
+  (cons 'progn body))
 
 ;;; Interface to inline functions.
 
@@ -285,18 +288,6 @@ The return value is undefined.
 ;;                      (list 'put x ''byte-optimizer nil)))
 ;;             fns)))
 
-(defmacro defsubst (name arglist &rest body)
-  "Define an inline function.  The syntax is just like that of `defun'.
-\(fn NAME ARGLIST &optional DOCSTRING DECL &rest BODY)"
-  (declare (debug defun) (doc-string 3))
-  (or (memq (get name 'byte-optimizer)
-           '(nil byte-compile-inline-expand))
-      (error "`%s' is a primitive" name))
-  `(prog1
-       (defun ,name ,arglist ,@body)
-     (eval-and-compile
-       (put ',name 'byte-optimizer 'byte-compile-inline-expand))))
-
 (defvar advertised-signature-table (make-hash-table :test 'eq :weakness 'key))
 
 (defun set-advertised-calling-convention (function signature _when)