* Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)]
@ 2014-01-11 13:55 Giuseppe Lipari
2014-01-19 16:02 ` Bastien
0 siblings, 1 reply; 9+ messages in thread
From: Giuseppe Lipari @ 2014-01-11 13:55 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 7279 bytes --]
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See
http://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org-mode mailing list.
------------------------------------------------------------------------
Dear all,
I have a problem with org-babel and the export of C++11 code to LaTeX.
I report below a simple example of a problem file:
---------------------
#+TITLE: CPP example
#+LaTeX_HEADER: \usepackage{minted}
#+LaTeX_HEADER: \usemintedstyle{emacs}
* Example of c++11
An example of c++11
#+HEADERS: :results output :exports both
#+name: Example
#+BEGIN_SRC cpp
#include <vector>
#include <iostream>
using namespace std;
int main()
{
std::vector<int> v = {1, 2, 3};
for (auto x : v) cout << x << ", ";
cout << endl;
}
#+END_SRC
And these are the results:
#+RESULTS: Example
: 1, 2, 3,
------------------
If I export this file to LaTeX everything works fine, and I see the code
nicely formatter in the pdf file. Unfortunately, when I try to compile and
execute the
code with C-c-C-c, I get an error: in facts, to compile the code above
according to
the c++11 standard, I need to specify ":flags -std=c++11". Therefore, I
changed the header as follows:
------------------
#+BEGIN_SRC cpp :flags -std=c++11
...
#+END_SRC
---------------------
Now, when I press C-c-C-c, I the code is compiled and executed
correctly. However, I get another problem: when exporting to LaTeX,
the code disappears from the pdf file. By looking at the generated .tex
file, I see the following lines:
---------------------
\begin{minted}[]{cpp"-std=c++11"}
...
\end{minted}
---------------------
As you can see, the flags are wrongly copied after the language
specification. Therefore, minted does not work and does not output the
code.
I tried to put the :flags specification in the HEADERS, but it does not
work (fails for compile).
Also, the results do not appear in the pdf file, even by specifying
":exports both".
Any clue of what it is going on?
Best
Giuseppe Lipari
Emacs : GNU Emacs 23.4.1 (i686-pc-linux-gnu, GTK+ Version 2.24.18)
of 2013-06-17 on akateko, modified by Debian
Package: Org-mode version 7.9.4 (7.9.4-elpa @
/home/lipari/.emacs.d/elpa/org-20130401/)
current state:
==============
(setq
org-export-latex-after-initial-vars-hook '(org-beamer-after-initial-vars)
org-export-latex-listings 'minted
org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
org-babel-load-languages '((dot) (emacs-lisp . t) (mscgen) (latex . t)
(python . t) (sh) (C . t))
org-metaup-hook '(org-babel-load-in-session-maybe)
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-babel-tangle-lang-exts '(("C++" . "cpp") ("python" . "py") ("latex" .
"tex")
("emacs-lisp" . "el"))
org-export-latex-format-toc-function 'org-export-latex-format-toc-default
org-latex-to-pdf-process '("pdflatex -shell-escape -interaction
nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction
nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction
nonstopmode -output-directory %o %f")
org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-confirm-shell-link-function 'yes-or-no-p
org-export-first-hook '(org-beamer-initialize-open-trackers)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-export-latex-packages-alist '(("" "minted"))
org-babel-pre-tangle-hook '(save-buffer)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-export-latex-classes '(("acm-proc"
"\\documentclass{acm_proc_article-sp}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("article" "\\documentclass{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}"))
("article" "\\documentclass[11pt]{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("report" "\\documentclass[11pt]{report}"
("\\part{%s}" . "\\part*{%s}") ("\\chapter{%s}" .
"\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("book" "\\documentclass[11pt]{book}" ("\\part{%s}" .
"\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("beamer" "\\documentclass{beamer}" org-beamer-sectioning))
org-export-preprocess-before-normalizing-links-hook
'(org-remove-file-link-modifiers)
org-export-latex-hyperref-format "\\ref{%s}"
org-mode-hook '(#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook org-show-block-all append
local] 5]
#[nil "\300\301\302\303\304$\207"
[org-add-hook change-major-mode-hook org-babel-show-result-all
append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
org-confirm-elisp-link-function 'yes-or-no-p
org-export-interblocks '((src org-babel-exp-non-block-elements))
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-occur-hook '(org-first-headline-recenter)
org-from-is-user-regexp "\\<Giuseppe Lipari\\>"
org-export-preprocess-before-selecting-backend-code-hook
'(org-beamer-select-beamer-code)
org-confirm-babel-evaluate nil
org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc
org-beamer-auto-fragile-frames
org-beamer-place-default-actions-for-lists)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-export-blocks '((src org-babel-exp-src-block nil)
(export-comment org-export-blocks-format-comment t)
(ditaa org-export-blocks-format-ditaa nil)
(dot org-export-blocks-format-dot nil))
)
--
Giuseppe Lipari
RETIS Lab, CEIIC
Scuola Superiore Sant'Anna
via Moruzzi, 1
56127 Pisa
tel: 050 882030
fax: 050 882003
web: http://feanor.sssup.it/~lipari/
blogs: http://scacciamennule.blogspot.com
http://okpanico,wordpress.com
http://algoland.wordpress.com
[-- Attachment #2: Type: text/html, Size: 9253 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)]
2014-01-11 13:55 Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)] Giuseppe Lipari
@ 2014-01-19 16:02 ` Bastien
2014-01-20 9:35 ` Giuseppe Lipari
0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-01-19 16:02 UTC (permalink / raw)
To: Giuseppe Lipari; +Cc: emacs-orgmode
Hi Giuseppe,
Giuseppe Lipari <giulipari@gmail.com> writes:
> Remember to cover the basics, that is, what you expected to happen
> and
> what in fact did happen. You don't know how to make a good report?
> See
>
> http://orgmode.org/manual/Feedback.html#Feedback
>
> Your bug report will be posted to the Org-mode mailing list.
> ------------------------------------------------------------------------
>
> Dear all,
>
> I have a problem with org-babel and the export of C++11 code to
> LaTeX.
>
> I report below a simple example of a problem file:
I can reproduce this bug -- maybe Eric will have time to fix it,
otherwise I will have a look next week.
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)]
2014-01-19 16:02 ` Bastien
@ 2014-01-20 9:35 ` Giuseppe Lipari
2014-01-20 13:13 ` Nicolas Goaziou
0 siblings, 1 reply; 9+ messages in thread
From: Giuseppe Lipari @ 2014-01-20 9:35 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1701 bytes --]
Dear Bastien,
thanks for the response. I did some debugging, but I am not an expert of
elisp and org-mode. Anyway, this is what I found:
I put a breakpoint in fuinction org-latex-src-block() which receives
src-block as parameter. This parameter contains field language already set
to c++\"-std=c++11\", which is of course wrong. Therefore the problem is
before this function is called, but I could not follow the chain and so I
do not know precisely which function is responsible for this.
Also, the bug triggers also when I specify C as a language. Therefore,
probably the problem is somewhere in ob-C.el.
Thanks again
Giuseppe Lipari
2014/1/19 Bastien <bzg@gnu.org>
> Hi Giuseppe,
>
> Giuseppe Lipari <giulipari@gmail.com> writes:
>
> > Remember to cover the basics, that is, what you expected to happen
> > and
> > what in fact did happen. You don't know how to make a good report?
> > See
> >
> > http://orgmode.org/manual/Feedback.html#Feedback
> >
> > Your bug report will be posted to the Org-mode mailing list.
> > ------------------------------------------------------------------------
> >
> > Dear all,
> >
> > I have a problem with org-babel and the export of C++11 code to
> > LaTeX.
> >
> > I report below a simple example of a problem file:
>
> I can reproduce this bug -- maybe Eric will have time to fix it,
> otherwise I will have a look next week.
>
> Thanks,
>
> --
> Bastien
>
--
Giuseppe Lipari
RETIS Lab, CEIIC
Scuola Superiore Sant'Anna
via Moruzzi, 1
56127 Pisa
tel: 050 882030
fax: 050 882003
web: http://feanor.sssup.it/~lipari/
blogs: http://scacciamennule.blogspot.com
http://okpanico,wordpress.com
http://algoland.wordpress.com
[-- Attachment #2: Type: text/html, Size: 2835 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)]
2014-01-20 9:35 ` Giuseppe Lipari
@ 2014-01-20 13:13 ` Nicolas Goaziou
2014-01-20 13:17 ` Nicolas Goaziou
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2014-01-20 13:13 UTC (permalink / raw)
To: Giuseppe Lipari; +Cc: Bastien, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 828 bytes --]
Hello,
Giuseppe Lipari <giulipari@gmail.com> writes:
> thanks for the response. I did some debugging, but I am not an expert of
> elisp and org-mode. Anyway, this is what I found:
>
> I put a breakpoint in fuinction org-latex-src-block() which receives
> src-block as parameter. This parameter contains field language already set
> to c++\"-std=c++11\", which is of course wrong. Therefore the problem is
> before this function is called, but I could not follow the chain and so I
> do not know precisely which function is responsible for this.
>
> Also, the bug triggers also when I specify C as a language. Therefore,
> probably the problem is somewhere in ob-C.el.
I think the following patch fixes the issue. I'll let Eric decide if it
has to be applied or not.
Thank you for the report.
Regards,
--
Nicolas Goaziou
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-exp-Fix-export-of-src-blocks-with-flags.patch --]
[-- Type: text/x-diff, Size: 1959 bytes --]
From bbe85db3abbdcc0973dcd0fb783728d4374b20fb Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Mon, 20 Jan 2014 14:07:57 +0100
Subject: [PATCH] ob-exp: Fix export of src blocks with flags
* lisp/ob-exp.el (org-babel-exp-code): Fix export of src blocks with
flags.
* testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-flags):
New test.
Thanks to Giuseppe Lipari for reporting it.
---
lisp/ob-exp.el | 3 ++-
testing/lisp/test-ob-exp.el | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index b2be510..84eb011 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -341,11 +341,12 @@ replaced with its value."
org-babel-exp-code-template
`(("lang" . ,(nth 0 info))
("body" . ,(org-escape-code-in-string (nth 1 info)))
+ ("flags" . ,(let ((f (assq :flags (nth 2 info))))
+ (when f (concat " " (cdr f)))))
,@(mapcar (lambda (pair)
(cons (substring (symbol-name (car pair)) 1)
(format "%S" (cdr pair))))
(nth 2 info))
- ("flags" . ,(let ((f (nth 3 info))) (when f (concat " " f))))
("name" . ,(or (nth 4 info) "")))))
(defun org-babel-exp-results (info type &optional silent hash)
diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index 2f5342b..33585e4 100644
--- a/testing/lisp/test-ob-exp.el
+++ b/testing/lisp/test-ob-exp.el
@@ -303,6 +303,15 @@ Here is one at the end of a line. =2=
(org-export-execute-babel-code)
(buffer-string)))))
+(ert-deftest ob-export/export-src-block-with-flags ()
+ "Test exporting a source block with a flag."
+ (should
+ (string-match "\\`#\\+BEGIN_SRC emacs-lisp -some-flag$"
+ (org-test-with-temp-text
+ "#+BEGIN_SRC emacs-lisp :flags -some-flag\n\(+ 1 1)\n#+END_SRC"
+ (org-export-execute-babel-code)
+ (buffer-string)))))
+
(provide 'test-ob-exp)
;;; test-ob-exp.el ends here
--
1.8.5.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)]
2014-01-20 13:13 ` Nicolas Goaziou
@ 2014-01-20 13:17 ` Nicolas Goaziou
2014-01-20 13:22 ` Nicolas Goaziou
0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2014-01-20 13:17 UTC (permalink / raw)
To: Giuseppe Lipari; +Cc: Bastien, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 217 bytes --]
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> I think the following patch fixes the issue. I'll let Eric decide if it
> has to be applied or not.
The test is wrong. Corrected version follows.
--
Nicolas Goaziou
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-exp-Fix-export-of-src-blocks-with-flags.patch --]
[-- Type: text/x-diff, Size: 1966 bytes --]
From 26d72c6452864be2acb165e087ea5387fb3f6457 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Mon, 20 Jan 2014 14:07:57 +0100
Subject: [PATCH] ob-exp: Fix export of src blocks with flags
* lisp/ob-exp.el (org-babel-exp-code): Fix export of src blocks with
flags.
* testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-flags):
New test.
Thanks to Giuseppe Lipari for reporting it.
---
lisp/ob-exp.el | 3 ++-
testing/lisp/test-ob-exp.el | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index b2be510..84eb011 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -341,11 +341,12 @@ replaced with its value."
org-babel-exp-code-template
`(("lang" . ,(nth 0 info))
("body" . ,(org-escape-code-in-string (nth 1 info)))
+ ("flags" . ,(let ((f (assq :flags (nth 2 info))))
+ (when f (concat " " (cdr f)))))
,@(mapcar (lambda (pair)
(cons (substring (symbol-name (car pair)) 1)
(format "%S" (cdr pair))))
(nth 2 info))
- ("flags" . ,(let ((f (nth 3 info))) (when f (concat " " f))))
("name" . ,(or (nth 4 info) "")))))
(defun org-babel-exp-results (info type &optional silent hash)
diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index 2f5342b..7fb60c7 100644
--- a/testing/lisp/test-ob-exp.el
+++ b/testing/lisp/test-ob-exp.el
@@ -303,6 +303,15 @@ Here is one at the end of a line. =2=
(org-export-execute-babel-code)
(buffer-string)))))
+(ert-deftest ob-export/export-src-block-with-flags ()
+ "Test exporting a source block with a flag."
+ (should
+ (string-match "\\`#\\+BEGIN_SRC emacs-lisp :flags -some-flag$"
+ (org-test-with-temp-text
+ "#+BEGIN_SRC emacs-lisp :flags -some-flag\n\(+ 1 1)\n#+END_SRC"
+ (org-export-execute-babel-code)
+ (buffer-string)))))
+
(provide 'test-ob-exp)
;;; test-ob-exp.el ends here
--
1.8.5.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)]
2014-01-20 13:17 ` Nicolas Goaziou
@ 2014-01-20 13:22 ` Nicolas Goaziou
2014-01-20 13:41 ` Giuseppe Lipari
2014-01-20 15:26 ` Eric Schulte
0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2014-01-20 13:22 UTC (permalink / raw)
To: Giuseppe Lipari; +Cc: Bastien, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 348 bytes --]
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> I think the following patch fixes the issue. I'll let Eric decide if it
>> has to be applied or not.
>
> The test is wrong. Corrected version follows.
Ah well. This is getting embarrassing. Third, and hopefully last,
attempt.
--
Nicolas Goaziou
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-exp-Fix-export-of-src-blocks-with-flags.patch --]
[-- Type: text/x-diff, Size: 1959 bytes --]
From dde6af3a6230b37aabfb4f75c2dee89433958375 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Mon, 20 Jan 2014 14:07:57 +0100
Subject: [PATCH] ob-exp: Fix export of src blocks with flags
* lisp/ob-exp.el (org-babel-exp-code): Fix export of src blocks with
flags.
* testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-flags):
New test.
Thanks to Giuseppe Lipari for reporting it.
---
lisp/ob-exp.el | 3 ++-
testing/lisp/test-ob-exp.el | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index b2be510..84eb011 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -341,11 +341,12 @@ replaced with its value."
org-babel-exp-code-template
`(("lang" . ,(nth 0 info))
("body" . ,(org-escape-code-in-string (nth 1 info)))
+ ("flags" . ,(let ((f (assq :flags (nth 2 info))))
+ (when f (concat " " (cdr f)))))
,@(mapcar (lambda (pair)
(cons (substring (symbol-name (car pair)) 1)
(format "%S" (cdr pair))))
(nth 2 info))
- ("flags" . ,(let ((f (nth 3 info))) (when f (concat " " f))))
("name" . ,(or (nth 4 info) "")))))
(defun org-babel-exp-results (info type &optional silent hash)
diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
index 2f5342b..33585e4 100644
--- a/testing/lisp/test-ob-exp.el
+++ b/testing/lisp/test-ob-exp.el
@@ -303,6 +303,15 @@ Here is one at the end of a line. =2=
(org-export-execute-babel-code)
(buffer-string)))))
+(ert-deftest ob-export/export-src-block-with-flags ()
+ "Test exporting a source block with a flag."
+ (should
+ (string-match "\\`#\\+BEGIN_SRC emacs-lisp -some-flag$"
+ (org-test-with-temp-text
+ "#+BEGIN_SRC emacs-lisp :flags -some-flag\n\(+ 1 1)\n#+END_SRC"
+ (org-export-execute-babel-code)
+ (buffer-string)))))
+
(provide 'test-ob-exp)
;;; test-ob-exp.el ends here
--
1.8.5.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)]
2014-01-20 13:22 ` Nicolas Goaziou
@ 2014-01-20 13:41 ` Giuseppe Lipari
2014-01-20 15:26 ` Eric Schulte
1 sibling, 0 replies; 9+ messages in thread
From: Giuseppe Lipari @ 2014-01-20 13:41 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 835 bytes --]
Dear Nicolas,
I applied your patch to the latest version (from git) and now it works!
Well done, thanks a lot!
Giuseppe
2014/1/20 Nicolas Goaziou <n.goaziou@gmail.com>
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
> > Nicolas Goaziou <n.goaziou@gmail.com> writes:
> >
> >> I think the following patch fixes the issue. I'll let Eric decide if it
> >> has to be applied or not.
> >
> > The test is wrong. Corrected version follows.
>
> Ah well. This is getting embarrassing. Third, and hopefully last,
> attempt.
>
> --
> Nicolas Goaziou
>
--
Giuseppe Lipari
RETIS Lab, CEIIC
Scuola Superiore Sant'Anna
via Moruzzi, 1
56127 Pisa
tel: 050 882030
fax: 050 882003
web: http://feanor.sssup.it/~lipari/
blogs: http://scacciamennule.blogspot.com
http://okpanico,wordpress.com
http://algoland.wordpress.com
[-- Attachment #2: Type: text/html, Size: 1805 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)]
2014-01-20 13:22 ` Nicolas Goaziou
2014-01-20 13:41 ` Giuseppe Lipari
@ 2014-01-20 15:26 ` Eric Schulte
2014-01-20 16:18 ` Nicolas Goaziou
1 sibling, 1 reply; 9+ messages in thread
From: Eric Schulte @ 2014-01-20 15:26 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode, Giuseppe Lipari
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>>
>>> I think the following patch fixes the issue. I'll let Eric decide if it
>>> has to be applied or not.
>>
>> The test is wrong. Corrected version follows.
>
> Ah well. This is getting embarrassing. Third, and hopefully last,
> attempt.
>
This patch looks fine to me. As far as I can tell this issue lies
completely within the exporting machinery (not in code evaluation) so I
happily defer to the experts.
Best,
>
> --
> Nicolas Goaziou
>
> From dde6af3a6230b37aabfb4f75c2dee89433958375 Mon Sep 17 00:00:00 2001
> From: Nicolas Goaziou <n.goaziou@gmail.com>
> Date: Mon, 20 Jan 2014 14:07:57 +0100
> Subject: [PATCH] ob-exp: Fix export of src blocks with flags
>
> * lisp/ob-exp.el (org-babel-exp-code): Fix export of src blocks with
> flags.
> * testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-flags):
> New test.
>
> Thanks to Giuseppe Lipari for reporting it.
> ---
> lisp/ob-exp.el | 3 ++-
> testing/lisp/test-ob-exp.el | 9 +++++++++
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
> index b2be510..84eb011 100644
> --- a/lisp/ob-exp.el
> +++ b/lisp/ob-exp.el
> @@ -341,11 +341,12 @@ replaced with its value."
> org-babel-exp-code-template
> `(("lang" . ,(nth 0 info))
> ("body" . ,(org-escape-code-in-string (nth 1 info)))
> + ("flags" . ,(let ((f (assq :flags (nth 2 info))))
> + (when f (concat " " (cdr f)))))
> ,@(mapcar (lambda (pair)
> (cons (substring (symbol-name (car pair)) 1)
> (format "%S" (cdr pair))))
> (nth 2 info))
> - ("flags" . ,(let ((f (nth 3 info))) (when f (concat " " f))))
> ("name" . ,(or (nth 4 info) "")))))
>
> (defun org-babel-exp-results (info type &optional silent hash)
> diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el
> index 2f5342b..33585e4 100644
> --- a/testing/lisp/test-ob-exp.el
> +++ b/testing/lisp/test-ob-exp.el
> @@ -303,6 +303,15 @@ Here is one at the end of a line. =2=
> (org-export-execute-babel-code)
> (buffer-string)))))
>
> +(ert-deftest ob-export/export-src-block-with-flags ()
> + "Test exporting a source block with a flag."
> + (should
> + (string-match "\\`#\\+BEGIN_SRC emacs-lisp -some-flag$"
> + (org-test-with-temp-text
> + "#+BEGIN_SRC emacs-lisp :flags -some-flag\n\(+ 1 1)\n#+END_SRC"
> + (org-export-execute-babel-code)
> + (buffer-string)))))
> +
> (provide 'test-ob-exp)
>
> ;;; test-ob-exp.el ends here
--
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-01-20 16:18 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-11 13:55 Bug: Org-babel export of c++11 code to Latex does not work properly [7.9.4 (7.9.4-elpa @ /home/lipari/.emacs.d/elpa/org-20130401/)] Giuseppe Lipari
2014-01-19 16:02 ` Bastien
2014-01-20 9:35 ` Giuseppe Lipari
2014-01-20 13:13 ` Nicolas Goaziou
2014-01-20 13:17 ` Nicolas Goaziou
2014-01-20 13:22 ` Nicolas Goaziou
2014-01-20 13:41 ` Giuseppe Lipari
2014-01-20 15:26 ` Eric Schulte
2014-01-20 16:18 ` 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).