zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Phil Pennock <comet@fysh.org>, zsh-workers@math.gatech.edu
Subject: Re: experimental new style completion
Date: Fri, 22 Jan 1999 09:09:49 -0800	[thread overview]
Message-ID: <990122090949.ZM26472@candle.brasslantern.com> (raw)
In-Reply-To: <19990122161858.B26327@fysh.org>

On Jan 22,  4:18pm, Phil Pennock wrote:
} Subject: Re: experimental new style completion
}
} Whilst it's nice and understandable to people who're extensively
} familiar, doesn't anyone else think it's time to sit back and try and
} look at this syntax objectively?

It surely is gory, but there's only so much that can be done to clarify
it, particularly with the constraint that it can't conflict with any
syntax used by either the Bourne or Korn shells.  However, it's not as
bad as you imply; there are stylistic issues.

	eval b\=\( \$\{b:/\*\(${(j:|:)fignore}\)\} \)

I wouldn't have used all those backslashes ... I prefer quotes:

	eval 'b=( ${b:/*('${(j:|:)fignore}')} )'

which leaves just two oddities:  The (|) glob alternation syntax and the
admittedly icky parameter flags syntax.  It becomes slightly more readable
if you replace the `:' with matching parens or braces:

	eval 'b=( ${b:/*('${(j(|))fignore}')} )'

Would it help to have written it this way?

	fignore_alternatives="${(j(|))fignore}"
	fignore_glob="*($fignore_alternatives)"
	eval 'b=( ${b:/'$fignore_glob'} )'

The final nasty bit here is the need to "eval" to strip the quoting from
the `|' characters in the alternatives, so that the glob will work right.

For those still confused, the whole mess is the same as:

	b_=()
	for i in "$b[@]"
	do
	    for j in "$fignore[@]"
	    do
	    	case "$i" in
		*${j}) continue 2 ;;
		esac
	    done
	    b_=("$b_[@]" "$i") 
	done
	b=("$b_[@]")

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1999-01-22 17:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-22 14:50 Sven Wischnowsky
1999-01-22 16:18 ` Phil Pennock
1999-01-22 17:09   ` Bart Schaefer [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-01-22 16:30 Sven Wischnowsky
1999-01-22 13:15 Sven Wischnowsky
1999-01-21 16:07 Sven Wischnowsky
1999-01-21 12:02 Sven Wischnowsky
1999-01-21 10:53 Sven Wischnowsky
1999-01-21 10:36 Sven Wischnowsky
1999-01-07  8:02 Sven Wischnowsky
1999-01-05 15:43 Sven Wischnowsky
1999-01-07  7:36 ` Bart Schaefer
1998-12-18 15:59 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=990122090949.ZM26472@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=comet@fysh.org \
    --cc=zsh-workers@math.gatech.edu \
    /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).