From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Exporting C++ code block to html Date: Sat, 28 Sep 2013 06:05:22 -0600 Message-ID: <87ob7dw238.fsf@gmail.com> References: <5245D235.20709@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPtq0-0005zJ-Sl for emacs-orgmode@gnu.org; Sat, 28 Sep 2013 08:41:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VPtpt-00075B-1e for emacs-orgmode@gnu.org; Sat, 28 Sep 2013 08:41:32 -0400 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]:63399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VPtps-00074r-La for emacs-orgmode@gnu.org; Sat, 28 Sep 2013 08:41:24 -0400 Received: by mail-pa0-f49.google.com with SMTP id ld10so3913319pab.22 for ; Sat, 28 Sep 2013 05:41:23 -0700 (PDT) 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: Xavier Garrido Cc: "emacs-orgmode@gnu.org" Xavier Garrido writes: > Dear Orgers, > > I face a problem when I want to 'html' export a pretty simple org file := =20 > test.org contains the following lines > > #+BEGIN_SRC c++ > int j=3D 1; > #+END_SRC > > If I do > emacs --batch -q --eval '(require (quote org))' --visit test.org \=20 > --funcall org-html-export-to-html > I had to do the following to re-create this error. emacs --batch --eval "(progn (add-to-list 'load-path \"~/src/org-mode/lisp\= ") (require 'org) (add-to-list 'load-path \"~/src/org-mode/contrib/lisp\")(= require 'htmlize))" --visit /tmp/cpp-test.org --funcall org-html-export-to-= html > > I get > Loading vc-git... > Loading cc-langs... > Symbol's function definition is void: nil > With the above I get the same > > I have also activated the debug mode but the messages are quite > cryptic for me (attached file). The point is that it only crashes with > C/C++ languages but works with python, awk, sh, emacs-lisp ... > > I'm using orgmode 8.2-35 from the git repository. > I think this may be a bug in cc-mode when run in a batch Emacs session. My guess is that the `c-standard-font-lock-fontify-region-function' is never set. You could either try to set this value manually, or report this to the cc-mode maintainers, but I wouldn't be surprised if they ask why you want fontification in a batch session. Setting this variable manually from the command line with the following fixes this problem for me. emacs --batch --eval "(progn (add-to-list 'load-path \"~/src/org-mode/lisp\= ") (require 'org) (add-to-list 'load-path \"~/src/org-mode/contrib/lisp\")(= require 'htmlize) (setq c-standard-font-lock-fontify-region-function 'font-= lock-default-fontify-region))" --visit /tmp/cpp-test.org --funcall org-html= -export-to-html Cheers, > > Thanks for your help, > Xavier > > oading vc-git... > Loading cc-langs... > Debugger entered--Lisp error: (void-function nil) > nil(1 12 nil) > c-font-lock-fontify-region(1 12 nil) > font-lock-fontify-region(1 12 nil) > byte-code("\212\303 \304\216\305ed #\210\306 \210\307\211+\207" [save-m= atch-data-internal verbose font-lock-fontified match-data ((byte-code "\30\= 302\"\207" [save-match-data-internal set-match-data evaporate] 3)) font-loc= k-fontify-region font-lock-after-fontify-buffer t] 4) > font-lock-default-fontify-buffer() > font-lock-fontify-buffer() > org-html-fontify-code("int j =3D 1;\n" "c++") > org-html-do-format-code("int j =3D 1;\n" "c++" nil t nil) > org-html-format-code((src-block (:language "c++" :switches nil :paramet= ers nil :begin 1 :end 39 :number-lines nil :preserve-indent nil :retain-lab= els t :use-labels t :label-fmt nil :hiddenp nil :value "int j =3D 1;\n" :po= st-blank 0 :post-affiliated 1 :parent (section (:begin 1 :end 39 :contents-= begin 1 :contents-end 39 :post-blank 0 :parent (org-data nil #2)) #0))) (:e= xport-options nil :input-file "/home/garrido/Teachdir/C++.test/test.org" :t= itle "test" :html-extension "html" :html-link-org-as-html t :html-doctype "= xhtml-strict" :html-container "div" :html-html5-fancy nil :html-link-use-ab= s-url nil :html-link-home "" :html-link-up "" :html-mathjax "" :html-postam= ble auto :html-preamble t :html-head "" :html-head-extra "" :html-head-incl= ude-default-style t :html-head-include-scripts t :html-table-attributes (:b= order "2" :cellspacing "0" :cellpadding "6" :rules "groups" :frame "hsides"= ) :html-table-row-tags ("" . "") :html-xml-declaration (("html" . = "") ("php" . "\"; ?>")) :html-inline-image= s t :creator "Emacs 24= .3.1 (Org mode 8.2)" :with-latex t :au= thor nil ...)) > org-html-src-block((src-block (:language "c++" :switches nil :parameter= s nil :begin 1 :end 39 :number-lines nil :preserve-indent nil :retain-label= s t :use-labels t :label-fmt nil :hiddenp nil :value "int j =3D 1;\n" :post= -blank 0 :post-affiliated 1 :parent (section (:begin 1 :end 39 :contents-be= gin 1 :contents-end 39 :post-blank 0 :parent (org-data nil #2)) #0))) nil (= :export-options nil :input-file "/home/garrido/Teachdir/C++.test/test.org" = :title "test" :html-extension "html" :html-link-org-as-html t :html-doctype= "xhtml-strict" :html-container "div" :html-html5-fancy nil :html-link-use-= abs-url nil :html-link-home "" :html-link-up "" :html-mathjax "" :html-post= amble auto :html-preamble t :html-head "" :html-head-extra "" :html-head-in= clude-default-style t :html-head-include-scripts t :html-table-attributes (= :border "2" :cellspacing "0" :cellpadding "6" :rules "groups" :frame "hside= s") :html-table-row-tags ("" . "") :html-xml-declaration (("html" = . "") ("php" . "\"; ?>")) :html-inline-ima= ges t :creator "Emacs = 24.3.1 (Org mode 8.2)" :with-latex t := author nil ...)) > org-export-data((src-block (:language "c++" :switches nil :parameters n= il :begin 1 :end 39 :number-lines nil :preserve-indent nil :retain-labels t= :use-labels t :label-fmt nil :hiddenp nil :value "int j =3D 1;\n" :post-bl= ank 0 :post-affiliated 1 :parent (section (:begin 1 :end 39 :contents-begin= 1 :contents-end 39 :post-blank 0 :parent (org-data nil #2)) #0))) (:export= -options nil :input-file "/home/garrido/Teachdir/C++.test/test.org" :title = "test" :html-extension "html" :html-link-org-as-html t :html-doctype "xhtml= -strict" :html-container "div" :html-html5-fancy nil :html-link-use-abs-url= nil :html-link-home "" :html-link-up "" :html-mathjax "" :html-postamble a= uto :html-preamble t :html-head "" :html-head-extra "" :html-head-include-d= efault-style t :html-head-include-scripts t :html-table-attributes (:border= "2" :cellspacing "0" :cellpadding "6" :rules "groups" :frame "hsides") :ht= ml-table-row-tags ("" . "") :html-xml-declaration (("html" . "") ("php" . "\"; ?>")) :html-inline-images t := creator "Emacs 24.3.1 = (Org mode 8.2)" :with-latex t :author = nil ...)) > #[(element) "\302 \"\207" [element info org-export-data] 3]((src-bl= ock (:language "c++" :switches nil :parameters nil :begin 1 :end 39 :number= -lines nil :preserve-indent nil :retain-labels t :use-labels t :label-fmt n= il :hiddenp nil :value "int j =3D 1;\n" :post-blank 0 :post-affiliated 1 :p= arent (section (:begin 1 :end 39 :contents-begin 1 :contents-end 39 :post-b= lank 0 :parent (org-data nil #2)) #0)))) > mapconcat(#[(element) "\302 \"\207" [element info org-export-data] 3]= ((src-block (:language "c++" :switches nil :parameters nil :begin 1 :end 3= 9 :number-lines nil :preserve-indent nil :retain-labels t :use-labels t :la= bel-fmt nil :hiddenp nil :value "int j =3D 1;\n" :post-blank 0 :post-affili= ated 1 :parent (section (:begin 1 :end 39 :contents-begin 1 :contents-end 3= 9 :post-blank 0 :parent (org-data nil #3)) #1)))) "") > org-export-data((section (:begin 1 :end 39 :contents-begin 1 :contents-= end 39 :post-blank 0 :parent (org-data nil #0)) (src-block (:language "c++"= :switches nil :parameters nil :begin 1 :end 39 :number-lines nil :preserve= -indent nil :retain-labels t :use-labels t :label-fmt nil :hiddenp nil :val= ue "int j =3D 1;\n" :post-blank 0 :post-affiliated 1 :parent #0))) (:export= -options nil :input-file "/home/garrido/Teachdir/C++.test/test.org" :title = "test" :html-extension "html" :html-link-org-as-html t :html-doctype "xhtml= -strict" :html-container "div" :html-html5-fancy nil :html-link-use-abs-url= nil :html-link-home "" :html-link-up "" :html-mathjax "" :html-postamble a= uto :html-preamble t :html-head "" :html-head-extra "" :html-head-include-d= efault-style t :html-head-include-scripts t :html-table-attributes (:border= "2" :cellspacing "0" :cellpadding "6" :rules "groups" :frame "hsides") :ht= ml-table-row-tags ("" . "") :html-xml-declaration (("html" . "") ("php" . "\"; ?>")) :html-inline-images t := creator "Emacs 24.3.1 = (Org mode 8.2)" :with-latex t :author = nil ...)) > #[(element) "\302 \"\207" [element info org-export-data] 3]((sectio= n (:begin 1 :end 39 :contents-begin 1 :contents-end 39 :post-blank 0 :paren= t (org-data nil #0)) (src-block (:language "c++" :switches nil :parameters = nil :begin 1 :end 39 :number-lines nil :preserve-indent nil :retain-labels = t :use-labels t :label-fmt nil :hiddenp nil :value "int j =3D 1;\n" :post-b= lank 0 :post-affiliated 1 :parent #0)))) > mapconcat(#[(element) "\302 \"\207" [element info org-export-data] 3]= ((section (:begin 1 :end 39 :contents-begin 1 :contents-end 39 :post-blank= 0 :parent (org-data nil #1)) (src-block (:language "c++" :switches nil :pa= rameters nil :begin 1 :end 39 :number-lines nil :preserve-indent nil :retai= n-labels t :use-labels t :label-fmt nil :hiddenp nil :value "int j =3D 1;\n= " :post-blank 0 :post-affiliated 1 :parent #1)))) "") > org-export-data((org-data nil (section (:begin 1 :end 39 :contents-begi= n 1 :contents-end 39 :post-blank 0 :parent #0) (src-block (:language "c++" = :switches nil :parameters nil :begin 1 :end 39 :number-lines nil :preserve-= indent nil :retain-labels t :use-labels t :label-fmt nil :hiddenp nil :valu= e "int j =3D 1;\n" :post-blank 0 :post-affiliated 1 :parent #1)))) (:export= -options nil :input-file "/home/garrido/Teachdir/C++.test/test.org" :title = "test" :html-extension "html" :html-link-org-as-html t :html-doctype "xhtml= -strict" :html-container "div" :html-html5-fancy nil :html-link-use-abs-url= nil :html-link-home "" :html-link-up "" :html-mathjax "" :html-postamble a= uto :html-preamble t :html-head "" :html-head-extra "" :html-head-include-d= efault-style t :html-head-include-scripts t :html-table-attributes (:border= "2" :cellspacing "0" :cellpadding "6" :rules "groups" :frame "hsides") :ht= ml-table-row-tags ("" . "") :html-xml-declaration (("html" . "") ("php" . "\"; ?>")) :html-inline-images t := creator "Emacs 24.3.1 = (Org mode 8.2)" :with-latex t :author = nil ...)) > org-export-as(html nil nil nil nil) > org-export-to-file(html "./test.html" nil nil nil nil nil) > org-html-export-to-html() > call-interactively(org-html-export-to-html nil nil) > command-execute(org-html-export-to-html) > command-line-1(("--eval" "(require (quote org))" "--eval" "(setq debug-= on-error t)" "--visit" "test.org" "--funcall" "org-html-export-to-html")) > command-line() > normal-top-level() --=20 Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D