[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C-x TAB indent-rigidly default set to 4 columns, not to 1
From: |
Dale Worley |
Subject: |
Re: C-x TAB indent-rigidly default set to 4 columns, not to 1 |
Date: |
Mon, 17 May 2004 14:59:25 GMT |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
nospam55 <nospa@no.yahoo.no> writes:
> seems to be behave like indent-rigidly ; the
>
> (defun irFrequent (a b c) (interactive "P\nr")
> (if (not a) (setq a 4) )
> (indent-rigidly b c a)
> )
>
> seems to be almost the solution: it almost works as I hoped , the problem is
> that If I specify prefix arg 4 with C-u it fails, error message :
>
> irFrequent: Wrong type argument: number-or-marker-p, (4)
>
> what is wrong?
The third argument to indent-rigidly must be a number.
You want something like this:
(defun irFrequent (start end arg)
(interactive "r\nP")
(indent-rigidly start end
(if arg (prefix-numeric-value arg) 4)))
It obtains the prefix argument in "raw" form. If a prefix argument
was given by the user, arg will be non-null, and so you process it
into its numeric value and call prefix-numeric-value. Otherwise, you
use the default 4.
I haven't checked that the value of arg when no prefix is specified is
really nil. You can do this by writing a test function saving it in a
variable. Or you can look at the C code that implements
'call-interactively', which IIRC explains exactly all the possible
values of the raw prefix argument.
Dale