[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it possible to set different background for different modes?
From: |
Michael Cadilhac |
Subject: |
Re: Is it possible to set different background for different modes? |
Date: |
Thu, 13 Oct 2005 16:49:16 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
i.c.code@gmail.com writes:
> Hi,
>
> I want to set different background for different modes at same time.
> For example, I open two window, one for perl and another for c, but I
> want them have different background colors. Is it possible?
>
> Thanks.
To complete Slawomir's answer, you could use an alist and the
after-change-major-mode-hook hook.
(defvar back-colors
'((c-mode . "red") (emacs-lisp-mode . "blue"))
"Alist for background colors regarding major mode.")
(defvar default-back-color "black")
(defun change-back-color-according-to-major-mode ()
(interactive)
(let ((color-elt (assq major-mode back-colors)))
(set-background-color
(if color-elt
(cdr color-elt)
default-back-color))))
(add-hook 'after-change-major-mode-hook
'change-back-color-according-to-major-mode)
--
Michael Cadilhac, a.k.a. Micha [mika] |
Epita/LRDE promo 2007 | Please note that you should
2 rue de la Convention | 08.70.65.13.14 | s/-@t-/@/ my mail address.
94270 Le Kremlin Bicetre | 06.23.20.31.30 |