[plug] writing an emacs lisp function.

Russell Steicke r.steicke at bom.gov.au
Thu Jan 15 18:01:44 WST 2004


On Thu, Jan 15, 2004 at 04:23:41PM +0800, David Buddrige wrote:
> Hi all, 
> 
> I like to have a black background with green text when I am working in 
> emacs. 
> 
> To this end, I have placed the following code in my .emacs: 
> 
> (defun setcolour (nil)
> "This sets the colors up"
> '(set-foreground-color green)
> '(set-background-color black)
> )
> (global-set-key (quote [f11]) (quote setcolour)) 

- commandp checks to see if the function "makes provisions for
  interactive calling".  To do that you need to call (interactive) first
  in the function.  
- An empty argument list is (), not (nil).  
- Don't quote your function calls.
- The colour names should be strings.

Try this:

(defun setcolour ()
  (interactive)
  "This sets the colors up"
  (set-foreground-color "green")
  (set-background-color "black"))
(global-set-key (quote [f11]) (quote setcolour))




-- 
Russell Steicke

-- Fortune says:
consultant, n.:
	Someone who knowns 101 ways to make love, but can't get a date.



More information about the plug mailing list