From: Glenn Morris Date: Sun, 11 Dec 2016 02:58:24 +0000 (-0800) Subject: Do not allow nil to be defined as a function X-Git-Tag: emacs-26.0.90~1138 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ba8e883fa30f1267c27751c1ee9df25a5dde4c0c;p=emacs.git Do not allow nil to be defined as a function * lisp/emacs-lisp/byte-run.el (defun): * src/data.c (Ffset): Do not allow "nil". (Bug#25110) --- diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 69b4f41fef6..9d2a048f365 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -240,6 +240,7 @@ The return value is undefined. ;; from ;; (defun foo (arg) (toto)). (declare (doc-string 3) (indent 2)) + (or name (error "Cannot define '%s' as a function" name)) (if (null (and (listp arglist) (null (delq t (mapcar #'symbolp arglist))))) diff --git a/src/data.c b/src/data.c index 09d94f57a8e..52cfe4ae4a3 100644 --- a/src/data.c +++ b/src/data.c @@ -733,6 +733,9 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0, { register Lisp_Object function; CHECK_SYMBOL (symbol); + /* Perhaps not quite the right error signal, but seems good enough. */ + if (NILP (symbol)) + xsignal1 (Qsetting_constant, symbol); function = XSYMBOL (symbol)->function;