emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] eval code only once :eval once
@ 2012-04-10 10:08 Torsten Wagner
  2012-04-10 18:31 ` Thomas S. Dye
  0 siblings, 1 reply; 4+ messages in thread
From: Torsten Wagner @ 2012-04-10 10:08 UTC (permalink / raw)
  To: Org Mode Mailing List

Hi,
I started to use lisp (as well as other) code blocks more and more to
modify my work environment (emacs) for a particular (buffer-based)
task.
That is I change some variables, add some stuff etc.
A real world example is for example the section below

* Set-up							  :nonexport:
#+source: setup-minted
#+begin_src emacs-lisp :exports none :results silent
    (setq org-export-latex-listings 'minted)
    (setq org-export-latex-custom-lang-environments
          '(
           (emacs-lisp "common-lispcode")
            ))
    (setq org-export-latex-minted-options
          '(("frame" "lines")
            ("fontsize" "\\scriptsize")
            ("linenos" "")))
    (setq org-latex-to-pdf-process
          '("pdflatex -shell-escape -interaction nonstopmode
-output-directory %o %f"
            "pdflatex -shell-escape -interaction nonstopmode
-output-directory %o %f"
            "pdflatex -shell-escape -interaction nonstopmode
-output-directory %o %f"))
#+end_src

This are settings from worg, which I use only during my work on that
particular file/buffer e.g. to modify the export of the following
beamer presentation.
Whenever I load the buffer I jump to set-up and hit C-c C-C to execute
it once. After that exports will do what I want.
If I would change the above to :exports results and :results silent I
would be asked to execute the code block on every export.
Thanks to the new auto completion feature, I came across :eval and
wonder if it makes sense to add
:eval once
and
:eval once-query

Which would allow to execute it only once (with query) if not called
before and otherwise keeps quite.
That would make *Set-up blocks much more efficient.
Was thinking why there is no 'no-query' resp. 'always' flag which
would execute code blocks without query even if asked for it in
general but that would be somehow against safety measures ;)

Totti

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [babel] eval code only once :eval once
  2012-04-10 10:08 [babel] eval code only once :eval once Torsten Wagner
@ 2012-04-10 18:31 ` Thomas S. Dye
  2012-04-16 10:50   ` Sebastien Vauban
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2012-04-10 18:31 UTC (permalink / raw)
  To: Torsten Wagner; +Cc: Org Mode Mailing List

Torsten Wagner <torsten.wagner@gmail.com> writes:

> Hi,
> I started to use lisp (as well as other) code blocks more and more to
> modify my work environment (emacs) for a particular (buffer-based)
> task.
> That is I change some variables, add some stuff etc.
> A real world example is for example the section below
>
> * Set-up							  :nonexport:
> #+source: setup-minted
> #+begin_src emacs-lisp :exports none :results silent
>     (setq org-export-latex-listings 'minted)
>     (setq org-export-latex-custom-lang-environments
>           '(
>            (emacs-lisp "common-lispcode")
>             ))
>     (setq org-export-latex-minted-options
>           '(("frame" "lines")
>             ("fontsize" "\\scriptsize")
>             ("linenos" "")))
>     (setq org-latex-to-pdf-process
>           '("pdflatex -shell-escape -interaction nonstopmode
> -output-directory %o %f"
>             "pdflatex -shell-escape -interaction nonstopmode
> -output-directory %o %f"
>             "pdflatex -shell-escape -interaction nonstopmode
> -output-directory %o %f"))
> #+end_src
>
> This are settings from worg, which I use only during my work on that
> particular file/buffer e.g. to modify the export of the following
> beamer presentation.
> Whenever I load the buffer I jump to set-up and hit C-c C-C to execute
> it once. After that exports will do what I want.
> If I would change the above to :exports results and :results silent I
> would be asked to execute the code block on every export.
> Thanks to the new auto completion feature, I came across :eval and
> wonder if it makes sense to add
> :eval once
> and
> :eval once-query
>
> Which would allow to execute it only once (with query) if not called
> before and otherwise keeps quite.
> That would make *Set-up blocks much more efficient.
> Was thinking why there is no 'no-query' resp. 'always' flag which
> would execute code blocks without query even if asked for it in
> general but that would be somehow against safety measures ;)
>
> Totti
>
>
Aloha Totti,

Will :cache yes do what you want?

Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [babel] eval code only once :eval once
  2012-04-10 18:31 ` Thomas S. Dye
@ 2012-04-16 10:50   ` Sebastien Vauban
  2012-04-17 16:15     ` Thomas S. Dye
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2012-04-16 10:50 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Thomas,

