zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayne@clari.net>
To: Peter Stephenson <pws@ibmth.df.unipi.it>
Cc: Zsh hackers list <zsh-workers@sunsite.auc.dk>
Subject: Re: WORDCHARS, etc.
Date: Sat, 12 Jun 1999 23:53:57 -0700 (PDT)	[thread overview]
Message-ID: <Pine.GSO.4.10.9906122308380.26180-100000@house.clari.net> (raw)
In-Reply-To: <9906121541.AA35258@ibmth.df.unipi.it>

On Sat, 12 Jun 1999, Peter Stephenson wrote:
> - How do we decide whether an argument is going to be a digit
>   argument or a string?

If we're going to start allowing arbitrary arguments to be specified
then we need some kind of option syntax so we can set either or both
args for a function.  How about adding the -n# option to set an actual
value, and the -N option to set the number as unspecified (i.e. "use
the default").  For instance:

zle up-line -n 5  # goes up 5 lines, restores numeric arg afterward
zle up-line       # goes up current-numeric-arg # of lines
zle up-line -N    # goes up default # of lines, restores numeric arg

zle vi-fetch-history -N      # goes to last history event
zle vi-fetch-history -n3847  # goes to history event 3847

What do you think?

> (Wayne, how does your patch for `zle widget <num>' work?

Since there is currently no non-numeric-argument support in the zle,
my code just assumed that an optional trailing arg wanted to affect
the numeric arg.  If no arg is specified, it assumes that the command
should use the current value of the numeric arg.  It also assumes that
a non-numeric value will override the current numeric arg into the
arg-wasn't-specified state.

> It seems to assume it should set the digit argument to 1 if <num>
> didn't begin with a digit.  Is that important?

Yes.  Most zle functions default to 1 if no argument is specified,
so the zle code allows functions to be lazy about doing a proper arg
check:  any function that defaults to 1 can simply use the value of
zmult and it will be right.  For those unusual functions that default
to a different value, they first check if an actual arg was present
(if MOD_MULT was set in the flags), and only use zmult if it is a
real value.

> And shouldn't it handle negative numbers?)

Yes, it certainly should -- looks like I missed that.

> - Then we presumably need to add two flags, saying whether the
>   command just expects typed input, like isearches (which will be
>   treated like bindkey -s strings and put into the unget buffer),
>   or whether it actually wants a string argument, like the
>   proposed modifications to the movement commands.

Alternately, current commands like isearch can be tweaked to look for
a string arg and only read the keyboard if no string input was
specified.

>   Where would more than one argument be useful (apart from
>   specifying a numeric as well as a string argument)?

Maybe we should just keep the trailing argument(s) (sans any -n/-N
parsing) as a single string and let the command choose to parse
it as it sees fit (some commands may wish to break up the string
using whitespace, and some may not).

..wayne..


  reply	other threads:[~1999-06-13  6:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <199906101042.MAA23616@beta.informatik.hu-berlin.de>
1999-06-12 15:41 ` Peter Stephenson
1999-06-13  6:53   ` Wayne Davison [this message]
1999-06-13 11:17     ` Bart Schaefer
1999-06-14  7:15       ` Peter Stephenson
1999-06-14  9:19 Sven Wischnowsky
1999-06-14 14:42 ` Peter Stephenson
1999-06-14 13:12 Sven Wischnowsky
1999-06-15  6:57 Sven Wischnowsky

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

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

  git send-email \
    --in-reply-to=Pine.GSO.4.10.9906122308380.26180-100000@house.clari.net \
    --to=wayne@clari.net \
    --cc=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@sunsite.auc.dk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).