unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: bojohan+news@dd.chalmers.se (Johan Bockgård)
Subject: Re: htmlize from shell
Date: Wed, 23 Jun 2004 22:26:02 +0200	[thread overview]
Message-ID: <yoijisdirpgl.fsf@tulkas.dd.chalmers.se> (raw)
In-Reply-To: sgjisdi9m4z.fsf@nowhere.non

nick <nobody@nowhere.non> writes:

> 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: [...]

You can use something like this:

-------- my-htmlize.el ----------------------------------
;; USAGE:
;;     emacs -batch -l my-htmlize.el <file> 

;; Note: Writes to stdout

;; Explicitly set the faces. Example:
(custom-set-faces 
 '(default                      ((t (:foreground "#ffffff" :background "black"))))
 '(font-lock-builtin-face       ((t (:foreground "#ff0000"))))
 '(font-lock-comment-face       ((t (:bold t :foreground "#333300"))))
 '(font-lock-constant-face      ((t (:foreground "magenta"))))
 '(font-lock-function-name-face ((t (:bold t :foreground "Blue"))))
 '(font-lock-keyword-face       ((t (:foreground "yellow3"))))
 '(font-lock-string-face        ((t (:foreground "light blue"))))
 '(font-lock-type-face          ((t (:foreground "green"))))
 '(font-lock-variable-name-face ((t (:foreground "cyan" :bold t))))
 '(font-lock-warning-face       ((t (:foreground "red" :weight bold)))))

(setq htmlize-use-rgb-map 'force)
(require 'htmlize)

(find-file (pop command-line-args-left))
(font-lock-fontify-buffer)
(with-current-buffer (htmlize-buffer)
  (princ (buffer-string)))
---------------------------------------------------------

You could easily adapt this to htmlize several files etc.

-- 
Johan Bockgård

      parent reply	other threads:[~2004-06-23 20:26 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
2004-06-23 19:23     ` Michael Slass
2004-06-23 20:26     ` Johan Bockgård [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.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=yoijisdirpgl.fsf@tulkas.dd.chalmers.se \
    --to=bojohan+news@dd.chalmers.se \
    /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).