From: Roberto Bourgonjen
Subject: Executing ps_print.el from outside Xemacs (perl?)
Date: 
Message-ID: <378DC52B.91C62ED5@netlinq.nl>
Hi all,

I would like to convert a bunch of perlscripts into emacs' pretty-print
postscript files.
I know how to do this interactively from wiithin the xemacs application.

But what I want is to write a perl  or shell script to batch-process a
pile of files.
Is there any way I can execute the ps_print.elc from outside the xemacs
application?
I'd be happy to dig in to this, but would appreciate some clues on where
to start.

--
Roberto Bourgonjen
From: Tim Bradshaw
Subject: Re: Executing ps_print.el from outside Xemacs (perl?)
Date: 
Message-ID: <nkj673mjdbn.fsf@tfeb.org>
Roberto Bourgonjen <·······@netlinq.nl> writes:

> Hi all,
> 
> I would like to convert a bunch of perlscripts into emacs' pretty-print
> postscript files.
> I know how to do this interactively from wiithin the xemacs application.
> 
> But what I want is to write a perl  or shell script to batch-process a
> pile of files.
> Is there any way I can execute the ps_print.elc from outside the xemacs
> application?
> I'd be happy to dig in to this, but would appreciate some clues on where
> to start.

This is pretty off-topic for comp.lang.lisp, one of the emacs
newsgroups would be better.

But, you need to write a small function which takes a file name as
argument, reads it into a buffer and then calls ps-print-buffer with
suitable arguments and perhaps deletes the buffer when done.

Something like this (although this is buggy and I haven't tried it so
it may be even buggier):

    (defun ps-print-file (f ps)
      (let ((ef (expand-file-name f)))
	(if (not (file-readable-p ef))
	    (error "%s not readable" ef))
	;; this is buggy because I can't remember how to find if there is already
	;; buffer visiting this file.
	(let ((b (find-file-noselect f)))
	  (save-excursion
	    (set-buffer b)
	    (ps-print-buffer ps))
	  (kill-buffer b))))

Then you can either call emacs with -batch and some other argument to
call this function, or better you can run gnuserv and then use
gnuclient to call this function with your filename.

--tim