emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: src block asterisk escaping doesn't work anymore
@ 2016-07-13 13:48 Robert Klein
  2016-07-14  1:47 ` Charles C. Berry
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Klein @ 2016-07-13 13:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

When exporting a source block, e.g. 

--- snip (example org file) ---
#+begin_src conf
  Test

  ,* asterisk in src block
#+end_src
--- snip ---


the escaping of the asterisk does not work.  Instead a headline
“asterisk in src block” is created.

Adding a second comma works but that doesn't work well with C-' source
editing (I didn't test tangling).


Git bisect leads me to this commit:

0279d84cd7f857535342b4ec3c2e70ac76c1ee27 is the first bad commit
commit 0279d84cd7f857535342b4ec3c2e70ac76c1ee27
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date:   Fri Jun 17 14:16:39 2016 +0200

    ob-exp: Remove spurious comma un-escaping
    
    * lisp/ob-exp.el (org-babel-exp-code): Remove spurious comma
      un-escaping.

:040000 040000 d9b76ef4148894bc257394a3fe2bb3c970194f14
a8c9ca31e9ebed5b4d5e634193e8e1e1755faea8 M	lisp


PS: I'm using maint, but I also saw this on a recent master

Best regards
Robert

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

* Re: Bug: src block asterisk escaping doesn't work anymore
  2016-07-13 13:48 Bug: src block asterisk escaping doesn't work anymore Robert Klein
@ 2016-07-14  1:47 ` Charles C. Berry
  2016-07-16 19:12   ` PATCH for " Robert Klein
  0 siblings, 1 reply; 4+ messages in thread
From: Charles C. Berry @ 2016-07-14  1:47 UTC (permalink / raw)
  To: Robert Klein; +Cc: emacs-orgmode

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

On Wed, 13 Jul 2016, Robert Klein wrote:

> Hi,
>
> When exporting a source block, e.g.
>
> --- snip (example org file) ---
> #+begin_src conf
>  Test
>
>  ,* asterisk in src block
> #+end_src
> --- snip ---
>
>
> the escaping of the asterisk does not work.  Instead a headline
> “asterisk in src block” is created.

I don't have `ob-conf', but this:

--8<---------------cut here---------------start------------->8---

#+begin_src emacs-lisp :exports both
   "Test

   ,* asterisk in src block"
#+end_src

--8<---------------cut here---------------end--------------->8---

shows the issue. Also, the #+[BEGIN|END]_SRC parts of the src block 
are showing up in the export.

Putting `org-escape-code-in-string' back in `org-babel-exp-code' here

:  ("body"  . ,(org-escape-code-in-string (nth 1 info)))

seems to fix this as long as there is a newline after the last #+END_SRC 
in the buffer.

Chuck

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

* PATCH for Re: Bug: src block asterisk escaping doesn't work anymore
  2016-07-14  1:47 ` Charles C. Berry
@ 2016-07-16 19:12   ` Robert Klein
  2016-07-17 10:22     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Klein @ 2016-07-16 19:12 UTC (permalink / raw)
  To: Charles C. Berry; +Cc: emacs-orgmode

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

Hi,

 On Wed, 13 Jul 2016 18:47:58 -0700
"Charles C. Berry" <ccberry@ucsd.edu> wrote:

> On Wed, 13 Jul 2016, Robert Klein wrote:
> 
> > Hi,
> >
> > When exporting a source block, e.g.
> >
> > --- snip (example org file) ---
> > #+begin_src conf
> >  Test
> >
> >  ,* asterisk in src block
> > #+end_src
> > --- snip ---
> >
> >
> > the escaping of the asterisk does not work.  Instead a headline
> > “asterisk in src block” is created.  
> 
> I don't have `ob-conf', but this:
> 
> --8<---------------cut here---------------start------------->8---
> 
> #+begin_src emacs-lisp :exports both
>    "Test
> 
>    ,* asterisk in src block"
> #+end_src
> 
> --8<---------------cut here---------------end--------------->8---
> 
> shows the issue. Also, the #+[BEGIN|END]_SRC parts of the src block 
> are showing up in the export.
> 
> Putting `org-escape-code-in-string' back in `org-babel-exp-code' here
> 
> :  ("body"  . ,(org-escape-code-in-string (nth 1 info)))
> 
> seems to fix this as long as there is a newline after the last
> #+END_SRC in the buffer.

Thanks for the confirmation.  I also have issues exporting
http://orgmode.org/worg/dev/org-element-api.org -- while the error
message is "Unable to resolve code reference: end" bisecting leads to
the same commit; reverting the commit solves the issue.  I reckon the
line(s) beginning with #+ in the src block above confuse the exporter
in the same way.

I attached a tentative patch.

Best regards
Robert

[-- Attachment #2: 0001-Revert-ob-exp-Remove-spurious-comma-un-escaping.patch --]
[-- Type: text/x-patch, Size: 1364 bytes --]

From ceecd352546453eb0215628c093faf13bca16b97 Mon Sep 17 00:00:00 2001
From: Robert Klein <roklein@roklein.de>
Date: Sat, 16 Jul 2016 20:50:01 +0200
Subject: [PATCH] Revert "ob-exp: Remove spurious comma un-escaping"

This reverts commit 0279d84cd7f857535342b4ec3c2e70ac76c1ee27.

The original commit breaks exports containing lines beginning
with "* "  or "#+" in src blocks.
---
 lisp/ob-exp.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index e824992..a1a945f 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -48,6 +48,7 @@
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-id-get "org-id" (&optional pom create prefix))
+(declare-function org-escape-code-in-string "org-src" (s))
 
 (defcustom org-export-babel-evaluate t
   "Switch controlling code evaluation during export.
@@ -385,7 +386,7 @@ replaced with its value."
        org-babel-exp-inline-code-template
        org-babel-exp-code-template)
    `(("lang"  . ,(nth 0 info))
-     ("body"  . ,(nth 1 info))
+     ("body"  . ,(org-escape-code-in-string (nth 1 info)))
      ("switches" . ,(let ((f (nth 3 info)))
 		      (and (org-string-nw-p f) (concat " " f))))
      ("flags" . ,(let ((f (assq :flags (nth 2 info))))
-- 
2.9.0


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

* Re: PATCH for Re: Bug: src block asterisk escaping doesn't work anymore
  2016-07-16 19:12   ` PATCH for " Robert Klein
@ 2016-07-17 10:22     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2016-07-17 10:22 UTC (permalink / raw)
  To: Robert Klein; +Cc: emacs-orgmode, Charles C. Berry

Hello,

Robert Klein <roklein@roklein.de> writes:

> Thanks for the confirmation.  I also have issues exporting
> http://orgmode.org/worg/dev/org-element-api.org -- while the error
> message is "Unable to resolve code reference: end" bisecting leads to
> the same commit; reverting the commit solves the issue.  I reckon the
> line(s) beginning with #+ in the src block above confuse the exporter
> in the same way.

I reverted the commit. Thank you.


Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2016-07-17 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-13 13:48 Bug: src block asterisk escaping doesn't work anymore Robert Klein
2016-07-14  1:47 ` Charles C. Berry
2016-07-16 19:12   ` PATCH for " Robert Klein
2016-07-17 10:22     ` 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).