emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Enhancement: Changing default setting of source block header lin


From: Nicolas Goaziou
Subject: Re: [O] Enhancement: Changing default setting of source block header line switches [9.0.5 (9.0.5-elpa @ /home/naehring/.emacs.d/elpa/org-20170210/)]
Date: Mon, 28 Aug 2017 10:12:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hello,

Tobias Zawada <address@hidden> writes:

> At first I would like to ask whether it is already possible to change
> the default settings of the source block header line switches.
>
> The question
>
>> Is it possible to define source block switches globally in org mode?

It is only possible for some of them (i.e., "l" and "i").

> at 
> https://emacs.stackexchange.com/questions/33971/is-it-possible-to-define-source-block-switches-globally-in-org-mode
> demonstrates the usefulness of this feature.

This is Emacs. It takes 3 seconds to register a macro (or to write
a regexp) and have "-n" applied on all the blocks.

Of course, a global setting is handier in this case. However, there is
no way to negate a switch, so it would ultimately get in the way.

> Reading part of the orgmode-manual 
> (http://orgmode.org/manual/Literal-examples.html#Literal-examples), scanning 
> the customization options,
> and inspecting the source code gave me the impression that this is not
> implemented yet. So, I am filing that as an enhancement request.
>
> 1. It should be possible to customize the default settings of the
> switches
> 2. It should be possible to change the default settings of the switches
> tree-locally through setting a property. That includes file-local
> settings if one sets the property before the first headline.
> 3. Explicit inner settings should override outer settings, e.g.,
> tree-local settings override the customization options and explicit headline
> switches override the tree-local settings.
> 4. For each switch there should also be a negative switch. E.g., if line
> numbering is enabled through the customization option it should be
> possible to disable it with a tree-local setting or with the source
> block headline switches.

What you are looking for is a change of the switch syntax. Actually,
merging switch and header arguments would bring automatically 2 3 4,
e.g.,

  #+begin_src emacs-lisp :n t
  ...
  #+end_src

or

  #+begin_src emacs-lisp :n 10
  ...
  #+end_src

or

  #+begin_src emacs-lisp :n nil
  ...
  #+end_src

This is backward incompatible, tho. But, more importantly, it introduces
a slight shift in the source blocks paradigm. Unlike header arguments,
switches do not depend on Babel. E.g.,

  #+begin_src emacs-lisp :exports code
  ...
  #+end_src

and

  #+header: :exports code
  #+begin_src emacs-lisp
  ...
  #+end_src

are equivalent, but not

  #+begin_src emacs-lisp -n
  ...
  #+end_src

and

  #+header: -n
  #+begin_src emacs-lisp
  ...
  #+end_src

We could make a special case for :n :k :l :i :r, i.e., explicitly forbid
them in #+header: lines, or handle them at the parser level.

What do you think? Would you want to work on this?


Regards,

-- 
Nicolas Goaziou



reply via email to

[Prev in Thread] Current Thread [Next in Thread]