emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Babel] Bug reading example blocks?
@ 2013-11-22 17:37 Thomas S. Dye
  2014-02-14  0:20 ` Samuel Wales
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2013-11-22 17:37 UTC (permalink / raw)
  To: Org-mode

Aloha all,

Responding to a query by Gary Oberbrunner, I tried to point out the use
of example blocks to name arbitrary pieces of text. What I found is that
the example block isn't passed whole to a babel source block--whitespace
is removed from the first line.

* Whitespace on first line of example block removed

#+name: example
#+begin_example
 1. this is the first line
 2. this is the second line with %VARIANT% as the value
 3. this is the third line
#+end_example

#+name: repeated-text
#+header: :var x="" 
#+header: :var eg=""
#+begin_src emacs-lisp
  (let ((result))
    (setf result (replace-regexp-in-string "%VARIANT%" x eg t))
    result)
#+end_src

#+call: repeated-text(x="foo",eg=example) :results raw

#+results:
1. this is the first line
 2. this is the second line with foo as the value
 3. this is the third line

This happens, AFAICT, regardless of the value of
org-src-preserve-indentation. 

Is there a reason for this? Or, is it a bug? Or, am I going about this
task in the wrong way?

All the best,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: [Babel] Bug reading example blocks?
  2013-11-22 17:37 [Babel] Bug reading example blocks? Thomas S. Dye
@ 2014-02-14  0:20 ` Samuel Wales
  2014-02-24  0:37   ` Thomas S. Dye
  0 siblings, 1 reply; 4+ messages in thread
From: Samuel Wales @ 2014-02-14  0:20 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

hi thomas,

is this still a bug?

samuel


On 11/22/13, Thomas S. Dye <tsd@tsdye.com> wrote:
> Aloha all,
>
> Responding to a query by Gary Oberbrunner, I tried to point out the use
> of example blocks to name arbitrary pieces of text. What I found is that
> the example block isn't passed whole to a babel source block--whitespace
> is removed from the first line.
>
> * Whitespace on first line of example block removed
>
> #+name: example
> #+begin_example
>  1. this is the first line
>  2. this is the second line with %VARIANT% as the value
>  3. this is the third line
> #+end_example
>
> #+name: repeated-text
> #+header: :var x=""
> #+header: :var eg=""
> #+begin_src emacs-lisp
>   (let ((result))
>     (setf result (replace-regexp-in-string "%VARIANT%" x eg t))
>     result)
> #+end_src
>
> #+call: repeated-text(x="foo",eg=example) :results raw
>
> #+results:
> 1. this is the first line
>  2. this is the second line with foo as the value
>  3. this is the third line
>
> This happens, AFAICT, regardless of the value of
> org-src-preserve-indentation.
>
> Is there a reason for this? Or, is it a bug? Or, am I going about this
> task in the wrong way?
>
> All the best,
> Tom
> --
> Thomas S. Dye
> http://www.tsdye.com
>
>


-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.

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

* Re: [Babel] Bug reading example blocks?
  2014-02-14  0:20 ` Samuel Wales
@ 2014-02-24  0:37   ` Thomas S. Dye
  2014-02-24  1:31     ` Samuel Wales
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2014-02-24  0:37 UTC (permalink / raw)
  To: Samuel Wales; +Cc: Org-mode

Hi Samuel,

I think not.  I get these results now:

#+call: repeated-text(x="foo",eg=example) :results raw

#+results:
1. this is the first line
2. this is the second line with foo as the value
3. this is the third line

All the best,
Tom

Samuel Wales <samologist@gmail.com> writes:

> hi thomas,
>
> is this still a bug?
>
> samuel
>
>
> On 11/22/13, Thomas S. Dye <tsd@tsdye.com> wrote:
>> Aloha all,
>>
>> Responding to a query by Gary Oberbrunner, I tried to point out the use
>> of example blocks to name arbitrary pieces of text. What I found is that
>> the example block isn't passed whole to a babel source block--whitespace
>> is removed from the first line.
>>
>> * Whitespace on first line of example block removed
>>
>> #+name: example
>> #+begin_example
>>  1. this is the first line
>>  2. this is the second line with %VARIANT% as the value
>>  3. this is the third line
v>> #+end_example
>>
>> #+name: repeated-text
>> #+header: :var x=""
>> #+header: :var eg=""
>> #+begin_src emacs-lisp
>>   (let ((result))
>>     (setf result (replace-regexp-in-string "%VARIANT%" x eg t))
>>     result)
>> #+end_src
>>
>> #+call: repeated-text(x="foo",eg=example) :results raw
>>
>> #+results:
>> 1. this is the first line
>>  2. this is the second line with foo as the value
>>  3. this is the third line
>>
>> This happens, AFAICT, regardless of the value of
>> org-src-preserve-indentation.
>>
>> Is there a reason for this? Or, is it a bug? Or, am I going about this
>> task in the wrong way?
>>
>> All the best,
>> Tom
>> --
>> Thomas S. Dye
>> http://www.tsdye.com
>>
>>

-- 
Thomas S. Dye
http://www.tsdye.com

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

* Re: [Babel] Bug reading example blocks?
  2014-02-24  0:37   ` Thomas S. Dye
@ 2014-02-24  1:31     ` Samuel Wales
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Wales @ 2014-02-24  1:31 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

Hi Thomas,

I guess the fix hasn't made it to maint yet.

#+call: repeated-text(eg=example) :results raw

#+RESULTS:
1. this is the first line
  2. this is the second line with %VARIANT% as the value
  3. this is the third line

#+name: repeated-text
#+begin_src sh :results verbatim output :var eg=1
  {
      cat<<EOF
  $eg
  EOF
  } 2>&1
  :
#+end_src

#+name: example
#+begin_example
  1. this is the first line
  2. this is the second line with %VARIANT% as the value
  3. this is the third line
#+end_example

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY
can get it as far as we know.

Denmark: free Karina Hansen NOW.

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

end of thread, other threads:[~2014-02-24  1:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-22 17:37 [Babel] Bug reading example blocks? Thomas S. Dye
2014-02-14  0:20 ` Samuel Wales
2014-02-24  0:37   ` Thomas S. Dye
2014-02-24  1:31     ` Samuel Wales

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