From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: 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 Message-ID: <87d17gt8kq.fsf@nicolasgoaziou.fr> References: <87mv8idrff.fsf@smtp.1und1.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dmF9Y-00045A-9o for emacs-orgmode@gnu.org; Mon, 28 Aug 2017 04:12:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dmF9V-0002AL-4G for emacs-orgmode@gnu.org; Mon, 28 Aug 2017 04:12:12 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:59390) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dmF9U-00029D-U5 for emacs-orgmode@gnu.org; Mon, 28 Aug 2017 04:12:09 -0400 In-Reply-To: <87mv8idrff.fsf@smtp.1und1.de> (Tobias Zawada's message of "Thu, 06 Jul 2017 08:12:52 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Tobias Zawada Cc: emacs-orgmode@gnu.org Hello, Tobias Zawada 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