]> code.delx.au - gnu-emacs/commitdiff
(defstruct): Don't define the default constructor if it is overridden.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 27 Nov 2005 20:59:10 +0000 (20:59 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 27 Nov 2005 20:59:10 +0000 (20:59 +0000)
lisp/emacs-lisp/cl-macs.el

index 74c77128059b8c93e569b1f7b3908a747876cafe..244029491de8948ca43168fcc95cc3d032f19e4e 100644 (file)
@@ -2175,7 +2175,12 @@ copier, a `NAME-p' predicate, and setf-able `NAME-SLOT' accessors.
                                       (symbol-name (car args)) ""))))
              ((eq opt :constructor)
               (if (cdr args)
-                  (push args constrs)
+                   (progn
+                     ;; If this defines a constructor of the same name as
+                     ;; the default one, don't define the default.
+                     (if (eq (car args) constructor)
+                         (setq constructor nil))
+                     (push args constrs))
                 (if args (setq constructor (car args)))))
              ((eq opt :copier)
               (if args (setq copier (car args))))