emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: code blocks with multiple word names create single word result-blocks leading to collisions [8.2.10 (8.2.10-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20141013/)]
@ 2015-02-18 12:54 Joost Helberg
  2015-02-18 13:06 ` Sebastien Vauban
  2015-02-18 14:05 ` Nicolas Goaziou
  0 siblings, 2 replies; 5+ messages in thread
From: Joost Helberg @ 2015-02-18 12:54 UTC (permalink / raw)
  To: emacs-orgmode

hi,

  noweb-syntax allows blanks in names of code blocks. The result-blocks
  of these code blocks are named as well, but have everything behind the
  first word stripped. This leads to result-block collisions in case
  there are two code blocks starting with the same word.

  Is this intentional? Why doesn't org-mode support sentences for code
  block names? 

  It boils down to the regexp /org-babel-src-name-w-name-regexp/. It
  matches a name; the match-string function is used for retrieving this
  name. The regexp should obviously match the rest of the text too.

  The original ob-core.el uses:
  ="\\([^ ()\f\t\n\r\v]+\\)"=
  to match the name. Check the ' ' behind the caret.

  The regexp I tested has the space removed. Hence, it will match the
  full length name. 
#+begin_src emacs-lisp
(setq org-babel-src-name-w-name-regexp
  (concat org-babel-src-name-regexp
	  "\\("
	  org-babel-multi-line-header-regexp
	  "\\)*"
	  "\\([^()\f\t\n\r\v]+\\)"))
#+end_src


  Will this just fix or also break things? Was the blank deliberately
  added? If all OK, can someone please commit/push it?

  Example code below:

  The following snippet can be executed (C-c C-c) and included in some
  script down at the bottom of this file.
#+NAME: echo the stuff
#+BEGIN_SRC sh
echo "ape nut miss" 
#+END_SRC

#+RESULTS: echo the stuff
: ape nut miss

  Do names with only one word still work?
#+NAME: doit
#+BEGIN_SRC sh
echo "cat boom spoil" 
#+END_SRC

#+RESULTS: doit
: cat boom spoil

  The next snippet will leave it's result after being executed in the
  above #+RESULT: line, not the result below the code. It can be
  included however in the bottom-script using noweb notation.
#+NAME: echo other stuff
#+BEGIN_SRC sh
echo "tune fire goat"
#+END_SRC

#+RESULTS: echo other stuff
: tune fire goat

   We use this shell-snippet in the following script and execute it,
   noweb works fine:
#+BEGIN_SRC sh :noweb yes
<<echo the stuff>>
<<echo other stuff>>
#+END_SRC

#+RESULTS:
| ape  | nut  | miss |
| tune | fire | goat |

many regards,

Joost

Emacs  : GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2)
 of 2014-10-13 on w520jo
Package: Org-mode version 8.2.10 (8.2.10-elpaplus @ /home/joost/.emacs.d/elpa/org-plus-contrib-20141013/)

-- 
Snow B.V.

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

* Re: Bug: code blocks with multiple word names create single word result-blocks leading to collisions [8.2.10 (8.2.10-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20141013/)]
  2015-02-18 12:54 Bug: code blocks with multiple word names create single word result-blocks leading to collisions [8.2.10 (8.2.10-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20141013/)] Joost Helberg
@ 2015-02-18 13:06 ` Sebastien Vauban
  2015-02-18 13:51   ` Joost Helberg
  2015-02-18 14:05 ` Nicolas Goaziou
  1 sibling, 1 reply; 5+ messages in thread
From: Sebastien Vauban @ 2015-02-18 13:06 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

Joost Helberg wrote:
> noweb-syntax allows blanks in names of code blocks.

Are you sure?  Where did you read that?

> The result-blocks of these code blocks are named as well, but have
> everything behind the first word stripped. This leads to result-block
> collisions in case there are two code blocks starting with the same
> word.

Quite logic if, in fact, it just reads the first token... which is what
happens, IIUC.

Of course, you could expect to get an error or warning reported.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Bug: code blocks with multiple word names create single word result-blocks leading to collisions [8.2.10 (8.2.10-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20141013/)]
  2015-02-18 13:06 ` Sebastien Vauban
@ 2015-02-18 13:51   ` Joost Helberg
       [not found]     ` <87twyjiazq.fsf-JFNXyGN8thM@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Joost Helberg @ 2015-02-18 13:51 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode

Sebastian,

>>>>> "Sebastien" == Sebastien Vauban <sva-news@mygooglest.com> writes:
 > From: Sebastien Vauban <sva-news@mygooglest.com>
 > To: emacs-orgmode@gnu.org
 > Subject: Re: [O] Bug: code blocks with multiple word names create
 > Date: 2015-02-18T14:06:07+0100

 > Hello,

 > Joost Helberg wrote:
 >> noweb-syntax allows blanks in names of code blocks.

 > Are you sure?  Where did you read that?
