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
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
then I made the file executable
Then I told emacs to use this script as its custom print engine for postscript output. I edited my emacs resource file at
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.
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/ps_print_file.sh
with the following text in it:
#!/bin/sh
ps2pdf $1 - | lpr
then I made the file executable
chmod +x /Users/matt/bin/ps_print_file.sh
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/ps_print_file.sh")
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.
•
[4,340 views]

