emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [RFC] Block switches as #+HEADER: args?
@ 2014-09-02  9:35 Thorsten Jolitz
  2014-09-02  9:45 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Jolitz @ 2014-09-02  9:35 UTC (permalink / raw)
  To: emacs-orgmode


Hi List, 

I wrote `org-dp-toggle-headers' (https://github.com/tj64/org-dp) which
allows to toggle between parameters and header-args:

#+BEGIN_SRC emacs-lisp -n :cache no
(+ 2 2)
#+END_SRC

#+HEADER: :cache no
#+BEGIN_SRC emacs-lisp -n
(+ 2 2)
#+END_SRC

and I convert sources back and forth between org-mode (src-blocks) and
plain (programming-mode) code in outorg, and at least in the 2nd case
the switches are lost, because they don't work as header args:

#+BEGIN_ORG
* ORG SCRATCH

#+BEGIN_EXAMPLE -n
Hallo World
whats up?
#+END_EXAMPLE

#+HEADER: -n
#+BEGIN_EXAMPLE
Hallo World
whats up?
#+END_EXAMPLE
#+END_ORG

,----
| C-c C-e t A =>
`----


1 ORG SCRATCH
=============

  ,----
  | 1  Hallo World
  | 2  whats up?
  `----

  ,----
  | Hallo World
  | whats up?
  `----

Is there a special keyword for this, or is it not implemented yet? Are
there plans to make it work - it would be nice if all the info (except
the block-type and language) of the #+BEGIN_XYZ line could given as
header args too, so that no information is lost when converting a
block. 

-- 
cheers,
Thorsten

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

* Re: [RFC] Block switches as #+HEADER: args?
  2014-09-02  9:35 [RFC] Block switches as #+HEADER: args? Thorsten Jolitz
@ 2014-09-02  9:45 ` Nicolas Goaziou
  2014-09-02 10:01   ` Thorsten Jolitz
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2014-09-02  9:45 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Hello,

Thorsten Jolitz <tjolitz@gmail.com> writes:

> and at least in the 2nd case the switches are lost, because they don't
> work as header args:

[...]

> #+HEADER: -n
> #+BEGIN_EXAMPLE
> Hallo World
> whats up?
> #+END_EXAMPLE

This is not valid syntax. Switches are to be put on the block line.
Only header arguments can be put on a #+HEADER line. See

 (info "(Org) Structure of code blocks")

in particular the difference between switches and header arguments.


Regards,

-- 
Nicolas Goaziou

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

* Re: [RFC] Block switches as #+HEADER: args?
  2014-09-02  9:45 ` Nicolas Goaziou
@ 2014-09-02 10:01   ` Thorsten Jolitz
  2014-09-02 10:33     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Jolitz @ 2014-09-02 10:01 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> and at least in the 2nd case the switches are lost, because they don't
>> work as header args:
>
> [...]
>
>> #+HEADER: -n
>> #+BEGIN_EXAMPLE
>> Hallo World
>> whats up?
>> #+END_EXAMPLE
>
> This is not valid syntax. Switches are to be put on the block line.
> Only header arguments can be put on a #+HEADER line. See
>
>  (info "(Org) Structure of code blocks")
>
> in particular the difference between switches and header arguments.

Thats what I thought, but wouldn't it be nicer to treat switches and
header args more uniformly here? E.g allow something like:

#+HEADER: :switches -n
#+BEGIN_EXAMPLE
Hallo World
whats up?
#+END_EXAMPLE

Otherwise custom solutions are needed to store the switches in some
place when nuking the surrounding #+begin/#+end lines in a conversion
process, and restore them again when converting back to Org. Or the
switches-info is simply lost during conversion.

-- 
cheers,
Thorsten

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

* Re: [RFC] Block switches as #+HEADER: args?
  2014-09-02 10:01   ` Thorsten Jolitz
@ 2014-09-02 10:33     ` Nicolas Goaziou
  2014-09-02 11:07       ` Thorsten Jolitz
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2014-09-02 10:33 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Thats what I thought, but wouldn't it be nicer to treat switches and
> header args more uniformly here?

Header arguments are for Babel consumption. Switches are not. I see no
reason to treat them similarly.

> Otherwise custom solutions are needed to store the switches in some
> place when nuking the surrounding #+begin/#+end lines in a conversion
> process, and restore them again when converting back to Org. Or the
> switches-info is simply lost during conversion.

Since you already store header args, it isn't much difficult to also
store switch, is it?


Regards,

-- 
Nicolas Goaziou

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

* Re: [RFC] Block switches as #+HEADER: args?
  2014-09-02 10:33     ` Nicolas Goaziou
@ 2014-09-02 11:07       ` Thorsten Jolitz
  0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Jolitz @ 2014-09-02 11:07 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Thats what I thought, but wouldn't it be nicer to treat switches and
>> header args more uniformly here?
>
> Header arguments are for Babel consumption. Switches are not. I see no
> reason to treat them similarly.
>
>> Otherwise custom solutions are needed to store the switches in some
>> place when nuking the surrounding #+begin/#+end lines in a conversion
>> process, and restore them again when converting back to Org. Or the
>> switches-info is simply lost during conversion.
>
> Since you already store header args, it isn't much difficult to also
> store switch, is it?

Ok, thanks, thats what I wanted to know (not necessarily what I wanted
to hear though), so I need a custom solution. 

-- 
cheers,
Thorsten

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

end of thread, other threads:[~2014-09-02 11:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-02  9:35 [RFC] Block switches as #+HEADER: args? Thorsten Jolitz
2014-09-02  9:45 ` Nicolas Goaziou
2014-09-02 10:01   ` Thorsten Jolitz
2014-09-02 10:33     ` Nicolas Goaziou
2014-09-02 11:07       ` Thorsten Jolitz

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