emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Tom Prince <tom.prince@ualberta.net>
Cc: nicholas.dokos@hp.com, Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: Failure exporting with emacs --batch
Date: Tue, 15 Nov 2011 22:33:12 -0500	[thread overview]
Message-ID: <13634.1321414392@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Tom Prince <tom.prince@ualberta.net> of "Tue, 15 Nov 2011 19:36:19 EST." <87mxbwaoos.fsf@hermes.hocat.ca>

Tom Prince <tom.prince@ualberta.net> wrote:

> On Tue, 15 Nov 2011 15:30:25 -0500, Nick Dokos <nicholas.dokos@hp.com> wrot=
> e:
> > Tom Prince <tom.prince@ualberta.net> wrote:
> >=20
> > > With b43c1c621f52f4a51d8d79cb76c226dfed003998 running
> > >=20
> >=20
> > Please use C-u M-x org-version to insert version information in your
> > mail. It's not possible to see from the SHA1 whether it is a recent
> > version or an old version without doing git archaelogy.
> 
> org-version doesn't display a sha1 hash, when run from an installed copy
> of a git version.
> 

OK. ``git describe'' in your git tree will do the equivalent.

> Further simplified: (this time with a git clone)
> 
> emacs --no-site-file --no-init-file --load min.el --eval '(setq debug-on-er=
> ror t)' --eval '(find-file "test.org")' --eval '(org-version)' -eval '(org-=
> export-as-html 3)' --batch
> 
> ------ min.el
> (setq org-babel-load-languages '((emacs-lisp . t) (latex . t)))
> (setq org-confirm-babel-evaluate nil)
> (add-to-list 'load-path (expand-file-name "~/src/org-mode/lisp"))
> (add-to-list 'auto-mode-alist '("\\.\\(org\\  |org_archive\\|txt\\)$" . org=
> -mode))
> 
> (require 'org-install)
> ------
> 
> ------ test.org
> * Notes for 2011-09-16
> #+begin_src latex :file diag1.png
>  some latex source
> #+end_src
> ------
> 

Yes, I can reproduce this (Org-mode version 7.7
(release_7.7.563.gf8d8.dirty)).  I goofed before in not enabling latex
as a babel language in my minimal emacs.

The thing is that the usual debugging techniques are useless, because it
only happens with --batch. So the only thing that works is princ :-(

It turns out that there is a bunch of places in org-create-formula-image
(which gets called to convert latex formulas to png) that ask for
properties of the default face: there is no such thing in batch, and
various things blow up - e.g.

    $ emacs -Q --batch --eval '(princ (face-attribute (quote default) :foreground))'
    unspecified$

This bug has existed for ever, but I guess this is the first time
anybody exercised the code path.

In particular, the font height and the fg and bg colors are calculated
this way. I stubbed out these things (line 16898ff in org.el) with more
or less arbitrary values:

	 (fnh (if (featurep 'xemacs)
                  (font-height (get-face-font 'default))
                (face-attribute 'default :height nil)))
	 (fnh (if (numberp fnh) fnh 140.))
and 

;;    (if (eq fg 'default) (setq fg (org-dvipng-color :foreground)))
;;    (if (eq bg 'default) (setq bg (org-dvipng-color :background)))
    (setq fg "rgb 0 1 0")
    (setq bg "rgb 0 0 0")


and the test passes. Of course, this is not a fix, but I'm sure one will
be forthcoming shortly.

There may of course be more such problems in other untested paths.

Thanks for an interesting bug,
Nick

      reply	other threads:[~2011-11-16  3:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15 16:32 Failure exporting with emacs --batch Tom Prince
2011-11-15 20:09 ` Herbert Sitz
2011-11-15 20:18   ` Herbert Sitz
2011-11-15 20:51     ` Nick Dokos
2011-11-15 21:09       ` Herbert Sitz
2011-11-15 21:48         ` Nick Dokos
2011-11-15 20:21 ` Eric Schulte
2011-11-15 20:30 ` Nick Dokos
2011-11-16  0:36   ` Tom Prince
2011-11-16  3:33     ` Nick Dokos [this message]

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=13634.1321414392@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tom.prince@ualberta.net \
    /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).