unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: nick <nobody@nowhere.non>
Subject: Re: htmlize from shell
Date: Wed, 23 Jun 2004 18:53:05 GMT	[thread overview]
Message-ID: <sgjisdi9m4z.fsf@nowhere.non> (raw)
In-Reply-To: m3k6xzi1va.fsf@eric.rossnet.com

Michael Slass <miknrene@drizzle.com> writes:

> Lowell Kirsh <lkirsh@cs.ubc.ca> 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	other threads:[~2004-06-23 18:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-22 21:08 htmlize from shell Lowell Kirsh
2004-06-22 23:01 ` Kevin Rodgers
2004-06-22 23:53   ` Lowell Kirsh
2004-06-22 23:38 ` Glenn Morris
2004-06-22 23:55 ` Michael Slass
2004-06-23 18:53   ` nick [this message]
2004-06-23 19:23     ` Michael Slass
2004-06-23 20:26     ` Johan Bockgård

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=sgjisdi9m4z.fsf@nowhere.non \
    --to=nobody@nowhere.non \
    /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.
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).