From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [RFC] [PATCH] allow bind keywords to set safe values Date: Fri, 06 Nov 2015 21:36:47 +0100 Message-ID: <87y4eaeug0.fsf@nicolasgoaziou.fr> References: <8737wjuhif.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zuniy-00031Z-24 for emacs-orgmode@gnu.org; Fri, 06 Nov 2015 15:35:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zuniw-0005ya-Tv for emacs-orgmode@gnu.org; Fri, 06 Nov 2015 15:35:03 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:34030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zuniw-0005x1-N7 for emacs-orgmode@gnu.org; Fri, 06 Nov 2015 15:35:02 -0500 Received: from selenimh (unknown [IPv6:2a01:6600:8080:9601::2de]) (Authenticated sender: mail@nicolasgoaziou.fr) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id A682117209B for ; Fri, 6 Nov 2015 21:35:01 +0100 (CET) In-Reply-To: <8737wjuhif.fsf@gmail.com> (Aaron Ecay's message of "Fri, 06 Nov 2015 18:09:28 +0000") 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: orgmode Hello, Aaron Ecay writes: > BIND keywords should be used for controlling export, rather than the > usual emacs method of setting file local variables > . In this message, I say that file local variables may not replace BIND keywords (although, I still cannot remember why). However, BIND keywords cannot replace file local variables, because some variables are used outside of `org-export-as'. `org-latex-compiler' comes to mind. > But, BIND keywords are currently disabled by default. We can=E2=80=99t tu= rn > these on by default, as maliciously crafted documents could do nasty > things to a user=E2=80=99s emacs. The attached patch permits many interes= ting > usages of BIND keywords by allowing them to set variables by default, > as long as the value thus set is safe (as implemented by emacs=E2=80=99s > default file local variable code). Sounds good. > If @code{org-export-allow-bind-keywords} is non-@code{nil}, Emacs variab= les > -can become buffer-local during export by using the BIND keyword. Its sy= ntax > -is @samp{#+BIND: variable value}. This is particularly useful for in-bu= ffer > -settings that cannot be changed using specific keywords. > +can become buffer-local during export by using the BIND keyword. Settin= g the > +variable to @code{t} allows variables to take on all values. Setting it= to > +the symbol @code{safe} (the default) only allows safe values. (@pxref{S= afe > +File Variables,,,emacs,The Emacs Manual}) The syntax of a BIND keyword is > +@samp{#+BIND: variable value}. The text of @samp{value} will be passed = to > +the elisp @code{read} function.@footnote{This means that strings should = be > +surrounded with double quotes, but symbols and lists will be read litera= lly > +and need not be quoted for lisp with a single quote.} The BIND keyword = is > +particularly useful for in-buffer settings that cannot be changed using > +specific keywords.@footnote{You should not use the usual emacs local var= iable > +convention (@pxref{Specifying File Variables,,,emacs,The Emacs Manual}), > +because these notations could be lost during the export process.} It is= also > +useful for collecting common variable settings in a setup file shared be= tween > +several documents (@pxref{SETUPFILE}). Maybe an example would be interesting, preferably with a non trivial value (e.g. a list or a string). WDYT? > - (push (read (format "(%s)" val)) alist) > + (let* ((pair (read (format "(%s)" val)))) `let*' -> `let' Regards, --=20 Nicolas Goaziou