emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: emacs-orgmode@gnu.org
Subject: Re: new exporter (was: Bug: Images in Latex..)
Date: Sat, 02 Jun 2012 19:16:37 +0200	[thread overview]
Message-ID: <87396dzlai.fsf_-_@Rainer.invalid> (raw)
In-Reply-To: 81fwadrgoo.fsf@gmail.com

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

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: add requires to new exporter --]
[-- Type: text/x-patch, Size: 11135 bytes --]

From d7ef1bfbaef873521731697d86112029f02cdc8b Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
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))
-
 
 \f
 ;;; 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)
 
 \f
 ;;; 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))
-
-
 \f
 ;;; 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)))))
 
-
 \f
 ;;; 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)))))
 
-
+\f
 (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


[-- Attachment #3: Type: text/plain, Size: 913 bytes --]


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

  reply	other threads:[~2012-06-02 17:17 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-02 10:46 Bug: Images in Latex [7.8.11 (release_7.8.11-33-g2d71a5 @ /Users/petr/Dropbox/emacs/elisp/org-mode/lisp/)] Petr Samarin
2012-06-02 13:23 ` Jambunathan K
2012-06-02 17:16   ` Achim Gratz [this message]
2012-06-03 13:21     ` new exporter Jambunathan K
2012-06-04 20:23     ` Achim Gratz
2012-06-07 19:44     ` Nicolas Goaziou
2012-06-07 19:59       ` Achim Gratz
2012-06-07 20:24         ` Nicolas Goaziou
2012-06-09 18:48           ` Achim Gratz
2012-06-09 18:56             ` Nicolas Goaziou
2012-06-09 19:06               ` Achim Gratz
2012-06-09 19:45                 ` Nicolas Goaziou
2012-06-09 21:19                   ` Achim Gratz
2012-06-07 20:14       ` Achim Gratz
2012-06-26  5:39         ` Achim Gratz
2012-06-26  6:18           ` Achim Gratz
2012-06-26 14:53             ` Nicolas Goaziou
2012-06-26 16:14               ` Achim Gratz
2012-06-26 18:43               ` Achim Gratz
2012-06-27 20:05                 ` Achim Gratz
2012-06-28  7:03                   ` Nicolas Goaziou
2012-06-29 18:17                     ` Achim Gratz
2012-06-30  6:48                       ` Nicolas Goaziou
2012-06-30  7:12                         ` Achim Gratz
2012-07-01 16:33                         ` Achim Gratz
2012-07-02 10:19                           ` Nicolas Goaziou
2012-07-02 19:06                             ` Achim Gratz
2012-07-12 18:37                         ` Achim Gratz
2012-07-13 14:46                           ` Nicolas Goaziou
2012-07-13 18:32                             ` Achim Gratz
2012-07-14 16:20                               ` Nicolas Goaziou
2012-07-14 16:31                                 ` Achim Gratz
2012-07-14 16:48                                 ` Jambunathan K
2012-07-14 17:47                                   ` Jambunathan K
2012-07-15 12:02                                 ` Achim Gratz
2012-07-15 19:50                                   ` Nicolas Goaziou
2012-07-15 20:08                                     ` Bastien
2012-07-15 20:18                                     ` Achim Gratz
2012-07-16  8:46                                       ` Nicolas Goaziou
2012-07-16 18:11                                         ` Achim Gratz
2012-07-16 21:11                                           ` Nicolas Goaziou
2012-07-17 17:35                                             ` Achim Gratz
2012-07-17 20:59                                               ` Nicolas Goaziou
2012-07-18  9:38                                                 ` Nicolas Goaziou
2012-07-18 18:57                                                   ` Achim Gratz
2012-07-18 18:09                                                 ` Achim Gratz
2012-07-16 18:35                                         ` local.mk vs. default.mk (was: new exporter) Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87396dzlai.fsf_-_@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).