diff options
| author | Daniel Colascione | 2015-03-14 16:32:04 -0700 |
|---|---|---|
| committer | Daniel Colascione | 2015-03-14 16:32:04 -0700 |
| commit | 554001dfa90be447dc0c71c596eb837d8e3b374b (patch) | |
| tree | 1550781b31d7db94878ff42c4d514a08175dc3b7 | |
| parent | 3bf369928e44fd83c27ef436b05d9cd2b4abbfba (diff) | |
| download | emacs-554001dfa90be447dc0c71c596eb837d8e3b374b.tar.gz emacs-554001dfa90be447dc0c71c596eb837d8e3b374b.zip | |
Type checking for `define-widget'
* lisp/widget.el (define-widget): Check that documentation is a string
or nil; prevent wailing and gnashing of teeth when users forget to
pass a docstring and wonder why their properties don't work.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/widget.el | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8da573ed2f7..5004924e9d3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2015-03-14 Daniel Colascione <dancol@dancol.org> | 1 | 2015-03-14 Daniel Colascione <dancol@dancol.org> |
| 2 | 2 | ||
| 3 | * widget.el (define-widget): Check that documentation is a string | ||
| 4 | or nil; prevent wailing and gnashing of teeth when users forget to | ||
| 5 | pass a docstring and wonder why their properties don't work. | ||
| 6 | |||
| 3 | * startup.el (command-line): Process "--no-x-resources". | 7 | * startup.el (command-line): Process "--no-x-resources". |
| 4 | 8 | ||
| 5 | 2015-03-13 Kevin Ryde <user42_kevin@yahoo.com.au> | 9 | 2015-03-13 Kevin Ryde <user42_kevin@yahoo.com.au> |
diff --git a/lisp/widget.el b/lisp/widget.el index f8faa0f379b..539f91e63a0 100644 --- a/lisp/widget.el +++ b/lisp/widget.el | |||
| @@ -83,6 +83,9 @@ create identical widgets: | |||
| 83 | * (apply 'widget-create CLASS ARGS) | 83 | * (apply 'widget-create CLASS ARGS) |
| 84 | 84 | ||
| 85 | The third argument DOC is a documentation string for the widget." | 85 | The third argument DOC is a documentation string for the widget." |
| 86 | ;; | ||
| 87 | (unless (or (null doc) (stringp doc)) | ||
| 88 | (error "widget documentation must be `nil' or a string.")) | ||
| 86 | (put name 'widget-type (cons class args)) | 89 | (put name 'widget-type (cons class args)) |
| 87 | (put name 'widget-documentation (purecopy doc)) | 90 | (put name 'widget-documentation (purecopy doc)) |
| 88 | name) | 91 | name) |