emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: live programming


From: Drew Adams
Subject: RE: live programming
Date: Fri, 26 Jan 2007 07:12:30 -0800

> >> Usually, we modify .emacs files for example to load a new color of
> >> scroll-bar at the start of emacs. But is it possible to change this
> >> color in real time when it is already loaded...
> >
> > I believe you can just `M-x customize-face scroll-bar RET', at least in
> > Emacs 22. Or use `M-x modify-face scroll-bar RET' or call
> > `modify-face' or `set-face-attribute' from Emacs-Lisp code.
>
> Yes , but with M-x , it implies to load it manually.But I want an
> automatic periodically change of colors.

Sorry, I guess I didn't understand what you're asking. Please try again.

You mentioned "real-time", so I thought you wanted to change the color
interactively. Do you want to change it by Emacs-Lisp at runtime? If so, you
can use modify-face or set-face-attribute from Lisp, then save the change
using a custom function.

Check cus-edit.el to see if there is a function to save a changed face. I
don't see a `customize-save-face', however, so perhaps you'll have to write
one, using `customize-save-variable' as inspiration. In some of my code, I
do what I think you want this way:

  ;; change the background
  (if (fboundp 'set-face-attribute) ; Not available in Emacs 20
      (set-face-attribute face nil ':background new-background)
    (modify-face face nil new-background nil nil nil nil))
  ;; save the change
  (put face 'customized-face
            (list (list 't (list ':background new-background)))))
  (put face 'face-modified nil)

FYI - This is in my library doremi-frm.el:
http://www.emacswiki.org/cgi-bin/wiki/doremi-frm.el (code) and
http://www.emacswiki.org/cgi-bin/wiki/DoReMi (doc).

Perhaps someone else has a better suggestion. I'm moving this to the proper
list, help-gnu-emacs; please remove emacs-devel from the cc of any replies.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]