emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Babel] : Bug in org-tangle with :comments, patch included
@ 2012-03-08 19:36 aditya siram
  2012-03-09 13:51 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: aditya siram @ 2012-03-08 19:36 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi all,
When I tangle a source block with ":comments yes" any spaces in the
sub-heading in which the block is found are replaced with "%2520"
instead of "%20". As a consequence when I "org-babel-detangle" the
correct heading is not found.

As an example given the following org file:
* Babel Tangling
** Test Source 1
   #+begin_src c :tangle /tmp/source1.txt :comments yes
   nothing
   #+end_src

running "org-babel-tangle" generates the following source:
/* [[file:~/WorkingFiles/Org.org::*Test%2520Source%25201][Test-Source-1:1]] */

nothing

/* Test-Source-1:1 ends here */

The problem is in the "org-babel-spec-to-string" function which takes
the correctly escaped link generated by "org-store-link":
 "[[file:~/WorkingFiles/Org.org::*Test%20Source%201][Test-Source-1:1]]"
and escapes it again with "org-link-escape" which yielding the erroneous:
 "[[file:~/WorkingFiles/Org.org::*Test%2520Source%25201][Test-Source-1:1]]".

I have included a patch that removes the call to "org-link-escape" and
that fixes it on my machine. A grep of my current source tree shows
that "org-babel-spec-to-string" is only called from
"org-babel-tangle". I don't know if any other contribs are using this
function.

-deech

[-- Attachment #2: link-escaped-twice.patch --]
[-- Type: text/x-diff, Size: 784 bytes --]

From 249f60fe17913db08f81bca40d12e114f66db4b6 Mon Sep 17 00:00:00 2001
From: Deech <deech@deech-ThinkPad-X200.(none)>
Date: Thu, 8 Mar 2012 13:25:14 -0600
Subject: [PATCH 3/3] The link generated by org-store-link is escaped twice when tangling with ":comments yes" flag.

---
 lisp/ob-tangle.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 15c0518..e629c12 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -381,7 +381,7 @@ form
   (start-line file link source-name params body comment)"
   (let* ((start-line (nth 0 spec))
 	 (file (nth 1 spec))
-	 (link (org-link-escape (nth 2 spec)))
+	 (link (nth 2 spec))
 	 (source-name (nth 3 spec))
 	 (body (nth 5 spec))
 	 (comment (nth 6 spec))
-- 
1.7.4.1


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

* Re: [Babel] : Bug in org-tangle with :comments, patch included
  2012-03-08 19:36 [Babel] : Bug in org-tangle with :comments, patch included aditya siram
@ 2012-03-09 13:51 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2012-03-09 13:51 UTC (permalink / raw)
  To: aditya siram; +Cc: emacs-orgmode

Applied. Thanks,

aditya siram <aditya.siram@gmail.com> writes:

> Hi all,
> When I tangle a source block with ":comments yes" any spaces in the
> sub-heading in which the block is found are replaced with "%2520"
> instead of "%20". As a consequence when I "org-babel-detangle" the
> correct heading is not found.
>
> As an example given the following org file:
> * Babel Tangling
> ** Test Source 1
>    #+begin_src c :tangle /tmp/source1.txt :comments yes
>    nothing
>    #+end_src
>
> running "org-babel-tangle" generates the following source:
> /* [[file:~/WorkingFiles/Org.org::*Test%2520Source%25201][Test-Source-1:1]] */
>
> nothing
>
> /* Test-Source-1:1 ends here */
>
> The problem is in the "org-babel-spec-to-string" function which takes
> the correctly escaped link generated by "org-store-link":
>  "[[file:~/WorkingFiles/Org.org::*Test%20Source%201][Test-Source-1:1]]"
> and escapes it again with "org-link-escape" which yielding the erroneous:
>  "[[file:~/WorkingFiles/Org.org::*Test%2520Source%25201][Test-Source-1:1]]".
>
> I have included a patch that removes the call to "org-link-escape" and
> that fixes it on my machine. A grep of my current source tree shows
> that "org-babel-spec-to-string" is only called from
> "org-babel-tangle". I don't know if any other contribs are using this
> function.
>
> -deech
>
> From 249f60fe17913db08f81bca40d12e114f66db4b6 Mon Sep 17 00:00:00 2001
> From: Deech <deech@deech-ThinkPad-X200.(none)>
> Date: Thu, 8 Mar 2012 13:25:14 -0600
> Subject: [PATCH 3/3] The link generated by org-store-link is escaped twice when tangling with ":comments yes" flag.
>
> ---
>  lisp/ob-tangle.el |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
> index 15c0518..e629c12 100644
> --- a/lisp/ob-tangle.el
> +++ b/lisp/ob-tangle.el
> @@ -381,7 +381,7 @@ form
>    (start-line file link source-name params body comment)"
>    (let* ((start-line (nth 0 spec))
>  	 (file (nth 1 spec))
> -	 (link (org-link-escape (nth 2 spec)))
> +	 (link (nth 2 spec))
>  	 (source-name (nth 3 spec))
>  	 (body (nth 5 spec))
>  	 (comment (nth 6 spec))

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

end of thread, other threads:[~2012-03-09 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-08 19:36 [Babel] : Bug in org-tangle with :comments, patch included aditya siram
2012-03-09 13:51 ` 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).