zsh-users
 help / color / mirror / code / Atom feed
* rxvt completion
@ 2019-11-04 22:09 Dave Woodfall
  2019-11-05  3:04 ` dana
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Woodfall @ 2019-11-04 22:09 UTC (permalink / raw)
  To: Zsh Users

Hi,

I'm using zsh 5.6.2 on Slackware.

I noticed today while using rxvt, that the urxvt completion function
also includes rxvt:

/usr/share/zsh/5.6.2/functions/_urxvt:
#compdef rxvt urxvt urxvtc urxvt256c urxvt256cc urxvt256c-ml rxvt256c-mlc

The rxvt I have is:

Rxvt v2.7.10 - released: 26 MARCH 2003

And the options are different to urxvt, so using them give errors.

If I submit a patch for rxvt completion, would it be accepted, as it
would mean removing rxvt from _urxvt's compdef?

I'm guessing that some *nixes out there rename urxvt to rxvt?

Or is there a completer for rxvt out there already?

Cheers

/dw

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rxvt completion
  2019-11-04 22:09 rxvt completion Dave Woodfall
@ 2019-11-05  3:04 ` dana
  2019-11-05  3:18   ` Dave Woodfall
  0 siblings, 1 reply; 4+ messages in thread
From: dana @ 2019-11-05  3:04 UTC (permalink / raw)
  To: Dave Woodfall; +Cc: Zsh Users

On 4 Nov 2019, at 16:09, Dave Woodfall <dave@tty1.uk> wrote:
> If I submit a patch for rxvt completion, would it be accepted, as it
> would mean removing rxvt from _urxvt's compdef?
>
> I'm guessing that some *nixes out there rename urxvt to rxvt?

Debian and its derivatives do (or it goes by both names at least).

Usually when there are different implementations of a tool with the same name,
you use _pick_variant and/or check $OSTYPE to determine which one to complete
for. Depending on how similar they are, you might keep them both in the same
function, or make them separate and conditionally call one from the other. I'm
not sure which is better for rxvt (do they still have a lot of shared options
or are they completely different?), but if you grep the repo for _pick_variant
you'll see lots of examples you can borrow from

dana


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rxvt completion
  2019-11-05  3:04 ` dana
@ 2019-11-05  3:18   ` Dave Woodfall
  2019-11-05  3:54     ` dana
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Woodfall @ 2019-11-05  3:18 UTC (permalink / raw)
  To: Zsh Users

On Mon 4 Nov 2019 21:04,
dana <dana@dana.is> put forth the proposition:
> On 4 Nov 2019, at 16:09, Dave Woodfall <dave@tty1.uk> wrote:
> > If I submit a patch for rxvt completion, would it be accepted, as it
> > would mean removing rxvt from _urxvt's compdef?
> >
> > I'm guessing that some *nixes out there rename urxvt to rxvt?
>
> Debian and its derivatives do (or it goes by both names at least).
>
> Usually when there are different implementations of a tool with the same name,
> you use _pick_variant and/or check $OSTYPE to determine which one to complete
> for. Depending on how similar they are, you might keep them both in the same
> function, or make them separate and conditionally call one from the other. I'm
> not sure which is better for rxvt (do they still have a lot of shared options
> or are they completely different?), but if you grep the repo for _pick_variant
> you'll see lots of examples you can borrow from
>
> dana
>

Thanks, I'll look for that.  A quick grep shows quite a few
_pick_variant and $OSTYPE in /usr/share/zsh/5.6.2/functions/ so I
should be able to put something together.

> do they still have a lot of shared options or are they completely
> different?)

There are some options that are the same, but urxvt has many more.

rxvt:

 [-display string] [-tn string] [-geometry geometry] [-C] [-iconic] [-/+rv]
 [-/+ls] [-/+j] [-/+sb] [-/+sr] [-/+st] [-/+si] [-/+sk] [-/+sw] [-/+ip]
 [-/+ipf] [-/+ut] [-/+vb] [-/+mcc] [-/+tcw] [-bg color] [-fg color]
 [-pixmap file[;geom]] [-fb fontname] [-fn fontname] [-fm fontname] [-km mode]
 [-im name] [-pt style] [-name string] [-title string] [-n string] [-cr color]
 [-pr color] [-bd color] [-sl number] [-w number] [-b number] [-lsp number]
 [-sbt number] [-mod modifier] [-xrm string] [-e command arg ...]

urxvt:

[-display string] [-tn string] [-geometry geometry] [-C] [-iconic]
[-cd string] [-dockapp] [-/+rv] [-/+ls] [-mc number] [-/+j] [-/+ss] [-/+ptab]
[-/+sb] [-/+sr] [-/+st] [-sbt number] [-/+si] [-/+sk] [-/+sw] [-/+ip] [-/+tr]
[-tint color] [-sh number] [-blr HxV] [-fade number] [-fadecolor color]
[-/+ut] [-/+vb] [-/+tcw] [-/+insecure] [-/+uc] [-/+bc] [-/+pb] [-bg color]
[-fg color] [-hc color] [-cr color] [-pr color] [-pr2 color] [-bd color]
[-pixmap file[;geom]] [-icon file] [-fn fontname] [-fb fontname]
[-fi fontname] [-fbi fontname] [-/+is] [-im name] [-pt style]
[-imlocale string] [-imfont fontname] [-name string] [-title string]
[-n string] [-sl number] [-embed windowid] [-depth number] [-visual number]
[-/+override-redirect] [-pty-fd fileno] [-/+hold] [-w number] [-b number]
[-/+bl] [-lsp number] [-letsp number] [-/+sbg] [-mod modifier] [-/+ssc]
[-/+ssr] [-pe string] [-e command arg ...]

Cheers

/dw

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rxvt completion
  2019-11-05  3:18   ` Dave Woodfall
@ 2019-11-05  3:54     ` dana
  0 siblings, 0 replies; 4+ messages in thread
From: dana @ 2019-11-05  3:54 UTC (permalink / raw)
  To: Dave Woodfall; +Cc: Zsh Users

On 4 Nov 2019, at 21:18, Dave Woodfall <dave@tty1.uk> wrote:
> There are some options that are the same, but urxvt has many more.

It looks like almost a super-set, so you could just do something like:

  args=( ... ) # Common arg specs

  # Detect urxvt by looking for 'unicode' in the -help output, or whatever
  # would actually work here, idk
  if _pick_variant urxvt=unicode rxvt -help; then
    args+=( ... ) # urxvt-specific arg specs
  else
    args+=( ... ) # rxvt-specific arg specs
  fi

  _x_arguments $args

The existing call to urxvt for the long_args thing probably (?) needs changed
too, so that it uses $words[1] (the actual command being completed for)
together with _call_program — lots of examples of that in the repo too

dana


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-05  3:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 22:09 rxvt completion Dave Woodfall
2019-11-05  3:04 ` dana
2019-11-05  3:18   ` Dave Woodfall
2019-11-05  3:54     ` dana

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