Red Hat Bugzilla – Bug 75763
Postscript print buffer in emacs prints using screen colors
Last modified: 2015-01-07 19:01:04 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830
Description of problem:
Printing a buffer (c source for example) using postscript print buffer in emacs
prints using screen colors instead of using dark colors over light background as
it did in emacs 20.x. Because I use a dark background (blue) white text cannot
be seen on paper, forcing me to change the background to white so emacs uses
dark colors for text, just to be able to pretty print.
Steps to Reproduce:
1.Choose a dark color for emacs' background (eg. black)
2.Postscript print buffer
Actual Results: The printed text, since it is white on screen can't be seen on
Expected Results: It should have printed the white text as black as it did in
Sorry, I don't seem able to reproduce this.
M-x set-background-color blue RET
M-x set-forground-color white RET
C-u Menu File <ps-print-buffer-faces> test.ps RET
% gv test.ps
shows white background in the postscript file.
Can you tell me exactly how to reproduce this? Thanks.
I have the colors set from Xresources but I guess it's the same.
M-x set-background-color blue RET
M-x set-foreground-color white RET
M-x ps-print-buffer-with-faces RET
The background in the resulting printed output (don't know how to redirect it to
a file in emacs) is white (which is correct) but the text is of the exact same
colors as on screen... red is printed as red, green is printed as green and
white (normal text) is printed as white... In emacs 20 it used to print using
the same face colors that are used on screen when the background is set to white
which I think is the right thing as printers can't usually print white text...
Ok, thanks, I can reproduce it now.
[Print to a file is with C-u prefix, like in my 3rd command line above.]
The ps-print.el author commented:
Well, this is not a bug, since version 6.5.7 that ps-print get the default
foreground and background color of Emacs session and use them as default to
generate a PostScript.
If this is not what you want, you can:
1. Or, start Emacs with other foreground/background color;
(this was mentioned in bugzilla report by Carlos)
2. Or, set ps-default-bg and ps-default-fg variables to a suitable color, like:
(setq ps-default-bg "white") ; default background
(setq ps-default-fg "black") ; default foreground
3. Or, set ps-default-bg and ps-default-fg variables to nil to have default
(setq ps-default-bg nil) ; use default background
(setq ps-default-fg nil) ; use default foreground
Ideally, options 3 and 4 should be inserted in ~/.emacs file.
Ok, here are the results after playing with options 2 and 3:
With option 3 I still get white text (invisible) on paper when printing C code
as well as a plain text buffer. It appears to ignore the foreground color but if
I change the background color to something like blue it prints blue background
(with the white text showing).
With option 3 I still can't print C code (the same white text...) but plain text
prints in black foreground like it is supposed to.
Reproduced in python-mode too for example.
XEmacs ps-print seems to be fine though.
The problem still seems to be present in 6.5.9, Vinicius, afaict.
% emacs -q
M-x set-foreground-color RET white RET
M-x set-background-color RET black RET
M-x global-font-lock-mode RET
C-x C-f /usr/include/stdio.h
C-u M-x ps-print-buffer-with-faces RET ~/tmp/psprint.ps RET y
% gv ~/tmp/psprint.ps
and observe that the default font with white foreground is rendered
white on white in the ps file.
(setq ps-default-fg "black"
doesn't seem to help.
Is this any better with 21.3?
No. 21.3 on Fedora Core 1 behaves exactly the same way. It uses
exactly the same colors to print as it does on screen (except for the
AFAICT this is fixed in cvs emacs. :)
Err, sorry no change: reporting this on emacs-devel.