* [Babel] Small problem with tangling
@ 2010-10-13 14:15 Sébastien Vauban
2010-10-13 15:26 ` Eric Schulte
0 siblings, 1 reply; 13+ messages in thread
From: Sébastien Vauban @ 2010-10-13 14:15 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hello,
I just tried this:
--8<---------------cut here---------------start------------->8---
Creating the following =.reg= file:
#+begin_src sh :tangle org-protocol-setup.reg
REGEDIT4
[HKEY_CLASSES_ROOT\org-protocol]
@="URL:Org Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\org-protocol\shell]
[HKEY_CLASSES_ROOT\org-protocol\shell\open]
[HKEY_CLASSES_ROOT\org-protocol\shell\open\command]
@="\"C:\\Programme\\Emacs\\emacs\\bin\\emacsclientw.exe\" \"%1\""
#+end_src
and double-click it.
--8<---------------cut here---------------end--------------->8---
and tangled it.
But, when clicking on the reg file, it fails... saying it is not a valid reg
file.
I've found the reason to be an empty first line that's always inserted at the
beginning of the file. Removing it cures the problem.
What should I do to get rid of that first *empty* line?
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Babel] Small problem with tangling
2010-10-13 14:15 [Babel] Small problem with tangling Sébastien Vauban
@ 2010-10-13 15:26 ` Eric Schulte
2010-10-14 7:37 ` Sébastien Vauban
2010-10-14 12:28 ` [Babel] Small problem with... previewing Sébastien Vauban
0 siblings, 2 replies; 13+ messages in thread
From: Eric Schulte @ 2010-10-13 15:26 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
The following inhibits the insertion of blank lines on tangling.
(setq org-babel-tangle-pad-newline nil)
Best -- Eric
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hello,
>
> I just tried this:
>
> Creating the following =.reg= file:
>
> #+begin_src sh :tangle org-protocol-setup.reg
> REGEDIT4
>
> [HKEY_CLASSES_ROOT\org-protocol]
> @="URL:Org Protocol"
> "URL Protocol"=""
> [HKEY_CLASSES_ROOT\org-protocol\shell]
> [HKEY_CLASSES_ROOT\org-protocol\shell\open]
> [HKEY_CLASSES_ROOT\org-protocol\shell\open\command]
> @="\"C:\\Programme\\Emacs\\emacs\\bin\\emacsclientw.exe\" \"%1\""
> #+end_src
>
> and double-click it.
>
> and tangled it.
>
> But, when clicking on the reg file, it fails... saying it is not a valid reg
> file.
>
> I've found the reason to be an empty first line that's always inserted at the
> beginning of the file. Removing it cures the problem.
>
> What should I do to get rid of that first *empty* line?
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Babel] Small problem with tangling
2010-10-13 15:26 ` Eric Schulte
@ 2010-10-14 7:37 ` Sébastien Vauban
2010-10-14 13:53 ` Eric Schulte
2010-10-14 12:28 ` [Babel] Small problem with... previewing Sébastien Vauban
1 sibling, 1 reply; 13+ messages in thread
From: Sébastien Vauban @ 2010-10-14 7:37 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
>> [...] empty first line that's always inserted at the beginning of the file.
>> What should I do to get rid of that first *empty* line?
>
> The following inhibits the insertion of blank lines on tangling.
>
> (setq org-babel-tangle-pad-newline nil)
Of course, that does work as expected. Thanks for the tip.
Another side-question about a little annoyance: when having just one src block
to tangle in a big file, and when tangling it, Org(-Babel?) does first add IDs
everywhere in my file, one for every section.
Could we get rid of that? I don't even understand why one would be needed,
though I could easily "accept" (;-)) to see an ID created in the sections
containing elements to tangle.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Re: [Babel] Small problem with tangling
2010-10-14 7:37 ` Sébastien Vauban
@ 2010-10-14 13:53 ` Eric Schulte
2010-10-14 15:01 ` Sébastien Vauban
0 siblings, 1 reply; 13+ messages in thread
From: Eric Schulte @ 2010-10-14 13:53 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
>>> [...] empty first line that's always inserted at the beginning of the file.
>>> What should I do to get rid of that first *empty* line?
>>
>> The following inhibits the insertion of blank lines on tangling.
>>
>> (setq org-babel-tangle-pad-newline nil)
>
> Of course, that does work as expected. Thanks for the tip.
>
> Another side-question about a little annoyance: when having just one src block
> to tangle in a big file, and when tangling it, Org(-Babel?) does first add IDs
> everywhere in my file, one for every section.
>
> Could we get rid of that? I don't even understand why one would be needed,
> though I could easily "accept" (;-)) to see an ID created in the sections
> containing elements to tangle.
>
Hi Seb,
This is caused by the tangling code calling `org-store-link' on every
code block, which is useful because we sometimes want to store links in
the tangled code for jumping back from the code to the relevant place in
the original org-mode file.
`org-store-link' is called interactively, and it will insert ID values
according to the value of `org-link-to-org-use-id', which defaults to
`create-if-interactive-and-no-custom-id'. I suppose you could change
the value of this variable which should avoid the insertion of custom
IDs.
Best -- Eric
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Babel] Small problem with tangling
2010-10-14 13:53 ` Eric Schulte
@ 2010-10-14 15:01 ` Sébastien Vauban
2010-10-14 23:17 ` Eric Schulte
0 siblings, 1 reply; 13+ messages in thread
From: Sébastien Vauban @ 2010-10-14 15:01 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> "Eric Schulte" wrote:
>>>> [...] empty first line that's always inserted at the beginning of the
>>>> file. What should I do to get rid of that first *empty* line?
>>>
>>> The following inhibits the insertion of blank lines on tangling.
>>>
>>> (setq org-babel-tangle-pad-newline nil)
>>
>> Of course, that does work as expected. Thanks for the tip.
>>
>> Another side-question about a little annoyance: when having just one src
>> block to tangle in a big file, and when tangling it, Org(-Babel?) does
>> first add IDs everywhere in my file, one for every section.
>>
>> Could we get rid of that? I don't even understand why one would be needed,
>> though I could easily "accept" (;-)) to see an ID created in the sections
>> containing elements to tangle.
>
> This is caused by the tangling code calling `org-store-link' on every code
> block, which is useful because we sometimes want to store links in the
> tangled code for jumping back from the code to the relevant place in the
> original org-mode file.
I understand the need for creating links automatically to sections which host
code blocks.
However, I don't understand that tangling the *only* code block I have in an
entire Org file does add ID in *every* section. Shouldn't it be limited to
sections hosting code blocks in general (in particular, IMHO, it should even
be limited to the only sections that contain blocks to *tangle*)?
> `org-store-link' is called interactively, and it will insert ID values
> according to the value of `org-link-to-org-use-id', which defaults to
> `create-if-interactive-and-no-custom-id'. I suppose you could change the
> value of this variable which should avoid the insertion of custom IDs.
I have the same value as you.
I could try every of them, but -- from the doc -- I don't see any better
option for this. I want IDs to be created! It's only I'd like them to be
created for sections that need it...
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Re: [Babel] Small problem with tangling
2010-10-14 15:01 ` Sébastien Vauban
@ 2010-10-14 23:17 ` Eric Schulte
2010-10-15 12:40 ` Sébastien Vauban
0 siblings, 1 reply; 13+ messages in thread
From: Eric Schulte @ 2010-10-14 23:17 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Hi Seb,
I fully agree with your point, I believe I've just pushed up a fix for
this issue. This commit includes a short function with a long name
`ob-tangle/no-excessive-id-insertion-on-tangle' in test-ob-tangle.el.
Best -- Eric
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
>> Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
>>> "Eric Schulte" wrote:
>>>>> [...] empty first line that's always inserted at the beginning of the
>>>>> file. What should I do to get rid of that first *empty* line?
>>>>
>>>> The following inhibits the insertion of blank lines on tangling.
>>>>
>>>> (setq org-babel-tangle-pad-newline nil)
>>>
>>> Of course, that does work as expected. Thanks for the tip.
>>>
>>> Another side-question about a little annoyance: when having just one src
>>> block to tangle in a big file, and when tangling it, Org(-Babel?) does
>>> first add IDs everywhere in my file, one for every section.
>>>
>>> Could we get rid of that? I don't even understand why one would be needed,
>>> though I could easily "accept" (;-)) to see an ID created in the sections
>>> containing elements to tangle.
>>
>> This is caused by the tangling code calling `org-store-link' on every code
>> block, which is useful because we sometimes want to store links in the
>> tangled code for jumping back from the code to the relevant place in the
>> original org-mode file.
>
> I understand the need for creating links automatically to sections which host
> code blocks.
>
> However, I don't understand that tangling the *only* code block I have in an
> entire Org file does add ID in *every* section. Shouldn't it be limited to
> sections hosting code blocks in general (in particular, IMHO, it should even
> be limited to the only sections that contain blocks to *tangle*)?
>
>
>> `org-store-link' is called interactively, and it will insert ID values
>> according to the value of `org-link-to-org-use-id', which defaults to
>> `create-if-interactive-and-no-custom-id'. I suppose you could change the
>> value of this variable which should avoid the insertion of custom IDs.
>
> I have the same value as you.
>
> I could try every of them, but -- from the doc -- I don't see any better
> option for this. I want IDs to be created! It's only I'd like them to be
> created for sections that need it...
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Babel] Small problem with tangling
2010-10-14 23:17 ` Eric Schulte
@ 2010-10-15 12:40 ` Sébastien Vauban
0 siblings, 0 replies; 13+ messages in thread
From: Sébastien Vauban @ 2010-10-15 12:40 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> I understand the need for creating links automatically to sections which
>> host code blocks.
>>
>> However, I don't understand that tangling the *only* code block I have in
>> an entire Org file does add ID in *every* section. Shouldn't it be limited
>> to sections hosting code blocks in general (in particular, IMHO, it should
>> even be limited to the only sections that contain blocks to *tangle*)?
>
> I fully agree with your point, I believe I've just pushed up a fix for this
> issue. This commit includes a short function with a long name
> `ob-tangle/no-excessive-id-insertion-on-tangle' in test-ob-tangle.el.
Perfect. I don't even had any ID created when tangling my source block. I
guess it's because I don't ask for "back-links" to the original Org file.
Thanks a lot!
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Babel] Small problem with... previewing
2010-10-13 15:26 ` Eric Schulte
2010-10-14 7:37 ` Sébastien Vauban
@ 2010-10-14 12:28 ` Sébastien Vauban
2010-10-14 13:53 ` Dan Davison
2010-10-14 14:15 ` Eric Schulte
1 sibling, 2 replies; 13+ messages in thread
From: Sébastien Vauban @ 2010-10-14 12:28 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
> The following inhibits the insertion of blank lines on tangling.
>
> (setq org-babel-tangle-pad-newline nil)
That works for the tangled file, but not for the preview buffer (run with =C-c
C-v C-v=).
Test it on the following:
#+begin_src sh :results output :exports results
grep indAllocType ../../champs.csv |\
iconv -f LATIN1 -t UTF8 |\
tr "[]" "|" | cut -d "|" -f 2 | cut -d " " -f 2- |\
sed 's%, %\n%g'
#+end_src
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Babel] Small problem with... previewing
2010-10-14 12:28 ` [Babel] Small problem with... previewing Sébastien Vauban
@ 2010-10-14 13:53 ` Dan Davison
2010-10-14 14:15 ` Eric Schulte
1 sibling, 0 replies; 13+ messages in thread
From: Dan Davison @ 2010-10-14 13:53 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
>> The following inhibits the insertion of blank lines on tangling.
>>
>> (setq org-babel-tangle-pad-newline nil)
>
> That works for the tangled file, but not for the preview buffer (run with =C-c
> C-v C-v=).
>
> Test it on the following:
>
> #+begin_src sh :results output :exports results
> grep indAllocType ../../champs.csv |\
> iconv -f LATIN1 -t UTF8 |\
> tr "[]" "|" | cut -d "|" -f 2 | cut -d " " -f 2- |\
> sed 's%, %\n%g'
> #+end_src
Hi Seb,
That should be fixed now.
Dan
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Re: [Babel] Small problem with... previewing
2010-10-14 12:28 ` [Babel] Small problem with... previewing Sébastien Vauban
2010-10-14 13:53 ` Dan Davison
@ 2010-10-14 14:15 ` Eric Schulte
2010-10-14 14:55 ` Sébastien Vauban
1 sibling, 1 reply; 13+ messages in thread
From: Eric Schulte @ 2010-10-14 14:15 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Ah,
Thanks for pointing this out, this was actually a small issue in the
shell specific body expansion (it looks like Dan and I have both fixed
this in the last 5 minutes), it should now be fixed and strapped down
with a unit test.
Best -- Eric
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
>> The following inhibits the insertion of blank lines on tangling.
>>
>> (setq org-babel-tangle-pad-newline nil)
>
> That works for the tangled file, but not for the preview buffer (run with =C-c
> C-v C-v=).
>
> Test it on the following:
>
> #+begin_src sh :results output :exports results
> grep indAllocType ../../champs.csv |\
> iconv -f LATIN1 -t UTF8 |\
> tr "[]" "|" | cut -d "|" -f 2 | cut -d " " -f 2- |\
> sed 's%, %\n%g'
> #+end_src
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Babel] Small problem with... previewing
2010-10-14 14:15 ` Eric Schulte
@ 2010-10-14 14:55 ` Sébastien Vauban
2010-10-14 15:04 ` Dan Davison
2010-10-14 23:03 ` Eric Schulte
0 siblings, 2 replies; 13+ messages in thread
From: Sébastien Vauban @ 2010-10-14 14:55 UTC (permalink / raw)
To: emacs-orgmode-mXXj517/zsQ
Hi Eric,
"Eric Schulte" wrote:
>>> (setq org-babel-tangle-pad-newline nil)
>>
>> That works for the tangled file, but not for the preview buffer (run with =C-c
>> C-v C-v=).
>
> Thanks for pointing this out,
You're welcome. This is the least I can do...
> this was actually a small issue in the shell specific body expansion (it
> looks like Dan and I have both fixed this in the last 5 minutes), it should
> now be fixed
Indeed, it is.
> and strapped down with a unit test.
Would you have a bit of time (I don't know exactly what's required), could you
give information about how you'll write this unit test (using this case as an
example), where you put it and so on.
I'de be happy contributing with unit tests as well, later.
Best regards,
Seb
--
Sébastien Vauban
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Babel] Small problem with... previewing
2010-10-14 14:55 ` Sébastien Vauban
@ 2010-10-14 15:04 ` Dan Davison
2010-10-14 23:03 ` Eric Schulte
1 sibling, 0 replies; 13+ messages in thread
From: Dan Davison @ 2010-10-14 15:04 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ
[...]
>> and strapped down with a unit test.
>
> Would you have a bit of time (I don't know exactly what's required), could you
> give information about how you'll write this unit test (using this case as an
> example), where you put it and so on.
Hi Seb,
I also need to learn about these tests. Eric's test is included in his
commit regarding this bug (b04265eab). I imagine we could make some
progress by studying the new file he introduced
(testing/lisp/test-ob-sh.el).
Dan
>
> I'de be happy contributing with unit tests as well, later.
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Re: [Babel] Small problem with... previewing
2010-10-14 14:55 ` Sébastien Vauban
2010-10-14 15:04 ` Dan Davison
@ 2010-10-14 23:03 ` Eric Schulte
1 sibling, 0 replies; 13+ messages in thread
From: Eric Schulte @ 2010-10-14 23:03 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: emacs-orgmode
Hi Seb,
Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:
> Hi Eric,
>
> "Eric Schulte" wrote:
[...]
>> and strapped down with a unit test.
>
> Would you have a bit of time (I don't know exactly what's required), could you
> give information about how you'll write this unit test (using this case as an
> example), where you put it and so on.
>
Certainly,
1) First I setup the testing resources as described in
testing/README.org in the org-mode repo.
2) I opened lisp/ob-sh.el and then pressed C-u C-M-j which calls
org-test-jump (to jump to the related test file) with a prefix
argument (to create the file if it doesn't already exist)
this created the file testing/lisp/test-ob-sh.el and filled it with
all of the required lisp boilerplate
3) I wrote the following small test in test-ob-sh.el which tests the
desired behavior.
--8<---------------cut here---------------start------------->8---
(ert-deftest test-ob-sh/dont-insert-spaces-on-expanded-bodies ()
"Expanded shell bodies should not start with a blank line
unless the body of the tangled block does."
(should-not (string-match "^[\n\r][\t ]*[\n\r]"
(org-babel-expand-body:sh "echo 2" '())))
(should (string-match "^[\n\r][\t ]*[\n\r]"
(org-babel-expand-body:sh "\n\necho 2" '()))))
--8<---------------cut here---------------end--------------->8---
>
> I'de be happy contributing with unit tests as well, later.
>
That would be most welcome, and the ideal form of bug report!
Best -- Eric
>
> Best regards,
> Seb
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2010-10-15 12:40 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-13 14:15 [Babel] Small problem with tangling Sébastien Vauban
2010-10-13 15:26 ` Eric Schulte
2010-10-14 7:37 ` Sébastien Vauban
2010-10-14 13:53 ` Eric Schulte
2010-10-14 15:01 ` Sébastien Vauban
2010-10-14 23:17 ` Eric Schulte
2010-10-15 12:40 ` Sébastien Vauban
2010-10-14 12:28 ` [Babel] Small problem with... previewing Sébastien Vauban
2010-10-14 13:53 ` Dan Davison
2010-10-14 14:15 ` Eric Schulte
2010-10-14 14:55 ` Sébastien Vauban
2010-10-14 15:04 ` Dan Davison
2010-10-14 23:03 ` Eric Schulte
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).