emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Simon Campese <emacs-orgmode@campese.de>
Cc: emacs-orgmode@gnu.org, Eric Schulte <schulte.eric@gmail.com>
Subject: Re: Bug: org-babel-tangle purges comma at the beginning of a line ]
Date: Wed, 27 Feb 2013 09:01:22 +0100	[thread overview]
Message-ID: <87d2vmtcbx.fsf@gmail.com> (raw)
In-Reply-To: <87k3puvfq3.fsf@tu-dortmund.de> (Simon Campese's message of "Wed, 27 Feb 2013 00:05:08 +0100")

[-- 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


  reply	other threads:[~2013-02-27  8:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-02-28  1:21   ` Simon Campese
2013-03-02  9:13     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2vmtcbx.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@campese.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).