Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Plugin conventions (was zsh-users Re: off topic)
- X-seq: zsh-workers 40152
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Plugin conventions (was zsh-users Re: off topic)
- Date: Sun, 11 Dec 2016 01:29:56 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=H8SGZJqoUB3U8UBtJuORFt0pw1m9VXnSL4Qe1WqEGmc=; b=WpaLzGeAnxUtBMf3rHSm1jEf0lhxMVtvkNZPrOiXmGbNNwTxnqT6g/X8pscpg/EXxq D/Gl4Q2w2Q/aAIUkLn83nhepM3xrmiSQmJn/+kvGPlhFeEp3y6uPzehXsBXRtHxgeF9U xlZwvMMbWVvM33BgaxDsfddzwviWKbFKXZw5sFki+wIoFtuNdsDUvOzB+GWbtFW3OV7Y welSsPPWGq1I4/ml3pHChnX/rB6+s4UmAwehBR7/dhwsoNENAi20Z0pycBVgU5E1XV5X QWxMdaA0piR8GrV079MTaWcQdR+qZQbQupadfD1pL+++mrPD/hsHjNU8IJnmq4evHAvb 76yg==
- In-reply-to: <20161211043221.GA11489@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20161209122958.GD19559@256bit.org> <57127.1481294647@hydra.kiddle.eu> <584AC8AC.9050406@eastlink.ca> <62522.1481300922@hydra.kiddle.eu> <584AEDBF.2050402@eastlink.ca> <161209165454.ZM9226@torch.brasslantern.com> <95362.1481338226__15466.9970310808$1481338718$gmane$org@hydra.kiddle.eu> <20161211043221.GA11489@fujitsu.shahaf.local2>
On Dec 11, 4:32am, Daniel Shahaf wrote:
} Subject: Re: off topic
}
} Oliver Kiddle wrote on Sat, Dec 10, 2016 at 03:50:26 +0100:
} > The omz convention seems to be a single file with the extension
} > .plugin.zsh which is sourced but there may be more to it than that.
} > We also need to think about the order in which commands are run.
}
} Whatever convention we come up with, can we please arrange for the
} plugin's code to be parsed without user options and/or aliases in
} effect?
Sebastian's plugin manager goes to quite some lengths to handle this,
as I recall, including keeping deltas of the option changes so that
any option changes made by the plugin are preserved.
An outline of a simplistic approach to same (I like using zstyle to
avoid having to invent safe parameter names):
{
zstyle plugin-manager user-options "${(kv)options[@]}"
zstyle plugin-manager user-aliases "${(kv)aliases[@]}"
emulate -R zsh
noglob unalias -m *
if source some.plugin.zsh
then
zstyle plugin-manager some.plugin-options "${(kv)options[@]}"
zstyle plugin-manager some.plugin-aliases "${(kv)aliases[@]}"
fi
} always {
zstyle -a plugin-manager user-options options
zstyle -a plugin-manager user-aliases aliases
# ... and then merge in the deltas ...
}
Another tricky bit is that the plugin might want to know what the
user's options were, so would have to be aware of how the plugin
manager has saved them.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author