* File-level execute permissions?
@ 2010-09-24 13:11 Bill Harris
2010-09-25 5:40 ` Noorul Islam
0 siblings, 1 reply; 7+ messages in thread
From: Bill Harris @ 2010-09-24 13:11 UTC (permalink / raw)
To: emacs-orgmode
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I understand at least the obvious risks in executing source code blocks
inside an unknown org file, but, when I created the org file myself, it
would be nice to be able to export the file without confirming execution
20+ times.
Is there a header element I can set that asks one time for the entire
file (or session, perhaps) for execute permission? I think that would
be safer than blindly turning on permission, for I'd at least get one
opportunity to abort exporting if I was surprised by the existence of
src blocks.
Thanks,
Bill
- --
Bill Harris http://makingsense.facilitatedsystems.com/
Facilitated Systems Everett, WA 98208 USA
http://www.facilitatedsystems.com/ phone: +1 425 374-1845
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkyco4sACgkQ3J3HaQTDvd/80wCfQgv/OSZ7XbH6U2c3F9TbRiMw
G4UAnRSDTxpprkuBhpBRukq9+Qxj3Mmm
=lmZG
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: File-level execute permissions?
2010-09-24 13:11 File-level execute permissions? Bill Harris
@ 2010-09-25 5:40 ` Noorul Islam
2010-09-25 23:29 ` Bill Harris
0 siblings, 1 reply; 7+ messages in thread
From: Noorul Islam @ 2010-09-25 5:40 UTC (permalink / raw)
To: Bill Harris; +Cc: emacs-orgmode
On Fri, Sep 24, 2010 at 6:41 PM, Bill Harris
<bill_harris@facilitatedsystems.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I understand at least the obvious risks in executing source code blocks
> inside an unknown org file, but, when I created the org file myself, it
> would be nice to be able to export the file without confirming execution
> 20+ times.
>
> Is there a header element I can set that asks one time for the entire
> file (or session, perhaps) for execute permission? I think that would
> be safer than blindly turning on permission, for I'd at least get one
> opportunity to abort exporting if I was surprised by the existence of
> src blocks.
>
How about setting `org-confirm-babel-evaluate' to nil
Thanks and Regards
Noorul
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: File-level execute permissions?
2010-09-25 5:40 ` Noorul Islam
@ 2010-09-25 23:29 ` Bill Harris
2010-09-27 13:46 ` Eric Schulte
0 siblings, 1 reply; 7+ messages in thread
From: Bill Harris @ 2010-09-25 23:29 UTC (permalink / raw)
To: Noorul Islam; +Cc: emacs-orgmode
Noorul Islam <noorul@noorul.com> writes:
> How about setting `org-confirm-babel-evaluate' to nil
Noorul,
Thank you for the suggestion. Setting that to nil, according to the
documentation, prevents _any_ confirmation requests in any file, at
least as best as I can tell. I don't really want that.
What I want is to have to confirm once at the first code block in an org
file and then have the rest go without confirmation. Since I don't see
the code blocks anyway when I get asked for confirmation, I'm not sure
there's a lot of benefit to a confirmation request on each block, but I
do want a reminder that there is one or more code blocks in a file
before I blithely execute the entire thing.
Bill
--
Bill Harris http://makingsense.facilitatedsystems.com/
Facilitated Systems Everett, WA 98208 USA
http://www.facilitatedsystems.com/ phone: +1 425 374-1845
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: File-level execute permissions?
2010-09-25 23:29 ` Bill Harris
@ 2010-09-27 13:46 ` Eric Schulte
2010-09-28 1:08 ` Bill Harris
0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2010-09-27 13:46 UTC (permalink / raw)
To: Bill Harris; +Cc: emacs-orgmode, Noorul Islam
Hi Bill,
The `org-confirm-babel-evaluate' variable can be set to a function which
can query the user to confirm code block evaluation. The following code
does two things.
1) it creates and maintains a list of the files that the user has said
are safe for evaluation (this list will need to be rebuilt every time
you re-start Emacs)
2) it shows the language and body of the code block to the user when
querying for evaluation
--8<---------------cut here---------------start------------->8---
(setq babel-safe-files '())
(defun my-babel-confirmation (lang body)
(let ((file (buffer-file-name)))
(if (member file babel-safe-files)
nil
(if (y-or-n-p
(format
(concat "#+begin_src %s\n%s#+end_src\n"
"Evaluate this code block "
"(and all others in this file) "
"on your system? ") lang body))
(prog1 nil
(setq babel-safe-files (cons file babel-safe-files)))
t))))
(setq org-confirm-babel-evaluate #'my-babel-confirmation)
--8<---------------cut here---------------end--------------->8---
This above can be added to your configuration to get close to the
functionality you describe.
I agree that the default confirmation should show the code block in
question when asking if it should be evaluated. I'll add this to our
development task list.
Note: the above requires that you pull down the latest version of
Org-mode.
Best -- Eric
Bill Harris <bill_harris@facilitatedsystems.com> writes:
> Noorul Islam <noorul@noorul.com> writes:
>
>> How about setting `org-confirm-babel-evaluate' to nil
>
> Noorul,
>
> Thank you for the suggestion. Setting that to nil, according to the
> documentation, prevents _any_ confirmation requests in any file, at
> least as best as I can tell. I don't really want that.
>
> What I want is to have to confirm once at the first code block in an org
> file and then have the rest go without confirmation. Since I don't see
> the code blocks anyway when I get asked for confirmation, I'm not sure
> there's a lot of benefit to a confirmation request on each block, but I
> do want a reminder that there is one or more code blocks in a file
> before I blithely execute the entire thing.
>
> Bill
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: File-level execute permissions?
2010-09-27 13:46 ` Eric Schulte
@ 2010-09-28 1:08 ` Bill Harris
2010-09-28 17:40 ` Eric Schulte
0 siblings, 1 reply; 7+ messages in thread
From: Bill Harris @ 2010-09-28 1:08 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode, Noorul Islam
"Eric Schulte" <schulte.eric@gmail.com> writes:
> The `org-confirm-babel-evaluate' variable can be set to a function which
> can query the user to confirm code block evaluation. The following code
> does two things.
> 1) it creates and maintains a list of the files that the user has said
> are safe for evaluation (this list will need to be rebuilt every time
> you re-start Emacs)
> 2) it shows the language and body of the code block to the user when
> querying for evaluation
Eric,
That sounds like what I was seeking. Thanks!
> Note: the above requires that you pull down the latest version of
> Org-mode.
I've got 7.01h. I presume you mean something newer than that?
Bill
--
Bill Harris http://makingsense.facilitatedsystems.com/
Facilitated Systems Everett, WA 98208 USA
http://www.facilitatedsystems.com/ phone: +1 425 374-1845
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: File-level execute permissions?
2010-09-28 1:08 ` Bill Harris
@ 2010-09-28 17:40 ` Eric Schulte
2010-09-29 2:36 ` Bill Harris
0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2010-09-28 17:40 UTC (permalink / raw)
To: Bill Harris; +Cc: emacs-orgmode, Noorul Islam
Bill Harris <bill_harris@facilitatedsystems.com> writes:
> "Eric Schulte" <schulte.eric@gmail.com> writes:
[...]
>> Note: the above requires that you pull down the latest version of
>> Org-mode.
>
> I've got 7.01h. I presume you mean something newer than that?
>
Yes, you'll need to pull a copy of Org-mode from the git repository,
anything pulled after the date of my last message will work.
git clone git://repo.or.cz/org-mode.git
For information on git see http://git-scm.com/
Best -- Eric
>
> Bill
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: File-level execute permissions?
2010-09-28 17:40 ` Eric Schulte
@ 2010-09-29 2:36 ` Bill Harris
0 siblings, 0 replies; 7+ messages in thread
From: Bill Harris @ 2010-09-29 2:36 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode, Noorul Islam
"Eric Schulte" <schulte.eric@gmail.com> writes:
> Yes, you'll need to pull a copy of Org-mode from the git repository,
> anything pulled after the date of my last message will work.
Eric,
Thanks,
Bill
--
Bill Harris http://makingsense.facilitatedsystems.com/
Facilitated Systems Everett, WA 98208 USA
http://www.facilitatedsystems.com/ phone: +1 425 374-1845
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-09-29 2:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-24 13:11 File-level execute permissions? Bill Harris
2010-09-25 5:40 ` Noorul Islam
2010-09-25 23:29 ` Bill Harris
2010-09-27 13:46 ` Eric Schulte
2010-09-28 1:08 ` Bill Harris
2010-09-28 17:40 ` Eric Schulte
2010-09-29 2:36 ` Bill Harris
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).