From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pontus Michael Subject: Proposal to replace the prefix repetition with whitespace during expansion of noweb references Date: Sat, 29 Mar 2014 03:46:00 +0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11347188d1d22804f5b34d31 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTgTM-0003Sh-Gd for emacs-orgmode@gnu.org; Fri, 28 Mar 2014 19:46:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTgTK-00033n-TW for emacs-orgmode@gnu.org; Fri, 28 Mar 2014 19:46:04 -0400 Received: from mail-la0-x22b.google.com ([2a00:1450:4010:c03::22b]:34493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTgTK-00033Y-GR for emacs-orgmode@gnu.org; Fri, 28 Mar 2014 19:46:02 -0400 Received: by mail-la0-f43.google.com with SMTP id e16so4284854lan.30 for ; Fri, 28 Mar 2014 16:46:00 -0700 (PDT) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --001a11347188d1d22804f5b34d31 Content-Type: text/plain; charset=ISO-8859-1 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 <>) #+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. --001a11347188d1d22804f5b34d31 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I would like to propose a change to the behavior of noweb = expansion in
relation to prefix handling. Current behavior intends to in= sert 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_s= rc

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 intro= duce a change that will replace the inserted prefix
with whitespace of equal length. If it was the case then provided
exampl= e would produce the following code after expansion:

#+begin_src emac= s-lisp
(concat "foo"
=A0=A0=A0=A0=A0=A0=A0 "bar")=
#+end_src

Here are the arguments in support of my proposal:

1) The propose= d behavior is identical to one produced by original noweb.

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

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

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