Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Print colorized fonts from emacs UNIX
As a longtime unix user and big fan of emacs font-lock (i.e. colorized, context sensitive source code) I missed being able to print out colorized text from emacs. In unix emacs you normally go

M-x ps-print-buffer-with-faces

to get a nice page of colorized text. Unfortunately this didn't seem to work for me off the bat. (Does darwin's lpr only understand pdf only, or is it a printer-dependent thing?) Fortunately, I have "fink" installed, which includes a "ps2pdf" command which makes life easy.

I created a file /Users/matt/bin/ with the following text in it:

ps2pdf $1 - | lpr

then I made the file executable

chmod +x /Users/matt/bin/

Then I told emacs to use this script as its custom print engine for postscript output. I edited my emacs resource file at /Users/matt/.emacs and added the line

(setq ps-lpr-command "/Users/matt/bin/")

Quit and restart emacs. You should be able to print with colorized source code now.

ps - I think it is possible to avoid using an external script command to translate the postscript, and would appreciate if anyone knows exactly how to do this. In case you are wondering, the ps2pdf command simply calls ghostscript, which is a postscript interpreter, which re-renders postscript as pdf for output. It should be possible to specify "-sOutputFile=|lpr" as one of the ps-lpr-switches but I haven't gotten that to work yet.
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)

Print colorized fonts from emacs | 2 comments | Create New Account
Click here to return to the 'Print colorized fonts from emacs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Print colorized fonts from emacs
Authored by: mnoel on Mar 06, '03 01:53:55AM

I tried to get ps2pdf from Fink but there is no such package. I tried psutils but it does not contain ps2pdf.

Where is that package?

[ Reply to This | # ]
Print colorized fonts from emacs
Authored by: carsten on Mar 06, '03 07:17:49AM

ps2pdf is part of the package "ghostscript-nox" (or just install "ghostscript" instead if you use X11).

[ Reply to This | # ]