bug#24369: Docu of prefix-numeric-value

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#24369: Docu of prefix-numeric-value

Andreas Röhler
See recent question at

http://lists.gnu.org/archive/html/help-gnu-emacs/2016-09/msg00018.html

Please add some explanation WRT treatment of the nil-argument.

Also WRT C-u

Thanks!





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#24369: Docu of prefix-numeric-value

Drew Adams
> See recent question at
> http://lists.gnu.org/archive/html/help-gnu-emacs/2016-09/msg00018.html
>
> Please add some explanation WRT treatment of the nil-argument.
> Also WRT C-u

What "treatment" are you asking to be explained?
Just what do you think is missing?



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#24369: Docu of prefix-numeric-value

Andreas Röhler


On 05.09.2016 17:57, Drew Adams wrote:
>> See recent question at
>> http://lists.gnu.org/archive/html/help-gnu-emacs/2016-09/msg00018.html
>>
>> Please add some explanation WRT treatment of the nil-argument.
>> Also WRT C-u
> What "treatment" are you asking to be explained?
> Just what do you think is missing?

Elisp Info 20.2.2 Code Characters for ‘interactive’
----------------------------------------

p’
      The numeric prefix argument

User will expect the argument received by function being consistent with
input, i.e. M-x 2 foo... sends 2, M-x 1 foo ... sends 1. From there
omitting an argument will be expected to send nothing - which isn't the
case.

Likewise with uppecase P.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#24369: Docu of prefix-numeric-value

Drew Adams
> > What "treatment" are you asking to be explained?
> > Just what do you think is missing?
>
> Elisp Info 20.2.2 Code Characters for ‘interactive’
> ----------------------------------------
>
> p  The numeric prefix argument
>
> Likewise with uppecase P.

Again, what do you think is missing?  `p' is the numeric prefix argument.
`P' is the raw prefix argument.

This is not the Elisp manual node that describes WHAT these things
are.  But there is a link here to the node that does that, node
`Prefix Command Arguments'

http://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Command-Arguments.html

And that's the case even in the Emacs 20 version of the manual,
which you cited.

> User will expect the argument received by function being consistent with
> input, i.e. M-x 2 foo... sends 2, M-x 1 foo ... sends 1. From there
> omitting an argument will be expected to send nothing - which isn't the
> case.

Why on Earth would the user expect that, simply from reading that
`interactive' code `p' returns the numeric prefix argument and `P'
returns the raw prefix argument?



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#24369: Docu of prefix-numeric-value

Eli Zaretskii
In reply to this post by Andreas Röhler
> From: Andreas Röhler <[hidden email]>
> Date: Mon, 5 Sep 2016 19:44:28 +0200
>
> >> Please add some explanation WRT treatment of the nil-argument.
> >> Also WRT C-u
> > What "treatment" are you asking to be explained?
> > Just what do you think is missing?
>
> Elisp Info 20.2.2 Code Characters for ‘interactive’
> ----------------------------------------
>
> p’
>       The numeric prefix argument
>
> User will expect the argument received by function being consistent with
> input, i.e. M-x 2 foo... sends 2, M-x 1 foo ... sends 1. From there
> omitting an argument will be expected to send nothing - which isn't the
> case.

There's more in the manual than just that one paragraph.

ELisp manual 20.12 Prefix Command Arguments:
-------------------------------------------

   There are two representations of the prefix argument: “raw” and
“numeric”.  The editor command loop uses the raw representation
internally, and so do the Lisp variables that store the information, but
commands can request either representation.

   Here are the possible values of a raw prefix argument:

   • ‘nil’, meaning there is no prefix argument.  Its numeric value is
     1, but numerous commands make a distinction between ‘nil’ and the
     integer 1.
   ...


 -- Function: prefix-numeric-value arg
     This function returns the numeric meaning of a valid raw prefix
     argument value, ARG.  The argument may be a symbol, a number, or a
     list.  If it is ‘nil’, the value 1 is returned; if it is ‘-’, the
     value −1 is returned; if it is a number, that number is returned;
     if it is a list, the CAR of that list (which should be a number) is
     returned.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#24369: Docu of prefix-numeric-value

Andreas Röhler


On 05.09.2016 19:57, Eli Zaretskii wrote:
>
>     Here are the possible values of a raw prefix argument:
>
>     • ‘nil’, meaning there is no prefix argument.  Its numeric value is
>       1,

That's the point:

Value of nil is 1
Value of 1 is 1

But he value of 2 is 2

Consistency means something different.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#24369: Docu of prefix-numeric-value

Eli Zaretskii
> Cc: [hidden email], [hidden email]
> From: Andreas Röhler <[hidden email]>
> Date: Mon, 5 Sep 2016 20:33:21 +0200
>
> >     • ‘nil’, meaning there is no prefix argument.  Its numeric value is
> >       1,
>
> That's the point:
>
> Value of nil is 1

No, the _numeric_ value of nil is 1.  IOW, nil, when interpreted as a
number, is 1.  An entirely different story.

> Consistency means something different.

The numeric value of nil is consistently 1.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#24369: Docu of prefix-numeric-value

Drew Adams
> > >     • ‘nil’, meaning there is no prefix argument.  Its numeric value
> > >       is 1,
> >
> > That's the point: Value of nil is 1
>
> No, the _numeric_ value of nil is 1.  IOW, nil, when interpreted
> as a number, is 1.  An entirely different story.

Exactly.  The value of `(prefix-numeric-value nil)' is 1.

That's what "numeric value of" the prefix argument means.
It is also what the shorter expression "the numeric prefix
argument" means.

The fact that the value of some function applied to nil
is 1 does not mean that the value of nil is 1.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

bug#24369: Docu of prefix-numeric-value

npostavs
tags 24369 notabug
close 24369
quit

Drew Adams <[hidden email]> writes:

>> > >     • ‘nil’, meaning there is no prefix argument.  Its numeric value
>> > >       is 1,
>> >
>> > That's the point: Value of nil is 1
>>
>> No, the _numeric_ value of nil is 1.  IOW, nil, when interpreted
>> as a number, is 1.  An entirely different story.
>
> Exactly.  The value of `(prefix-numeric-value nil)' is 1.
>
> That's what "numeric value of" the prefix argument means.
> It is also what the shorter expression "the numeric prefix
> argument" means.
>
> The fact that the value of some function applied to nil
> is 1 does not mean that the value of nil is 1.

I think there is nothing more to be done here, so I'm closing the bug.



Loading...