[Top][All Lists]

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

RE: Rationale behind conversion of a nil prefix arg to numeric 1

From: Drew Adams
Subject: RE: Rationale behind conversion of a nil prefix arg to numeric 1
Date: Mon, 5 Sep 2016 16:32:23 -0700 (PDT)

>   > This is really one of the first things that someone writing
>   > a command learns.
> Oops. I must confess this did not happen in my case.

I should not have been so black-&-white in saying that.

I really meant that only in the context of writing commands that
use a prefix arg, and in particular, commands where not explicitly
providing a prefix arg has a different behavior from providing a
prefix arg of 1.

IOW, it only matters if you in fact care about whether the user
provided a prefix arg.  If you are writing a command where the
prefix arg is used only as the number of times to repeat the
behavior then you will likely not be aware of, or see the point
of, a raw prefix argument.

> I have written
> commands in Elisp for about 15 years, and I although I was soon
> familiar with there somehow being a "raw" prefix arg (meaning I often
> read this term in passing), I nevertheless always thought C-u was
> simply a way of passing a command a number. (I did not even know that
> you can also pass prefix commands typing M-..)

I'm sure your experience is not unusual.  See above: if you never
write a command that cares whether the user provided a prefix arg
then you are not so likely to have learned this.

>   > It's really not a big deal.  It's a flexible feature and is
>   > easy to learn.  Admittedly (like much in Emacs), if you have
>   > not yet learned it, and you try to write a command that
>   > takes advantage of a prefix arg, then you might be surprised
>   > to learn it.  Your surprise should be a welcome one, as you
>   > now know what you can do with it.
> Absolutely, at least now. Your post has been a very enlightening
> lecture indeed, as have the other explanatory posts. (I am wondering
> why I never grasped it from the Elisp Manual, but I guess because you
> have stated the whys and wherefores, it is much easier for me to store
> in memory somewhere.)

It's often the case that the same bit of info really registers
only after we've come into contact with the particular problem
(use case) that it was put there to address.

> Thanks very much to you all!

Thanks for posing the question, as I'm sure you are not the
only one for whom the question and the answer are helpful.

reply via email to

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