emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Proposal to replace the prefix repetition with whitespace during expansion of noweb references
@ 2014-03-28 23:46 Pontus Michael
  2014-03-29 15:30 ` Charles Berry
  2014-03-31  8:17 ` Sebastien Vauban
  0 siblings, 2 replies; 10+ messages in thread
From: Pontus Michael @ 2014-03-28 23:46 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2018 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 2308 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Proposal to replace the prefix repetition with whitespace during expansion of noweb references
@ 2014-03-30 21:13 Pontus Michael
  2014-04-11  9:36 ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Pontus Michael @ 2014-03-30 21:13 UTC (permalink / raw)
  To: ccberry, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

Hello, Charles.

Thank you for your reply.

I appreciate your suggestion, however the example which I used is not a
limiting factor which I seek help in overcoming. Instead I'm trying to
address a potential design flaw.

You make a valid point that change of this nature will inevitably break
existing code that has been taking advantage of this functionality. From
my point of view this is an argument in favor of having this issue
addressed as soon as possible.

[-- Attachment #2: Type: text/html, Size: 532 bytes --]

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

end of thread, other threads:[~2014-10-12 15:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-28 23:46 Proposal to replace the prefix repetition with whitespace during expansion of noweb references Pontus Michael
2014-03-29 15:30 ` Charles Berry
2014-03-31  8:17 ` Sebastien Vauban
2014-08-16 12:55   ` Pierre-Henry FRÖHRING
2014-08-18 11:55     ` Sebastien Vauban
2014-08-23  8:35       ` Aaron Ecay
2014-10-12 12:43         ` Bastien
2014-10-12 15:42           ` Aaron Ecay
  -- strict thread matches above, loose matches on Subject: below --
2014-03-30 21:13 Pontus Michael
2014-04-11  9:36 ` Bastien

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