emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Proposal to replace the prefix repetition with whitespace during exp


From: Pontus Michael
Subject: [O] Proposal to replace the prefix repetition with whitespace during expansion of noweb references
Date: Sat, 29 Mar 2014 03:46:00 +0400

I would like to propose a change to the behavior of noweb expansion in
relation to prefix handling. Current behavior intends to insert the text
preceding noweb reference before every successive line of referenced
code.

For instance the expansion of following source block:

#+begin_src emacs-lisp :noweb yes
(concat <<foo>>)
#+end_src

In presence of this source block:

#+begin_src emacs-lisp :noweb-ref foo
"foo"
"bar"
#+end_src

Will result in code from next source block:

#+begin_src emacs-lisp
(concat "foo"
(concat "bar")
#+end_src

I recommend to introduce a change that will replace the inserted prefix
with whitespace of equal length. If it was the case then provided
example would produce the following code after expansion:

#+begin_src emacs-lisp
(concat "foo"
        "bar")
#+end_src

Here are the arguments in support of my proposal:

1) The proposed behavior is identical to one produced by original noweb.

2) Documentation provides a reasoning for current behavior as an example
   of reference expansion after the introduction of single-line comment
   with intention to comment all the lines caught in expansion. This
   reasoning follows simplistic assumption of semantics of arbitrary
   language and takes advantage of the single line comment notation used
   for non-intended purpose (i.e. multiline comment should have been
   used instead).

3) Continuing the line of examples given in emacs lisp, which lacks the
   notation for multiline comments I fail to see a situation where
   docstrings would not only serve the intended purpose, but in many
   cases contribute to quality and readability of the code.

4) Current behavior lacks the mechanism for handling multiple noweb
   references present on the same line. If prefix would be extracted
   from the unexpanded code and expansion would include raw noweb
   references notation. Clearly this is unexpected behavior.
  
If my proposal will find support in the community I can put my own
effort in bringing this change into existence.

reply via email to

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