aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/byte-run.el4
-rw-r--r--lisp/emacs-lisp/cl-macs.el11
2 files changed, 11 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 8c16c172bed..8993a8169dd 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -258,6 +258,9 @@ The return value is undefined.
258 (cons 'prog1 (cons def declarations)) 258 (cons 'prog1 (cons def declarations))
259 def)))))) 259 def))))))
260 260
261(defvar defun-last-function-name nil
262 "Last function name macroexpanded by `defun'.")
263
261;; Now that we defined defmacro we can use it! 264;; Now that we defined defmacro we can use it!
262(defmacro defun (name arglist &optional docstring &rest body) 265(defmacro defun (name arglist &optional docstring &rest body)
263 "Define NAME as a function. 266 "Define NAME as a function.
@@ -280,6 +283,7 @@ The return value is undefined.
280 (and (listp arglist) 283 (and (listp arglist)
281 (null (delq t (mapcar #'symbolp arglist))))) 284 (null (delq t (mapcar #'symbolp arglist)))))
282 (error "Malformed arglist: %s" arglist)) 285 (error "Malformed arglist: %s" arglist))
286 (setq defun-last-function-name name)
283 (let ((decls (cond 287 (let ((decls (cond
284 ((eq (car-safe docstring) 'declare) 288 ((eq (car-safe docstring) 'declare)
285 (prog1 (cdr docstring) (setq docstring nil))) 289 (prog1 (cdr docstring) (setq docstring nil)))
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 75da0394067..235e7d0d75b 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2374,10 +2374,13 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C).
2374 '((0 nil) (1 t) (2 t) (3 t)))) 2374 '((0 nil) (1 t) (2 t) (3 t))))
2375 (safety (assq (nth 1 (assq 'safety (cdr spec))) 2375 (safety (assq (nth 1 (assq 'safety (cdr spec)))
2376 '((0 t) (1 t) (2 t) (3 nil))))) 2376 '((0 t) (1 t) (2 t) (3 nil)))))
2377 (if speed (setq cl--optimize-speed (car speed) 2377 (when speed
2378 byte-optimize (nth 1 speed))) 2378 (setq cl--optimize-speed (car speed)
2379 (if safety (setq cl--optimize-safety (car safety) 2379 byte-optimize (nth 1 speed))
2380 byte-compile-delete-errors (nth 1 safety))))) 2380 (function-put defun-last-function-name 'speed cl--optimize-speed))
2381 (when safety
2382 (setq cl--optimize-safety (car safety)
2383 byte-compile-delete-errors (nth 1 safety)))))
2381 2384
2382 ((and (eq (car-safe spec) 'warn) (boundp 'byte-compile-warnings)) 2385 ((and (eq (car-safe spec) 'warn) (boundp 'byte-compile-warnings))
2383 (while (setq spec (cdr spec)) 2386 (while (setq spec (cdr spec))