zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@sunsite.dk>
Subject: Re: Is this an orthodox use of zstyle?
Date: Tue, 14 Oct 2003 16:42:50 +0000	[thread overview]
Message-ID: <1031014164250.ZM22562@candle.brasslantern.com> (raw)
In-Reply-To: <20031014160041.GA343@DervishD>

On Oct 14,  6:00pm, DervishD wrote:
} 
}     I think I can use styles to carry state information from one
} widget execution to another, so the widget will behave differently
} depending on the result of past executions, but: is this an orthodox
} use of styles [...]?

Typically functions read styles but don't set them, unless they're a
special kind of function that's designed to help the user set up his
environment (e.g., (in 4.1.1) select-word-style).

If the same function will behave differently depending on context
(e.g., it might be called as either a normal widget or a completion
widget) then styles might be appropriate, but if you don't need to
save different state in different contexts, parameters are better.

}     I know that I can do this with an environment variable but since
} the state information can be a bit complex I will need an array, or
} maybe a couple for separating information, or even an associative
} one

You presumably don't want to "export" the widget state parameters
(you can't export styles) so it's fine to use arrays and associative
arrays for your state.  For example, look at the set of parameters
used by the zftp functions to maintain state.


  reply	other threads:[~2003-10-14 16:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-14 16:00 DervishD
2003-10-14 16:42 ` Bart Schaefer [this message]
2003-10-14 17:17   ` DervishD
2003-10-15  6:21     ` Bart Schaefer
2003-10-15  9:54       ` DervishD
2003-10-15 15:15         ` Bart Schaefer
2003-10-15 19:00           ` DervishD
2003-10-16 14:40             ` Bart Schaefer

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=1031014164250.ZM22562@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.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).