Setting Background Face Per Buffer, working

Setting Background Face Per Buffer, working

Post by Nigel Warn » Sat, 06 Aug 2005 10:05:39


After a bit more experimentation the following now seems to work
for me. The trick seems to be that while changing colours within
a mode hook works changing the background image for a buffer only
seems to work if you change both the foreground and background colours
before you change the background image. The reason that I use an image
is to select my colour lightly textured in the Gimp.

Anyway, here is what I do in my init file:
; default at start of file
(set-face-foreground 'default "black") ; normal text
(set-face-background 'default "lightgoldenrod")
(set-face-background-pixmap 'default
[jpeg :file "~/.xemacs/bodyBack.jpg"])

; mode hook for python later in file
(defun python-decor ()
(set-face-foreground 'default "black" (current-buffer) nil 'prepend)
(set-face-background 'default "peru" (current-buffer) nil 'prepend)
(set-face-background-pixmap 'default
[jpeg :file "~/.xemacs/testBack.jpg"]
current-buffer) nil 'prepend))


(add-hook 'python-mode-hook 'python-decor)

Yay, it works

Regards
Nigel.