From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: [PATCH 2/3] Mark some org-babel variables as safe locals under proper conditions Date: Mon, 28 Oct 2013 16:19:02 -0400 Message-ID: <1382991543-14273-3-git-send-email-aaronecay@gmail.com> References: <1382991543-14273-1-git-send-email-aaronecay@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VatHY-0000de-Tq for emacs-orgmode@gnu.org; Mon, 28 Oct 2013 16:19:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VatHN-00079y-CL for emacs-orgmode@gnu.org; Mon, 28 Oct 2013 16:19:24 -0400 Received: from mail-qc0-x229.google.com ([2607:f8b0:400d:c01::229]:51021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VatHN-00079r-8R for emacs-orgmode@gnu.org; Mon, 28 Oct 2013 16:19:13 -0400 Received: by mail-qc0-f169.google.com with SMTP id x12so4152397qcv.0 for ; Mon, 28 Oct 2013 13:19:12 -0700 (PDT) In-Reply-To: <1382991543-14273-1-git-send-email-aaronecay@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * lisp/ob-core.el (org-babel-inline-result-wrap, org-babel-default-header-args, org-babel-default-inline-header-args): mark as safe local variables --- lisp/ob-core.el | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 8fafd4b..60666fc 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -158,6 +158,11 @@ See also `org-babel-noweb-wrap-start'." This string must include a \"%s\" which will be replaced by the results." :group 'org-babel :type 'string) +(put 'org-babel-inline-result-wrap + 'safe-local-variable + (lambda (value) + (and (stringp value) + (string-match-p "%s" value)))) (defun org-babel-noweb-wrap (&optional regexp) (concat org-babel-noweb-wrap-start @@ -484,10 +489,14 @@ specific header arguments as well.") '((:session . "none") (:results . "replace") (:exports . "code") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")) "Default arguments to use when evaluating a source block.") +(put 'org-babel-default-header-args 'safe-local-variable + #'org-babel-default-header-args-safe-p) (defvar org-babel-default-inline-header-args '((:session . "none") (:results . "replace") (:exports . "results")) "Default arguments to use when evaluating an inline source block.") +(put 'org-babel-default-inline-header-args 'safe-local-variable + #'org-babel-default-header-args-safe-p) (defvar org-babel-data-names '("tblname" "results" "name")) @@ -2785,6 +2794,28 @@ of `org-babel-temporary-directory'." (add-hook 'kill-emacs-hook 'org-babel-remove-temporary-directory) +(defun org-babel-one-header-arg-safe-p (pair) + (or + (memq (car pair) '(:cache :colnames :comments + :exports :epilogue + :hlines :noeval + :noweb :noweb-ref + :noweb-sep :padline + :prologue :rownames + :sep :session :tangle + :wrap)) + (and (eq (car pair) :eval) + (member (cdr pair) '("never" "query"))) + (and (eq (car pair) :results) + (not (string-match "file" (cdr pair)))))) + +(defun org-babel-default-header-args-safe-p (value) + (and (listp value) + (and (mapcar (lambda (pair) + (and (consp pair) + (org-babel-one-header-arg-safe-p pair))) + value)))) + (provide 'ob-core) ;; Local variables: -- 1.8.4.1