From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Clemente Subject: Re: Local variables Date: Thu, 06 Aug 2009 12:35:21 +0200 Message-ID: <87d479p6vq.fsf@CPU107.opentrends.net> References: <53A4771F-8F19-480A-B12E-01349D00B6D5@uva.nl> <87my6ek0j8.fsf@CPU107.opentrends.net> <9922F423-1B5B-40A3-822D-1AFF23BA1C29@uva.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MZ0Jr-0006Xv-RY for emacs-orgmode@gnu.org; Thu, 06 Aug 2009 06:35:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MZ0Jn-0006UR-5q for emacs-orgmode@gnu.org; Thu, 06 Aug 2009 06:35:35 -0400 Received: from [199.232.76.173] (port=54578 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZ0Jn-0006UO-1G for emacs-orgmode@gnu.org; Thu, 06 Aug 2009 06:35:31 -0400 Received: from mx20.gnu.org ([199.232.41.8]:52094) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MZ0Jm-0002F8-EY for emacs-orgmode@gnu.org; Thu, 06 Aug 2009 06:35:30 -0400 Received: from an-out-0708.google.com ([209.85.132.243]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MZ0Jl-0005wQ-JF for emacs-orgmode@gnu.org; Thu, 06 Aug 2009 06:35:29 -0400 Received: by an-out-0708.google.com with SMTP id b6so319243ana.21 for ; Thu, 06 Aug 2009 03:35:27 -0700 (PDT) In-Reply-To: <9922F423-1B5B-40A3-822D-1AFF23BA1C29@uva.nl> (Carsten Dominik's message of "Wed, 5 Aug 2009 16:32:12 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: org-mode Mailinglist Thank you very much. I am forwarding your response also to the mailing list. --Daniel El dc, ago 05 2009 a les 16:32, Carsten Dominik va escriure: > On Aug 5, 2009, at 12:39 PM, Daniel Clemente wrote: > >> >> Hi, >> >> El dt, ago 04 2009 a les 23:15, Carsten Dominik va escriure: >>> General mechanism for local variable settings >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> =E2=80=A6 >>> >>> A line like: >>> >>> #+BIND: variable value >>> >>> >>> will bind the variable to value. For example, the line >>> =E2=80=A6 >> >> >> 1. That's very useful and makes .org file distribution much easier since >> configuration is self-contained. Thanks. >> >> 2. I find that it doesn't work. For instance, this buffer >> >> --------- >> #+BIND: org-export-with-section-numbers nil >> >> * one >> something >> --------- >> >> and this one: >> --------- >> #+BIND: org-export-with-section-numbers t >> >> * one >> something >> --------- >> >> Export the same content, with section numbers. Only with this: >> #+OPTIONS: num:nil >> can I export without section numbers. >> >> Running org 6.29a on latest Emacs from CVS from today. I get no other e= rror >> messages. > > This was a bug, fixed, thanks. > >> >> 3. I found it created one problem with custom time dates. I can't export= this >> buffer: >> -------- >> #+STARTUP: customtime >> #+BIND: org-time-stamp-custom-formats '("<%d.m%m.%Y>" . "<%d.m%m.%Y %H:%= M>") >> # (setq org-time-stamp-custom-formats '("<%d.m%m.%Y>" . "<%d.m%m.%Y %H:%= M>")) > > in #+BIND, the value should not be quoted, it will not be evaluated like = it > would in > a setq form. So you need: > > #+BIND: org-time-stamp-custom-formats ("<%d.m%m.%Y>" . "<%d.m%m.%Y %H: > %M>") > >> >> a date: >> >> <2006-03-25 s=C3=A1b> >> -------- >> >> It fails with: >> >> Debugger entered--Lisp error: (wrong-type-argument arrayp quote) >> substring(quote 1 -1) >> (concat (if inactive "[" "<") (substring tf 1 -1) (if inactive "]" ">")) >> (format-time-string (concat (if inactive "[" "<") (substring tf 1 -1) (= if >> inactive "]" ">")) (apply (quote encode-time) time)) >> =E2=80=A6 >> org-translate-time(#("<2006-03-25 s\x00e1\ b>" 0 1 (fontified t) 1 2 >> (fontified t display #("25.m03.2006" 0 11 ...)) 2 3 (fontified t org-dw= idth t >> org-dwidth-n 3 display #("25.m03.2006" 0 11 ...)) 3 15 (fontified t dis= play >> #("25.m03.2006" 0 11 ...)) 15 16 (fontified t rear-nonsticky (mouse-face >> highlight keymap invisible intangible help-echo org-linked-text)))) >> >> >> It fails only if I have that #+BIND line. >> You may eval or not the (setq), as needed; it's there only to test. >> >> >> >> 4. Being able to change any variable is dangerous. =E2=80=9ELocal variab= les=E2=80=9C in Emacs >> have a confirmation dialog which asks whether you really want to change= them; >> org may need something similar if it reimplements local variables. >> Restricting changes to variables whose name is org-.* probably doesn't >> prevent code execution, and anyway the good thing about # +BIND: is bein= g able >> to change anything. So maybe a confirmation dialog can be used, or a sw= itch. > > Yes, #+BIND might in principle open the possibility to execute > code and in this way is a security risk. Org-mode files as virus vectors. > There are other, similar issues with executable code in org-eval.el, > and with shell links, for example. > > I am not sure what the right course of a action is here. > > The most important thing is of course to only open Org files from > trusted sources in Emacs. > > I guess we could use a switch . . . I have now implemented one. > You need to confirm using BIND for each buffer that wants it, > or you can configure the variable org-export-allow-BIND to > allow them always, on your own risk. > > - Carsten