From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitri Makarov Subject: Re: htmlize doesn't work in --batch mode Date: Wed, 19 Sep 2012 20:40:56 +0200 Message-ID: References: <3F22EBFC-FB52-42B1-B717-482FBD010B5B@gmail.com> <87zk4mgd1i.fsf@bzg.ath.cx> Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEPCo-0005T9-UX for emacs-orgmode@gnu.org; Wed, 19 Sep 2012 14:41:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEPCn-0007So-EO for emacs-orgmode@gnu.org; Wed, 19 Sep 2012 14:41:02 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:41071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEPCn-0007SN-4l for emacs-orgmode@gnu.org; Wed, 19 Sep 2012 14:41:01 -0400 Received: by wgbdt14 with SMTP id dt14so788578wgb.30 for ; Wed, 19 Sep 2012 11:41:00 -0700 (PDT) In-Reply-To: <87zk4mgd1i.fsf@bzg.ath.cx> 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" Hi Bastien I actually wrote an ant script that controls the off-line publishing. It's fairly simple, assuming ELPA packages installed in ~/.emacs.d/elpa Another important thing to note is that font-lock-mode is not enabled by = default in --batch mode. So I ended up writing an extra .el file that is loaded specifically for off-line publishing. I'll paste here the relevant fragments to share in case somebody wants = to do something similar Here are fragments of org.el loaded by emacs --batch command: (defun common-hook-actions () "Peform actions common for all programming language modes" (font-lock-mode 1) ;; a series of set-face-attribute commands to define the ;; fontification for SRC blocks (set-face-attribute 'font-lock-builtin-face nil :slant 'normal :weight 'normal :underline nil :foreground "#FFFFFF") ;; more of the same ) (add-hook 'c-mode-hook (lambda () (common-hook-actions))) ;; more mode-hooks can be added (setq org-publish-timestamp-directory "../.org-timestamps/") ;; at this point I have (setq org-publish-project-alist ;; for the projects we need to publish And this is a fragment of my build.xml: All of the above creates completely autonomous publishing project. We = actually use it collaboratively, so other people can checkout the repository, = edit org files, build html (or pdf) from the org project and publish updated = content on the web-server without having to modify their ~/.emacs (or = ~/.emacs.d/init.el) files. Everything is done with two simple shell commands invoking ant. I hope somebody will find this useful. Regards, Dmitri On Sep 19, 2012, at 7:03 PM, Bastien wrote: > Hi Dmitri, >=20 > Dmitri Makarov writes: >=20 >> If anyone interested, it's easy to explicitly load the required ELPA >> packages in batch mode. For example, the following command loads = htmlize >> for publishing org files in batch mode >>=20 >> emacs --batch -l ~/.emacs.d/init.el --eval "(progn (add-to-list = 'load-path >> \"~/.emacs.d/elpa/htmlize-20120616.1716\") (require 'htmlize))" -f >> org-publish-all >>=20 >> It should be easy to include such a command in a makefile or = build.xml and >> automatically locate the latest installation of necessary packages = rather >> than explicitly specifying the path. >=20 > I let Achim be the final judge on this -- my intuitions in this areas > are just too fragile. But my gut feeling is that this would be too > complicated, and the solution above is simple enough. >=20 >> Still I wonder why ELPA packages are not loaded by default in --batch >> mode even though (package-initialize) is being evaluated. >=20 > Please ask this on the emacs-devel mailing list, I'm sure this will = help > many other users. Several users (including me) have been puzzled by = the > way ELPA packages are loaded/initialized in Emacs. >=20 > Best, >=20 > --=20 > Bastien