jed-users mailing list

[2006 Date Index] [2006 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: read_mini steals prefix argument


Jörg Sommer <joerg@xxxxxxxxxxxx> wrote:
>BTW: While we talk about this feature. How to insert 40 zeros or 12 ones?

It it not supported by this feature.  If I were to introduce some sort
of character to act as as a delimiter to separate the digits of the
prefix argument from the digit that you are trying to repeat, you
could then ask the question about how to insert that delimiter a
number of times.

>> The prefix-argument is also global, meaning that there is only one
>> instance available.  This means that any setting prior to calling
>> read_mini would be lost if a prefix-argument were used at the prompt.
>
>Hence, I must use a variable or have I another choice?

What are you trying to do?

>And why is () not couted as argument?

In order for slang to properly set the _NARGS variable, it must
generate code to deduce the number of function arguments by watching
the stack.  In your example, the stack does not change and as a
result, _NARGS is 0.

>define g()
>{
>    message(string(prefix_argument(-1))+"  "+string(_NARGS));
>}
>
>read_mini("X", "", "");
>set_prefix_argument(12);
>g( () );

For this reason, it is preferable to code the above using:

   variable x = read_mini (...);
   set_prefix_argument (12);
   g(x);

You can avoid the use of a variable by using

   g (read_mini (...), set_prefix_argument (12));

but you should add a comment to explain that set_prefix_argument does
not return anything.

--John
   


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2006 date index] [2006 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]