emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] unsafep: Add support for (funcall)


From: Vibhav Pant
Subject: [PATCH] unsafep: Add support for (funcall)
Date: Tue, 28 Feb 2017 00:23:00 +0530

The following patch makes (unsafep) check funcall forms. Right now,
it only works while calling side-effect-free functions like car and cdr.
In the future, I'd like to extend this to add support for looking up and
checking (symbol-function) for other functions too.

Would appreciate some feedback before I push this.


Thanks,
Vibhav

-- 
Vibhav Pant
address@hidden

diff --git a/lisp/emacs-lisp/unsafep.el b/lisp/emacs-lisp/unsafep.el
index 1ab65a044e..beba6895b8 100644
--- a/lisp/emacs-lisp/unsafep.el
+++ b/lisp/emacs-lisp/unsafep.el
@@ -205,6 +205,12 @@ unsafep
        ((eq fun '\`)
  ;; Backquoted form - safe if its expansion is.
  (unsafep (cdr (backquote-process (cadr form)))))
+       ((eq fun 'funcall)
+        (let ((func (nth 1 form))
+              (args (nthcdr 2 form)))
+          (if (eq (car-safe func) 'quote)
+              (unsafep (cons (eval func) args) unsafep-vars)
+            (setq reason `(function ,func)))))
        (t
  ;;First unsafep-function call above wasn't nil, no special case applies
  reason)))))



reply via email to

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