emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master cbf1c1f 2/2: Merge branch 'master' of git.savannah.


From: Eli Zaretskii
Subject: [Emacs-diffs] master cbf1c1f 2/2: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Date: Mon, 09 Feb 2015 16:31:00 +0000

branch: master
commit cbf1c1f2c7d38b732c3e76c677478ed30a4fee14
Merge: 403cb17 2973127
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
---
 lisp/ChangeLog                |    7 +++++++
 lisp/emacs-lisp/cl-generic.el |   13 ++++---------
 lisp/emacs-lisp/eieio-core.el |    2 ++
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9ca0c30..e86d62d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+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!
+
 2015-02-09  Christopher Genovese  <address@hidden>  (tiny change)
 
        * help-fns.el (help-fns--signature): Keep doc for keymap.
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 ()
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index fa8fefa..e71c54d 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -1010,6 +1010,8 @@ Fills in the default value in CLASS' in SLOT with VALUE."
           (signal 'invalid-slot-name (list (eieio--class-symbol class) slot)))
       (eieio--validate-slot-value class c value slot)
       ;; Set this into the storage for defaults.
+      (if (eieio-eval-default-p value)
+          (error "Can't set default to a sexp that gets evaluated again"))
       (setcar (nthcdr (- c (eval-when-compile eieio--object-num-slots))
                       (eieio--class-public-d class))
               value)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]