[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 2973127: * lisp/emacs-lisp/cl-generic.el (cl--gener
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] master 2973127: * lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): Use macroexp-parse-body. |
Date: |
Mon, 09 Feb 2015 15:52:53 +0000 |
branch: master
commit 2973127159944de98f1e4ece7fd46a202e1352c6
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): Use
macroexp-parse-body.
---
lisp/ChangeLog | 2 ++
lisp/emacs-lisp/cl-generic.el | 13 ++++---------
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d902498..e86d62d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
2015-02-09 Stefan Monnier <address@hidden>
+ * emacs-lisp/cl-generic.el (cl--generic-lambda): Use
macroexp-parse-body.
+
* emacs-lisp/eieio-core.el (eieio-oset-default): Catch the unexpected
case where the default value would be re-interpreted as a form!
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 42e6379..c423286 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -243,8 +243,6 @@ This macro can only be used within the lexical scope of a
cl-generic method."
"Make the lambda expression for a method with ARGS and BODY."
(let ((plain-args ())
(specializers nil)
- (doc-string (if (and (stringp (car-safe body)) (cdr body))
- (pop body)))
(mandatory t))
(dolist (arg args)
(push (pcase arg
@@ -255,9 +253,7 @@ This macro can only be used within the lexical scope of a
cl-generic method."
(_ arg))
plain-args))
(setq plain-args (nreverse plain-args))
- (let ((fun `(cl-function (lambda ,plain-args
- ,@(if doc-string (list doc-string))
- ,@body)))
+ (let ((fun `(cl-function (lambda ,plain-args ,@body)))
(macroenv (cons `(cl-generic-current-method-specializers
. ,(lambda () specializers))
macroexpand-all-environment)))
@@ -266,14 +262,13 @@ This macro can only be used within the lexical scope of a
cl-generic method."
;; destructuring args, `declare' and whatnot).
(pcase (macroexpand fun macroenv)
(`#'(lambda ,args . ,body)
- (let* ((doc-string (and doc-string (stringp (car body)) (cdr body)
- (pop body)))
+ (let* ((parsed-body (macroexp-parse-body body))
(cnm (make-symbol "cl--cnm"))
(nmp (make-symbol "cl--nmp"))
(nbody (macroexpand-all
`(cl-flet ((cl-call-next-method ,cnm)
(cl-next-method-p ,nmp))
- ,@body)
+ ,@(cdr parsed-body))
macroenv))
;; FIXME: Rather than `grep' after the fact, the
;; macroexpansion should directly set some flag when cnm
@@ -283,7 +278,7 @@ This macro can only be used within the lexical scope of a
cl-generic method."
(uses-cnm (cl--generic-fgrep (list cnm nmp) nbody)))
(cons (not (not uses-cnm))
`#'(lambda (,@(if uses-cnm (list cnm)) ,@args)
- ,@(if doc-string (list doc-string))
+ ,@(delq nil (car parsed-body))
,(if (not (memq nmp uses-cnm))
nbody
`(let ((,nmp (lambda ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 2973127: * lisp/emacs-lisp/cl-generic.el (cl--generic-lambda): Use macroexp-parse-body.,
Stefan Monnier <=