emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master ba8e883: Do not allow nil to be defined as a functi


From: Glenn Morris
Subject: [Emacs-diffs] master ba8e883: Do not allow nil to be defined as a function
Date: Sun, 11 Dec 2016 02:58:36 +0000 (UTC)

branch: master
commit ba8e883fa30f1267c27751c1ee9df25a5dde4c0c
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    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)
---
 lisp/emacs-lisp/byte-run.el |    1 +
 src/data.c                  |    3 +++
 2 files changed, 4 insertions(+)

diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 69b4f41..9d2a048 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 09d94f5..52cfe4a 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;
 



reply via email to

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