From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: Re: new exporter (was: Bug: Images in Latex..) Date: Sat, 02 Jun 2012 19:16:37 +0200 Message-ID: <87396dzlai.fsf_-_@Rainer.invalid> References: <3C38420E-E2FA-4CAB-B3FD-9C5F8584E60A@gmail.com> <81fwadrgoo.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sarwi-0006Wg-2D for emacs-orgmode@gnu.org; Sat, 02 Jun 2012 13:17:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sarwf-0002cG-3N for emacs-orgmode@gnu.org; Sat, 02 Jun 2012 13:16:59 -0400 Received: from plane.gmane.org ([80.91.229.3]:46211) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sarwe-0002bP-Jh for emacs-orgmode@gnu.org; Sat, 02 Jun 2012 13:16:57 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Sarwc-0006Vz-Go for emacs-orgmode@gnu.org; Sat, 02 Jun 2012 19:16:54 +0200 Received: from pd9eb43c6.dip.t-dialin.net ([217.235.67.198]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 02 Jun 2012 19:16:53 +0200 Received: from Stromeko by pd9eb43c6.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 02 Jun 2012 19:16:53 +0200 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: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Jambunathan K writes: > Have you tried the new exporter? > > 1. Add contrib/lisp to load-path > 2. M-x load-library RET org-export RET > 3. M-x org-export-dispatch RET Better yet, hardlink those files in contrib/lisp you want to use into lisp/, but remember to always edit them in contrib/lisp and never in lisp/. That way, the build system will handle them correctly and you can use them from an installed org. In case of the new exporter: ln contrib/lisp/org-{element,export,e-*}.el lisp/ The byte compiler isn't happy with the new exporter at the moment, lots of free variables, some variables declared later than used and some CL macros at runtime... here's my first stab on fixing some of that: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0005-Make-byte-compiler-more-happy.patch Content-Description: add requires to new exporter >From d7ef1bfbaef873521731697d86112029f02cdc8b Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sat, 2 Jun 2012 18:38:24 +0200 Subject: [PATCH 5/5] Make byte-compiler more happy * contrib/lisp/org-e-ascii.el: Remove declarations and replace with require. * contrib/lisp/org-e-html.el: Remove declarations and replace with require. * contrib/lisp/org-e-latex.el: Remove declarations and replace with require. * contrib/lisp/org-e-publish.el: Remove declarations and replace with require. * contrib/lisp/org-export.el: Remove declarations and replace with require. Prevent byte-compilation, it currently would produce an error due to circular dependencies in the file. --- contrib/lisp/org-e-ascii.el | 38 ++++------------------------------ contrib/lisp/org-e-html.el | 41 +++++------------------------------- contrib/lisp/org-e-latex.el | 46 +++++------------------------------------ contrib/lisp/org-e-publish.el | 22 +++++--------------- contrib/lisp/org-export.el | 15 +++++++++----- 5 files changed, 29 insertions(+), 133 deletions(-) diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el index c8bc334..4956b14 100644 --- a/contrib/lisp/org-e-ascii.el +++ b/contrib/lisp/org-e-ascii.el @@ -32,40 +32,10 @@ ;;; Code: -(eval-when-compile (require 'cl)) - -(declare-function org-element-contents "org-element" (element)) -(declare-function org-element-property "org-element" (property element)) -(declare-function org-element-normalize-string "org-element" (s)) -(declare-function org-element-map "org-element" - (data types fun &optional info first-match)) - -(declare-function org-export-collect-footnote-definitions - "org-export" (data info)) -(declare-function org-export-collect-headlines "org-export" (info &optional n)) -(declare-function org-export-collect-listings "org-export" (info)) -(declare-function org-export-collect-tables "org-export" (info)) -(declare-function org-export-data "org-export" (data info)) -(declare-function org-export-expand-macro "org-export" (macro info)) -(declare-function org-export-format-code-default "org-export" (element info)) -(declare-function org-export-get-coderef-format "org-export" (path desc)) -(declare-function org-export-get-footnote-number "org-export" (footnote info)) -(declare-function org-export-get-headline-number "org-export" (headline info)) -(declare-function org-export-get-ordinal "org-export" - (element info &optional types predicate)) -(declare-function org-export-get-parent-headline "org-export" (blob info)) -(declare-function org-export-get-relative-level "org-export" (headline info)) -(declare-function org-export-low-level-p "org-export" (headline info)) -(declare-function org-export-output-file-name "org-export" - (extension &optional subtreep pub-dir)) -(declare-function org-export-resolve-coderef "org-export" (ref info)) -(declare-function org-export-resolve-fuzzy-link "org-export" (link info)) -(declare-function org-export-resolve-id-link "org-export" (link info)) -(declare-function org-export-resolve-radio-link "org-export" (link info)) -(declare-function - org-export-to-file "org-export" - (backend file &optional subtreep visible-only body-only ext-plist)) - +(eval-when-compile + (require 'cl)) +(require 'org-element) +(require 'org-export) ;;; Define Back-End ;; diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el index 53547a0..1f39b92 100644 --- a/contrib/lisp/org-e-html.el +++ b/contrib/lisp/org-e-html.el @@ -35,48 +35,17 @@ ;;; org-e-html.el ;;; Dependencies +(eval-when-compile + (require 'cl) + (require 'table)) +(require 'org-exp) (require 'org-export) +(require 'org-lparse) (require 'format-spec) -(eval-when-compile (require 'cl) (require 'table)) - ;;; Function Declarations -(declare-function org-element-get-property "org-element" (property element)) -(declare-function org-element-normalize-string "org-element" (s)) - -(declare-function org-export-data "org-export" (data info)) -(declare-function org-export-directory "org-export" (type plist)) -(declare-function org-export-expand-macro "org-export" (macro info)) -(declare-function org-export-first-sibling-p "org-export" (headline info)) -(declare-function org-export-footnote-first-reference-p "org-export" - (footnote-reference info)) -(declare-function org-export-get-coderef-format "org-export" (path desc)) -(declare-function org-export-get-footnote-definition "org-export" - (footnote-reference info)) -(declare-function org-export-get-footnote-number "org-export" (footnote info)) -(declare-function org-export-get-previous-element "org-export" (blob info)) -(declare-function org-export-get-relative-level "org-export" (headline info)) -(declare-function org-export-handle-code - "org-export" (element info &optional num-fmt ref-fmt delayed)) -(declare-function org-export-inline-image-p "org-export" - (link &optional extensions)) -(declare-function org-export-last-sibling-p "org-export" (headline info)) -(declare-function org-export-low-level-p "org-export" (headline info)) -(declare-function org-export-output-file-name - "org-export" (extension &optional subtreep pub-dir)) -(declare-function org-export-resolve-coderef "org-export" (ref info)) -(declare-function org-export-resolve-fuzzy-link "org-export" (link info)) -(declare-function org-export-resolve-radio-link "org-export" (link info)) -(declare-function org-export-solidify-link-text "org-export" (s)) -(declare-function - org-export-to-buffer "org-export" - (backend buffer &optional subtreep visible-only body-only ext-plist)) -(declare-function - org-export-to-file "org-export" - (backend file &optional subtreep visible-only body-only ext-plist)) - (declare-function org-id-find-id-file "org-id" (id)) (declare-function htmlize-region "ext:htmlize" (beg end)) (declare-function org-pop-to-buffer-same-window diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el index 67e9197..0bcf310 100644 --- a/contrib/lisp/org-e-latex.el +++ b/contrib/lisp/org-e-latex.el @@ -35,47 +35,11 @@ ;;; Code: -(eval-when-compile (require 'cl)) - -(defvar org-export-latex-default-packages-alist) -(defvar org-export-latex-packages-alist) - -(declare-function org-element-property "org-element" (property element)) -(declare-function org-element-normalize-string "org-element" (s)) - -(declare-function org-export-data "org-export" (data info)) -(declare-function org-export-directory "org-export" (type plist)) -(declare-function org-export-expand-macro "org-export" (macro info)) -(declare-function org-export-first-sibling-p "org-export" (headline info)) -(declare-function org-export-footnote-first-reference-p "org-export" - (footnote-reference info)) -(declare-function org-export-format-code "org-export" - (code fun &optional num-lines ref-alist)) -(declare-function org-export-format-code-default "org-export" (element info)) -(declare-function org-export-get-coderef-format "org-export" (path desc)) -(declare-function org-export-get-footnote-definition "org-export" - (footnote-reference info)) -(declare-function org-export-get-footnote-number "org-export" (footnote info)) -(declare-function org-export-get-previous-element "org-export" (blob info)) -(declare-function org-export-get-relative-level "org-export" (headline info)) -(declare-function org-export-unravel-code "org-export" (element)) -(declare-function org-export-inline-image-p "org-export" - (link &optional extensions)) -(declare-function org-export-last-sibling-p "org-export" (headline info)) -(declare-function org-export-low-level-p "org-export" (headline info)) -(declare-function org-export-output-file-name - "org-export" (extension &optional subtreep pub-dir)) -(declare-function org-export-resolve-coderef "org-export" (ref info)) -(declare-function org-export-resolve-fuzzy-link "org-export" (link info)) -(declare-function org-export-resolve-radio-link "org-export" (link info)) -(declare-function org-export-solidify-link-text "org-export" (s)) -(declare-function - org-export-to-buffer "org-export" - (backend buffer &optional subtreep visible-only body-only ext-plist)) -(declare-function - org-export-to-file "org-export" - (backend file &optional subtreep visible-only body-only ext-plist)) - +(eval-when-compile + (require 'cl)) +(require 'org-export) +(require 'org-element) +(require 'org-table) ;;; Define Back-End diff --git a/contrib/lisp/org-e-publish.el b/contrib/lisp/org-e-publish.el index 1920abf..bc71ebf 100644 --- a/contrib/lisp/org-e-publish.el +++ b/contrib/lisp/org-e-publish.el @@ -38,25 +38,13 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(eval-when-compile + (require 'cl)) +(require 'org-element) +(require 'org-export) +(require 'org-e-latex) (require 'format-spec) -(declare-function org-element-property "org-element" (property element)) -(declare-function org-element-map "org-element" - (data types fun &optional info first-match)) - -(declare-function org-export-output-file-name "org-export" - (extension &optional subtreep pub-dir)) -(declare-function - org-export-to-file "org-export" - (backend file &optional subtreep visible-only body-only ext-plist)) -(declare-function org-export-get-parent-headline "org-export" (blob info)) -(declare-function org-export-get-environment "org-export" - (&optional backend subtreep ext-plist)) -(declare-function org-export-get-inbuffer-options "org-export" - (&optional backend files)) - - ;;; Variables (defvar org-e-publish-initial-buffer nil diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index b9294e5..31c2729 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -100,7 +100,9 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(eval-when-compile + (require 'cl) + (require 'org)) (require 'org-element) @@ -3937,7 +3939,6 @@ (defun org-export-get-next-element (blob info) (let ((parent (org-export-get-parent blob info))) (cadr (member blob (org-element-contents parent))))) - ;;; The Dispatcher ;; @@ -3998,7 +3999,6 @@ (defun org-export-dispatch () (?l (require 'org-e-latex) (org-e-latex-export-to-latex - (require 'org-e-latex) (memq 'subtree optns) (memq 'visible optns) (memq 'body optns))) (?p (require 'org-e-latex) @@ -4018,7 +4018,7 @@ (defun org-export-dispatch () (memq 'subtree optns) (memq 'visible optns) (memq 'body optns)))) ;; set major mode (with-current-buffer outbuf - (if (featurep 'nxhtml-mode) (nxhtml-mode) (nxml-mode))) + (if (featurep 'nxhtml-mode) (org-no-warnings (nxhtml-mode)) (nxml-mode))) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) (?h @@ -4151,6 +4151,11 @@ (defun org-export-dispatch-ui (options expertp) (get-buffer-window "*Org Export/Publishing Help*")) (funcall handle-keypress standard-prompt))))) - + (provide 'org-export) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; coding: utf-8 +;; End: ;;; org-export.el ends here -- 1.7.9.2 --=-=-= Content-Type: text/plain The way org-export is structured unfortunately produces circular dependencies due to the dispatcher and that prevents it from being compiled properly. I'd think that it should be possible to move most things except the dispatcher into a new file (org-e-common or so?) and have the other export backends depend on that instead of org-export. One of test fails (but independently of compiling or not compiling the rest of the new exporter). The failing test is test-org-element/src-block-interpreter, it appears that the test expects the block to be indented by two spaces, but it starts at the beginning of line for me. Maybe some configuration is missing, but in any case that should be provided by the test. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Factory and User Sound Singles for Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#WaldorfSounds --=-=-=--