help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: defun in global-set-key


From: Pascal Bourguignon
Subject: Re: defun in global-set-key
Date: 14 Nov 2004 16:47:32 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Rodrigo Canellas <r.canellas@terra.com.br> writes:

> hi,
> 
> 
> I defined this in '.emacs' this function:
> 
> (defun indent-all (interactive) ()
>   (mark-whole-buffer)
>   (indent-region)
>   )
> 
> and associated to a key:
> 
> (global-set-key [f2] 'indent-all)
> 
> 
> But when I load a file and press F2, the whole buffer is selected, but the 
> 'indent-region' fails, and a long and uncompreensible message is displayed in 
> the mini-buffer. 
> 
> Does anyone know what am I doing wrong?

interactive is a declaration. That must be written after the arguments
and documentation string:

(defun indent-all ()
    "Will idnent the whole buffer."
    (interactive)
    (mark-whole-buffer)
    (indent-region))

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.


reply via email to

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