From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: nick Newsgroups: gmane.emacs.help Subject: Re: htmlize from shell Date: Wed, 23 Jun 2004 18:53:05 GMT Organization: nowhere, inc. Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1088538044 25218 80.91.224.253 (29 Jun 2004 19:40:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 29 Jun 2004 19:40:44 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 29 21:40:15 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BfOSk-00080n-00 for ; Tue, 29 Jun 2004 21:40:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BfOUQ-0001lu-Ix for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Jun 2004 15:41:58 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.isc.org!sjc1.usenetserver.com!news.usenetserver.com!border1.nntp.sjc.giganews.com!border2.nntp.sjc.giganews.com!nntp.giganews.com!cyclone-sf.pbi.net!216.218.192.242!news.he.net!dimensional.com!pulsar.dimensional.com!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!news.cpqcorp.net!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:MuCNU1bNwbSunnRRs3pSI1ZR2hk= Original-Lines: 112 Original-NNTP-Posting-Host: 16.141.40.203 Original-X-Complaints-To: abuse@HP.com Original-X-Trace: news.cpqcorp.net 1088016785 16.141.40.203 (Wed, 23 Jun 2004 11:53:05 PDT) Original-NNTP-Posting-Date: Wed, 23 Jun 2004 11:53:05 PDT Original-Xref: shelby.stanford.edu gnu.emacs.help:123912 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19274 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19274 Michael Slass writes: > Lowell Kirsh writes: > >>I would like to convert several files to html using the htmlize >>package. How can I do this from my shell rather than from withing >>emacs? (I want to script it) >> > ... > emacs --eval=' > (progn > (load-library "htmlize") > (htmlize-many-files > '("/path/to/some/file" "path/to/some/otherfile"))) > ' --kill > > This will do more than one. ... except for the quotes. Either use (list "/path/to/some/file" "/path/to/some/otherfile" ...) or (quote ("/path/to/some/file" "/path/to/some/otherfile" ...)) in place of '("/path/to/some/file" "path/to/some/otherfile" ...) A feature of the htmlize-file or htmlize-many-file function is that it writes the html file in the same directory as the original. You might want to use the optional third argument of htmlize-many-files to put the results in a single directory. You also get the annoying pop-up and pop-down of an emacs window, but, as Glenn Morris mentioned, --batch does not seem to work (even if you load and enable font-lock-mode). I get: emacs -q --no-site-file --batch \ --eval='(progn (load-library "font-lock") (load-library "htmlize") (htmlize-many-files (list "/home/nick/tmp/297.txt" )))' Loading font-lock... Loading htmlize (source)... Fontifying *temp*... Fontifying *temp*... (syntactically...) Wrong type argument: stringp, unspecified Using --load instead, I tried emacs -q --no-site-file --batch --load htmlit.el with htmlit.el containing the following: (setq debug-on-error t) (load-library "font-lock") (load-library "htmlize") (font-lock-mode t) (htmlize-many-files (list "/home/nick/tmp/297.txt" )) I get the following backtrace: Loading font-lock... Loading htmlize (source)... Fontifying *temp*... Fontifying *temp*... (syntactically...) ... htmlize-face-to-fstruct(default) (if (symbolp face) (htmlize-face-to-fstruct face) (htmlize-attrlist-to-fstruct face)) (let ((fstruct ...)) (setf (gethash face face-map) fstruct) (let* (... ... ...) (while ... ...) (unless ... ...) (push new-name css-names))) (if (gethash face face-map) nil (let (...) (setf ... fstruct) (let* ... ... ... ...))) (unless (gethash face face-map) (let (...) (setf ... fstruct) (let* ... ... ... ...))) (while --dolist-temp--98809 (setq face (car --dolist-temp--98809)) (unless (gethash face face-map) (let ... ... ...)) (setq --dolist-temp--98809 (cdr --dolist-temp--98809))) (let ((--dolist-temp--98809 faces) face) (while --dolist-temp--98809 (setq face ...) (unless ... ...) (setq --dolist-temp--98809 ...)) nil) (catch (quote --cl-block-nil--) (let (... face) (while --dolist-temp--98809 ... ... ...) nil)) (cl-block-wrapper (catch (quote --cl-block-nil--) (let ... ... nil))) (block nil (let (... face) (while --dolist-temp--98809 ... ... ...) nil)) (dolist (face faces) (unless (gethash face face-map) (let ... ... ...))) (let ((face-map ...) css-names) (dolist (face faces) (unless ... ...)) face-map) htmlize-make-face-map((default)) (let* ((buffer-faces ...) (face-map ...) (htmlbuf ...) (title ...)) (with-current-buffer htmlbuf (buffer-disable-undo) (insert ... 10 ... "\n \n" " " ... "\n" ... htmlize-head-tags) (htmlize-method insert-head buffer-faces face-map) (insert " " "\n " ... "\n
\n")) (let (... next-change text face-list fstruct-list) (goto-char ...) (while ... ... ... ... ... ... ... ...)) (with-current-buffer htmlbuf (insert "
\n \n\n") (when htmlize-generate-hyperlinks ...) (goto-char ...) (when htmlize-html-major-mode ...) (run-hooks ...) (buffer-enable-undo)) htmlbuf) (save-excursion (save-excursion (run-hooks ...)) (htmlize-ensure-fontified) (clrhash htmlize-extended-character-cache) (let* (... ... ... ...) (with-current-buffer htmlbuf ... ... ... ...) (let ... ... ...) (with-current-buffer htmlbuf ... ... ... ... ... ...) htmlbuf)) htmlize-buffer-1() (set-buffer (htmlize-buffer-1)) (save-current-buffer (set-buffer (htmlize-buffer-1)) (unwind-protect (progn ... ...) (kill-buffer ...))) (with-current-buffer (htmlize-buffer-1) (unwind-protect (progn ... ...) (kill-buffer ...))) (let ((buffer-file-name file)) (normal-mode) (font-lock-mode 1) (unless font-lock-mode (font-lock-fontify-buffer)) (with-current-buffer (htmlize-buffer-1) (unwind-protect ... ...))) (save-current-buffer (set-buffer temp-buffer) (insert-file-contents file) (let (...) (normal-mode) (font-lock-mode 1) (unless font-lock-mode ...) (with-current-buffer ... ...))) (with-current-buffer temp-buffer (insert-file-contents file) (let (...) (normal-mode) (font-lock-mode 1) (unless font-lock-mode ...) (with-current-buffer ... ...))) (unwind-protect (with-current-buffer temp-buffer (insert-file-contents file) (let ... ... ... ... ...)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))) (let ((temp-buffer ...)) (unwind-protect (with-current-buffer temp-buffer ... ...) (and ... ...))) (with-temp-buffer (insert-file-contents file) (let (...) (normal-mode) (font-lock-mode 1) (unless font-lock-mode ...) (with-current-buffer ... ...))) (let ((output-file ...) (font-lock-mode nil) (font-lock-auto-fontify nil) (global-font-lock-mode nil) (font-lock-maximum-size nil) (font-lock-support-mode nil)) (with-temp-buffer (insert-file-contents file) (let ... ... ... ... ...))) htmlize-file("/home/nick/tmp/297.txt" nil) (while --dolist-temp--98807 (setq file (car --dolist-temp--98807)) (htmlize-file file target-directory) (setq --dolist-temp--98807 (cdr --dolist-temp--98807))) (let ((--dolist-temp--98807 files) file) (while --dolist-temp--98807 (setq file ...) (htmlize-file file target-directory) (setq --dolist-temp--98807 ...)) nil) (catch (quote --cl-block-nil--) (let (... file) (while --dolist-temp--98807 ... ... ...) nil)) (cl-block-wrapper (catch (quote --cl-block-nil--) (let ... ... nil))) (block nil (let (... file) (while --dolist-temp--98807 ... ... ...) nil)) (dolist (file files) (htmlize-file file target-directory)) htmlize-many-files(("/home/nick/tmp/297.txt")) eval-buffer(# nil "/home/nick/tmp/htmlit.el" nil t) load-with-code-conversion("/home/nick/tmp/htmlit.el" "/home/nick/tmp/htmlit.el" nil t) load("/home/nick/tmp/htmlit.el" nil t) command-line-1(("--load" "htmlit.el")) command-line() normal-top-level() but I have not chased it any further. -- nick (nicholas dot dokos at hp dot com)