[Aquamacs-devel] changing the mode-line background color on the fly?

30 views
Skip to first unread message

Filippo A. Salustri

unread,
Jul 12, 2012, 10:53:19 AM7/12/12
to Aquamacs Developers
Hi all,
I'd really like to be able to change the background color of the
mode-line on the fly.
So, I'd like it to be one color if the buffer is read-only,
another if the buffer is modified,
and a third color otherwise.

I've been playing with mode-line-format.  I had it pretty much working
with the following fragment
(:eval
    (cond (buffer-read-only
              (fas-set-modeline-readonly))
             ((buffer-modified-p)
              (fas-set-modeline-modified))
             (t (fas-set-modeline-default))))

Here's one of the "fas-*" functions:

(defun fas-set-modeline-readonly ()
  (set-face-background 'mode-line "blue")
  (set-face-foreground 'mode-line "white")
  "  ")

where the final blank string is what's expected for each condition in
the mode-line-format clause above.

As I said, it works, but it seems to build up quite a load on my
laptop.  I didn't check the actual memory usage, but aquamacs seem to
slow down to a crawl within 30 min of starting it.  If I quit and
restart, it's fine again, but starts slowing down.

I'm running aquamacs 2.4.

Can anyone advise me on how I can do this without running my MBP into
the ground?

Much obliged.
Fil Salustri

--
\V/_
Filippo A. Salustri, Ph.D., P.Eng.
Mechanical and Industrial Engineering
Ryerson University
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-5000 ext 7749
Fax: 416/979-5265
Email: salu...@ryerson.ca
http://deseng.ryerson.ca/~fil/

Reply all
Reply to author
Forward
0 new messages