unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] unsafep: Add support for (funcall)
@ 2017-02-27 18:53 Vibhav Pant
  2017-02-27 20:56 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Vibhav Pant @ 2017-02-27 18:53 UTC (permalink / raw)
  To: emacs-devel@gnu.org

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
vibhavp@gmail.com

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)))))



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-28 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-27 18:53 [PATCH] unsafep: Add support for (funcall) Vibhav Pant
2017-02-27 20:56 ` Stefan Monnier
2017-02-28 15:40   ` Vibhav Pant
2017-02-28 16:18     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).