Thomas S. Dye wrote:
> Torsten Wagner <torsten.wagner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>> I started to use lisp (as well as other) code blocks more and more to
>> modify my work environment (emacs) for a particular (buffer-based)
>> task.
>> That is I change some variables, add some stuff etc.
>> A real world example is for example the section below
>>
>> * Set-up							  :nonexport:
>> #+source: setup-minted
>> #+begin_src emacs-lisp :exports none :results silent
>>     (setq org-export-latex-listings 'minted)
>>     (setq org-export-latex-custom-lang-environments
>>           '(
>>            (emacs-lisp "common-lispcode")
>>             ))
>>     (setq org-export-latex-minted-options
>>           '(("frame" "lines")
>>             ("fontsize" "\\scriptsize")
>>             ("linenos" "")))
>>     (setq org-latex-to-pdf-process
>>           '("pdflatex -shell-escape -interaction nonstopmode
>> -output-directory %o %f"
>>             "pdflatex -shell-escape -interaction nonstopmode
>> -output-directory %o %f"
>>             "pdflatex -shell-escape -interaction nonstopmode
>> -output-directory %o %f"))
>> #+end_src
>>
>> This are settings from worg, which I use only during my work on that
>> particular file/buffer e.g. to modify the export of the following
>> beamer presentation.
>> Whenever I load the buffer I jump to set-up and hit C-c C-C to execute
>> it once. After that exports will do what I want.
>> If I would change the above to :exports results and :results silent I
>> would be asked to execute the code block on every export.
>> Thanks to the new auto completion feature, I came across :eval and
>> wonder if it makes sense to add
>> :eval once
>> and
>> :eval once-query
>>
>> Which would allow to execute it only once (with query) if not called
>> before and otherwise keeps quite.
>> That would make *Set-up blocks much more efficient.
>> Was thinking why there is no 'no-query' resp. 'always' flag which
>> would execute code blocks without query even if asked for it in
>> general but that would be somehow against safety measures ;)
>
> Aloha Totti,
>
> Will :cache yes do what you want?

I'd answer no, as this wouldn't be re-eval'ed the next time he opens that
buffer.

But...?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [babel] eval code only once :eval once
  2012-04-16 10:50   ` Sebastien Vauban
@ 2012-04-17 16:15     ` Thomas S. Dye
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas S. Dye @ 2012-04-17 16:15 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> Hi Thomas,
>
> Thomas S. Dye wrote:
>> Torsten Wagner <torsten.wagner-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>> I started to use lisp (as well as other) code blocks more and more to
>>> modify my work environment (emacs) for a particular (buffer-based)
>>> task.
>>> That is I change some variables, add some stuff etc.
>>> A real world example is for example the section below
>>>
>>> * Set-up							  :nonexport:
>>> #+source: setup-minted
>>> #+begin_src emacs-lisp :exports none :results silent
>>>     (setq org-export-latex-listings 'minted)
>>>     (setq org-export-latex-custom-lang-environments
>>>           '(
>>>            (emacs-lisp "common-lispcode")
>>>             ))
>>>     (setq org-export-latex-minted-options
>>>           '(("frame" "lines")
>>>             ("fontsize" "\\scriptsize")
>>>             ("linenos" "")))
>>>     (setq org-latex-to-pdf-process
>>>           '("pdflatex -shell-escape -interaction nonstopmode
>>> -output-directory %o %f"
>>>             "pdflatex -shell-escape -interaction nonstopmode
>>> -output-directory %o %f"
>>>             "pdflatex -shell-escape -interaction nonstopmode
>>> -output-directory %o %f"))
>>> #+end_src
>>>
>>> This are settings from worg, which I use only during my work on that
>>> particular file/buffer e.g. to modify the export of the following
>>> beamer presentation.
>>> Whenever I load the buffer I jump to set-up and hit C-c C-C to execute
>>> it once. After that exports will do what I want.
>>> If I would change the above to :exports results and :results silent I
>>> would be asked to execute the code block on every export.
>>> Thanks to the new auto completion feature, I came across :eval and
>>> wonder if it makes sense to add
>>> :eval once
>>> and
>>> :eval once-query
>>>
>>> Which would allow to execute it only once (with query) if not called
>>> before and otherwise keeps quite.
>>> That would make *Set-up blocks much more efficient.
>>> Was thinking why there is no 'no-query' resp. 'always' flag which
>>> would execute code blocks without query even if asked for it in
>>> general but that would be somehow against safety measures ;)
>>
>> Aloha Totti,
>>
>> Will :cache yes do what you want?
>
> I'd answer no, as this wouldn't be re-eval'ed the next time he opens that
> buffer.
>
> But...?
>
> Best regards,
>   Seb
Aloha Seb,

Yes, you're right.  Perhaps #+BIND: then, instead of a babel code block?

Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-17 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-10 10:08 [babel] eval code only once :eval once Torsten Wagner
2012-04-10 18:31 ` Thomas S. Dye
2012-04-16 10:50   ` Sebastien Vauban
2012-04-17 16:15     ` Thomas S. Dye

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).