From: Deepak Goel
Subject: elisp color-coding..
Date: 
Message-ID: <Pine.GSO.4.10.9910060111330.19242-100000@fosters.umd.edu>
(am a novice who's recently discovered the joys of elisp (i work on a sun
solaris platform), and has immensely enjoyed configuring his emacs such
that whenever i log in, a random screen-background-image and a randon
emacs-background-color shows up.. and am trying to avoid learning shell
(beyond some basics) because almost anything can be done via emacs, right?
or is that a bad approach and any decent unix-er *has* to learn some
shell?)

anyways, was wondering: is there a way that emacs looks at my lisp file,
and shows me function-names in a different color, constants in a different
color, and so on... (i recall, borland C++ used to do this..) .. which
would make editing even more of a joy.. and more colorful...


also, i have defined this function change-color which changes emacs's
background color to a random one from a list of those I like. I was
wondering how one can get emacs to display different windows in different
colors.. currently, whenever i invoke change-color, it changes color of
the entire emacs-screen.

i know these things should be possible because M-x list-display-colors
displys so many colors all on one screen...



--Deepak

From: H. Tunc Simsek
Subject: Re: elisp color-coding..
Date: 
Message-ID: <37FAE413.EC08FD61@EECS.Berkeley.Edu>
M-x font-lock-mode

Deepak Goel wrote:
> 
> (am a novice who's recently discovered the joys of elisp (i work on a sun
> solaris platform), and has immensely enjoyed configuring his emacs such
> that whenever i log in, a random screen-background-image and a randon
> emacs-background-color shows up.. and am trying to avoid learning shell
> (beyond some basics) because almost anything can be done via emacs, right?
> or is that a bad approach and any decent unix-er *has* to learn some
> shell?)
> 
> anyways, was wondering: is there a way that emacs looks at my lisp file,
> and shows me function-names in a different color, constants in a different
> color, and so on... (i recall, borland C++ used to do this..) .. which
> would make editing even more of a joy.. and more colorful...
> 
> also, i have defined this function change-color which changes emacs's
> background color to a random one from a list of those I like. I was
> wondering how one can get emacs to display different windows in different
> colors.. currently, whenever i invoke change-color, it changes color of
> the entire emacs-screen.
> 
> i know these things should be possible because M-x list-display-colors
> displys so many colors all on one screen...
> 
> --Deepak
From: Pierre R. Mai
Subject: Re: elisp color-coding..
Date: 
Message-ID: <87vh8k247r.fsf@orion.dent.isdn.cs.tu-berlin.de>
Deepak Goel <·····@Glue.umd.edu> writes:

> also, i have defined this function change-color which changes emacs's
> background color to a random one from a list of those I like. I was
> wondering how one can get emacs to display different windows in different
> colors.. currently, whenever i invoke change-color, it changes color of
> the entire emacs-screen.

I think you mean different "frames" (frames are what X would call
top-level windows): Both XEmacs and Emacs have the ability to set face
properties (like the background) to different values depending on some
"locale" (in XEmacs that means buffers, frames, and other things,
whereas in Emacs20 it's restricted to frames, IIRC), so you can do
things like

(set-face-background 'default "lightseagreen" (selected-frame))

to set the background color of the default face for the selected
frame.  In XEmacs this can be enough to set the background, in Emacs20 
you will probably want to do (set-background-color "lightseagreen")
instead (this will automatically only set the color of the selected
frame).

In XEmacs putting something like this into your init-file will 
do what you want (though I still doubt you would really want to, in
the long run ;):

(defvar *random-colors* '("lightseagreen" "lightgreen" "lightblue"
                          "orange"))

(defun get-random-color ()
  (nth (random (length *random-colors*)) *random-colors*))

(defun set-random-frame-background (frame)
  (set-face-background 'default (get-random-color) frame))
 
(add-hook 'create-frame-hook
          'set-random-frame-background
          t)

Or to do it with buffers:

(defun set-random-buffer-background ()
  (set-face-background 'default (get-random-color) (current-buffer)))

(add-hook 'find-file-hooks
          'set-random-buffer-background
          t)

Regs, Pierre.

-- 
Pierre Mai <····@acm.org>         PGP and GPG keys at your nearest Keyserver
  "One smaller motivation which, in part, stems from altruism is Microsoft-
   bashing." [Microsoft memo, see http://www.opensource.org/halloween1.html]