unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "Florian v. Savigny" <florian@fsavigny.de>, help-gnu-emacs@gnu.org
Subject: RE: Rationale behind conversion of a nil prefix arg to numeric 1
Date: Mon, 5 Sep 2016 16:32:23 -0700 (PDT)	[thread overview]
Message-ID: <1cded8d3-2296-4226-aea6-7f46278b4ae1@default> (raw)
In-Reply-To: <<877faqvxfp.fsf@bertrandrussell.Speedport_W_723V_1_40_000>>

>   > 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.



  parent reply	other threads:[~2016-09-05 23:32 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-04 12:23 Rationale behind conversion of a nil prefix arg to numeric 1 Florian v. Savigny
2016-09-04 14:23 ` Eli Zaretskii
2016-09-04 17:11   ` Andreas Röhler
2016-09-04 18:33     ` Eli Zaretskii
2016-09-05  7:16       ` Andreas Röhler
2016-09-05 14:56         ` Eli Zaretskii
2016-09-05 15:22           ` Kaushal Modi
2016-09-05 16:32             ` Drew Adams
2016-09-05 18:41             ` Andreas Röhler
2016-09-05 19:02               ` Eli Zaretskii
2016-09-06  7:10                 ` tomas
2016-09-06  9:45                   ` Florian v. Savigny
2016-09-06 10:27                     ` tomas
2016-09-06 11:27                     ` Andreas Röhler
2016-09-06 13:27                       ` Florian v. Savigny
2016-09-06 15:22                         ` Drew Adams
2016-09-06 14:20                       ` Kaushal Modi
2016-09-06 16:44                         ` Andreas Röhler
2016-09-06 16:41                           ` Kaushal Modi
2016-09-07 23:11                         ` Charles Millar
2016-09-08 13:10                           ` Kaushal Modi
2016-09-08 14:42                             ` Charles Millar
2016-09-08 15:40                           ` Drew Adams
2016-09-06  7:22                 ` Andreas Röhler
2016-09-05 17:04         ` Drew Adams
2016-09-05 21:39           ` Florian v. Savigny
     [not found]           ` <<877faqvxfp.fsf@bertrandrussell.Speedport_W_723V_1_40_000>
2016-09-05 23:32             ` Drew Adams [this message]
2016-09-06  3:45               ` B.V. Raghav
2016-09-04 22:53   ` Florian v. Savigny
     [not found]   ` <<87d1kjjmys.fsf@bertrandrussell.Speedport_W_723V_1_40_000>
2016-09-05  0:52     ` Drew Adams
2016-09-15 12:47 ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1cded8d3-2296-4226-aea6-7f46278b4ae1@default \
    --to=drew.adams@oracle.com \
    --cc=florian@fsavigny.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).