emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-babel-tangle purges comma at the beginning of a line ]
@ 2013-02-26 23:05 Simon Campese
  2013-02-27  8:01 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Campese @ 2013-02-26 23:05 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I just noticed that org-babel-tangle removes the comma if its at the
beginning of a line inside a source block. This seems to be independent from the
language indicated (tried with sh, js and emacs-lisp) and also
independent from the characters that follow (',' gets tangled to a blank
line, ',,,' gets tangled to ',,', ',sometext' gets tangled to 'sometext'
etc.).


Best,

Simon

Emacs  : GNU Emacs 24.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.4) 
 of 2013-01-20 on eric
Package: Org-mode version 7.9.3e (7.9.3e-1122-g27da9a @ mixed
 installation! ~/.emacs.d/el-get/org-mode/contrib/lisp/ and
 ~/.emacs.d/el-get/org-mode/lisp/) 

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

* Re: Bug: org-babel-tangle purges comma at the beginning of a line ]
  2013-02-26 23:05 Bug: org-babel-tangle purges comma at the beginning of a line ] Simon Campese
@ 2013-02-27  8:01 ` Nicolas Goaziou
  2013-02-28  1:21   ` Simon Campese
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2013-02-27  8:01 UTC (permalink / raw)
  To: Simon Campese; +Cc: emacs-orgmode, Eric Schulte

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

Hello,

Simon Campese <emacs-orgmode@campese.de> writes:

> I just noticed that org-babel-tangle removes the comma if its at the
> beginning of a line inside a source block. This seems to be independent from the
> language indicated (tried with sh, js and emacs-lisp) and also
> independent from the characters that follow (',' gets tangled to a blank
> line, ',,,' gets tangled to ',,', ',sometext' gets tangled to 'sometext'
> etc.).

That looks like a bug, indeed. Thank you for reporting it.

Would the following patch fix it?


Regards,

-- 
Nicolas Goaziou

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-tangle-Correctly-unescape-code-when-tangling.patch --]
[-- Type: text/x-patch, Size: 801 bytes --]

From c9dc22ea651056d6411dd27b57a252007d97bc00 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Wed, 27 Feb 2013 08:58:32 +0100
Subject: [PATCH] ob-tangle: Correctly unescape code when tangling

* lisp/ob-tangle.el (org-babel-spec-to-string): Use dedicated function
  for unescaping code.
---
 lisp/ob-tangle.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 6c79794..2c2e7dd 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -346,8 +346,7 @@ form
     (insert
      (format
       "%s\n"
-      (replace-regexp-in-string
-       "^," ""
+      (org-unescape-code-in-string
        (org-babel-trim body (if org-src-preserve-indentation "[\f\n\r\v]")))))
     (when link-p
       (funcall
-- 
1.8.1.4


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

* Re: Bug: org-babel-tangle purges comma at the beginning of a line ]
  2013-02-27  8:01 ` Nicolas Goaziou
@ 2013-02-28  1:21   ` Simon Campese
  2013-03-02  9:13     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Campese @ 2013-02-28  1:21 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, Eric Schulte

Hello Nicolas, 

thanks a lot for the patch. It partly works, as long as there are some
more characters after the first comma, but a single comma at the beginning of
a line still gets purged. Now we can start discussing about whoever
would want to have a single comma in a line of its own... :-) 


Best wishes,

Simon

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

* Re: Bug: org-babel-tangle purges comma at the beginning of a line ]
  2013-02-28  1:21   ` Simon Campese
@ 2013-03-02  9:13     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2013-03-02  9:13 UTC (permalink / raw)
  To: Simon Campese; +Cc: emacs-orgmode, Eric Schulte

Hello,

Simon Campese <emacs-orgmode@campese.de> writes:

> thanks a lot for the patch. It partly works, as long as there are some
> more characters after the first comma, but a single comma at the beginning of
> a line still gets purged. Now we can start discussing about whoever
> would want to have a single comma in a line of its own... :-)

I have applied the patch. Thank you for reporting the problem.

I think the other problem is unrelated to this. Could you provide an ECM
demonstrating this behaviour?


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2013-03-02  9:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-26 23:05 Bug: org-babel-tangle purges comma at the beginning of a line ] Simon Campese
2013-02-27  8:01 ` Nicolas Goaziou
2013-02-28  1:21   ` Simon Campese
2013-03-02  9:13     ` 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).