It's in https://www.cs.tufts.edu/~nr/noweb/johnson-lj.pdf. In org-mode
it works as specified; the noweb expansion of names with multiple words
works fine. 

 >> The result-blocks of these code blocks are named as well, but have
 >> everything behind the first word stripped. This leads to result-block
 >> collisions in case there are two code blocks starting with the same
 >> word.

 > Quite logic if, in fact, it just reads the first token... which is what
 > happens, IIUC.

I expect it to read the full name, which may have more than one word.

 > Of course, you could expect to get an error or warning reported.

In order to run snippets of code which are also in use as noweb-items,
it's currently impossible to use names with multiple words where the
first word collides with other names. My patch allows the use of code
blocks with sentences as names hence enjoying the literate in literate
programming a lot more. 

I fail to see a reason for the result-blocks to have only one-word
names, it doesn't break anything if these carry the full name of the
code block.

regards,

Joost

 > Best regards,
 >   Seb

 > -- 
 > Sebastien Vauban



-- 
Snow B.V.

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

* Re: Bug: code blocks with multiple word names create single word result-blocks leading to collisions [8.2.10 (8.2.10-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20141013/)]
       [not found]     ` <87twyjiazq.fsf-JFNXyGN8thM@public.gmane.org>
@ 2015-02-18 13:59       ` Sebastien Vauban
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastien Vauban @ 2015-02-18 13:59 UTC (permalink / raw)
  To: Joost Helberg; +Cc: emacs-orgmode-mXXj517/zsQ

Joost Helberg wrote:
> "Sebastien" == Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org> writes:
>> Joost Helberg wrote:
>>> noweb-syntax allows blanks in names of code blocks.
>
>> Are you sure?  Where did you read that?
>
> It's in https://www.cs.tufts.edu/~nr/noweb/johnson-lj.pdf.

Well, that's the real noweb, not Org's partial implementation.

> In org-mode it works as specified; the noweb expansion of names with
> multiple words works fine.
>
>>> The result-blocks of these code blocks are named as well, but have
>>> everything behind the first word stripped. This leads to
>>> result-block collisions in case there are two code blocks starting
>>> with the same word.
>
>> Quite logic if, in fact, it just reads the first token... which is
>> what happens, IIUC.
>
> I expect it to read the full name, which may have more than one word.
>
>> Of course, you could expect to get an error or warning reported.
>
> In order to run snippets of code which are also in use as noweb-items,
> it's currently impossible to use names with multiple words where the
> first word collides with other names. My patch allows the use of code
> blocks with sentences as names hence enjoying the literate in literate
> programming a lot more.
>
> I fail to see a reason for the result-blocks to have only one-word
> names, it doesn't break anything if these carry the full name of the
> code block.

I understand you may desire that, and that it can be useful, but I'm not
sure whether this is so obvious to implement.

Nicolas will certainly give you more information on that.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Bug: code blocks with multiple word names create single word result-blocks leading to collisions [8.2.10 (8.2.10-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20141013/)]
  2015-02-18 12:54 Bug: code blocks with multiple word names create single word result-blocks leading to collisions [8.2.10 (8.2.10-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20141013/)] Joost Helberg
  2015-02-18 13:06 ` Sebastien Vauban
@ 2015-02-18 14:05 ` Nicolas Goaziou
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2015-02-18 14:05 UTC (permalink / raw)
  To: Joost Helberg; +Cc: emacs-orgmode

Hello,

Joost Helberg <joost@snow.nl> writes:

>   noweb-syntax allows blanks in names of code blocks. The result-blocks
>   of these code blocks are named as well, but have everything behind the
>   first word stripped. This leads to result-block collisions in case
>   there are two code blocks starting with the same word.
>
>   Is this intentional? Why doesn't org-mode support sentences for code
>   block names? 
>
>   It boils down to the regexp /org-babel-src-name-w-name-regexp/. It
>   matches a name; the match-string function is used for retrieving this
>   name. The regexp should obviously match the rest of the text too.
>
>   The original ob-core.el uses:
>   ="\\([^ ()\f\t\n\r\v]+\\)"=
>   to match the name. Check the ' ' behind the caret.
>
>   The regexp I tested has the space removed. Hence, it will match the
>   full length name. 
> #+begin_src emacs-lisp
> (setq org-babel-src-name-w-name-regexp
>   (concat org-babel-src-name-regexp
> 	  "\\("
> 	  org-babel-multi-line-header-regexp
> 	  "\\)*"
> 	  "\\([^()\f\t\n\r\v]+\\)"))
> #+end_src
>
>
>   Will this just fix or also break things? Was the blank deliberately
>   added? If all OK, can someone please commit/push it?

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2015-02-18 14:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-18 12:54 Bug: code blocks with multiple word names create single word result-blocks leading to collisions [8.2.10 (8.2.10-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20141013/)] Joost Helberg
2015-02-18 13:06 ` Sebastien Vauban
2015-02-18 13:51   ` Joost Helberg
     [not found]     ` <87twyjiazq.fsf-JFNXyGN8thM@public.gmane.org>
2015-02-18 13:59       ` Sebastien Vauban
2015-02-18 14:05 ` Nicolas Goaziou

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