help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: htmlize from shell


From: nick
Subject: Re: htmlize from shell
Date: Wed, 23 Jun 2004 18:53:05 GMT
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Michael Slass <address@hidden> writes:

> Lowell Kirsh <address@hidden> 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 ... "<html>\n 
 <head>\n" "    <title>" ... "</title>\n" ... htmlize-head-tags) 
(htmlize-method insert-head buffer-faces face-map) (insert "  </head>" "\n  " 
... "\n    <pre>\n")) (let (... next-change text face-list fstruct-list) 
(goto-char ...) (while ... ... ... ... ... ... ... ...)) (with-current-buffer 
htmlbuf (insert "</pre>\n  </body>\n</html>\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(#<buffer  *load*> 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]