emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Aaron Ecay <aaronecay@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH 2/3] Mark some org-babel variables as safe locals under proper conditions
Date: Tue, 29 Oct 2013 19:50:46 -0600	[thread overview]
Message-ID: <8761sfcykv.fsf@gmail.com> (raw)
In-Reply-To: 1382991543-14273-3-git-send-email-aaronecay@gmail.com

Could you add documentation strings to `org-babel-one-header-arg-safe-p'
and `org-babel-one-header-arg-safe-p'?  Also, would the header argument
list in the latter be better as a defvar which ob-*.el files could
let-bind to add their own additional safe header arguments?

Thanks,

Aaron Ecay <aaronecay@gmail.com> writes:

> * 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:

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

  reply	other threads:[~2013-10-30  1:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 20:19 [PATCH 0/3] Safe local variable declarations Aaron Ecay
2013-10-28 20:19 ` [PATCH 1/3] Mark ox-latex variables safe locals under proper conditions Aaron Ecay
2013-10-29  8:24   ` Nicolas Goaziou
2013-10-30  4:15     ` Aaron Ecay
2013-10-30  8:35       ` Nicolas Goaziou
2013-10-28 20:19 ` [PATCH 2/3] Mark some org-babel variables as " Aaron Ecay
2013-10-30  1:50   ` Eric Schulte [this message]
2013-10-30  4:19     ` Aaron Ecay
2013-10-30 18:02       ` Eric Schulte
2013-10-28 20:19 ` [PATCH 3/3] mark o-b-default-header-args:R as a safe local " Aaron Ecay
2013-10-30  1:54   ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761sfcykv.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).