summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/cl-macs.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 945da1fb39f..40342f3fe48 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2745,7 +2745,23 @@ non-nil value, that slot cannot be set via `setf'.
`(nth ,pos cl-x))))
forms)
(when (cl-oddp (length desc))
- (error "Invalid options for slot %s in %s" slot name))
+ (push
+ (macroexp--warn-and-return
+ (format "Missing value for option `%S' of slot `%s' in struct %s!"
+ (car (last desc)) slot name)
+ 'nil)
+ forms)
+ (when (and (keywordp (car defaults))
+ (not (keywordp (car desc))))
+ (let ((kw (car defaults)))
+ (push
+ (macroexp--warn-and-return
+ (format " I'll take `%s' to be an option rather than a default value."
+ kw)
+ 'nil)
+ forms)
+ (push kw desc)
+ (setcar defaults nil))))
(if (plist-get desc ':read-only)
(push `(gv-define-expander ,accessor
(lambda (_cl-do _cl-x)