From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: 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/)] Date: Mon, 20 Jan 2014 14:13:32 +0100 Message-ID: <87eh42zthf.fsf@gmail.com> References: <87zjms7yeq.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5EfK-0002gb-F3 for emacs-orgmode@gnu.org; Mon, 20 Jan 2014 08:13:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5Ef8-0003H8-UQ for emacs-orgmode@gnu.org; Mon, 20 Jan 2014 08:13:22 -0500 In-Reply-To: (Giuseppe Lipari's message of "Mon, 20 Jan 2014 10:35:10 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Giuseppe Lipari Cc: Bastien , emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hello, Giuseppe Lipari 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ob-exp-Fix-export-of-src-blocks-with-flags.patch >From bbe85db3abbdcc0973dcd0fb783728d4374b20fb Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou 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 --=-=-=--