Wednesday, October 28, 2009

Fixing Color Printing in Aquamacs Emacs 1.9


30/11/2010 edit: This post is superseded by this one on the same subject. The new post provides a much cleaner solution.

Dark text on bright background -- that hurt's my eyes after a while. So I prefer to reverse this setting. Luckily, with Aquamacs that's no big deal, just a simple M-x custumize-face RET default RET and you can easily change the basis of all modes.

So far so good. But recently I tried to print a text buffer containing the log of a meeting. For some reason the print preview showed me white text with some color highlights on white background. Not helpful. This seems to be due to some glitch in the mac-print package, as far as I can tell (since the option to always print on white background was not set).

The remedy is simple. Just switch to black text on white background before you print, and switch back to your original settings afterwards. For this to happen automatically, add something along the following lines to your .emacs file:

(add-hook 'htmlize-before-hook
        (lambda ()
          (set-face-foreground 'default "black")
          (set-face-background 'default "ivory")
          ))
(add-hook 'htmlize-after-hook
        (lambda ()
          (set-face-foreground 'default "ivory")
          (set-face-background 'default "black")
          ))


Björn Rüffer, Copyright 20092011
Disclaimer: The author of this page cannot accept any responsibility for content of pages that this page provides hyperlinks to. Also the author cannot accept responsibility or liability for any damage caused by following or not following instructions given on this page. This page, its contents and style, are the responsibility of the author and do not represent the views, policies or opinions of any other party. The author will not be held responsible for comments posted by third parties on this site. Inappropriate comments will be removed. There is no warranty for any program or source code provided here, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the program “as is” without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with you. Should the program prove defective, you assume the cost of all necessary servicing, repair or correction.