From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Extending zed
Date: Sun, 28 Jul 2019 13:01:53 +0200 [thread overview]
Message-ID: <CAKc7PVAARzLbdSefYZsn57NZF2BHR2X0LzH_-VjTH7-qHB5-FA@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVAtp=UX+VmD-38z0WsZw9_9KHNyT0hM1iez7bxUwM7BAg@mail.gmail.com>
śOn Tue, 5 Jun 2018 at 16:40, Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> On 4 June 2018 at 18:08, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> > -i vi-cmd-mode). I followed the naming of the __zed_pg_up widgets in
> > naming this __zed_init but I'm not especially fond of this – it looks
> > like a completion function.
>
> It hurts me a little too. For my plugin functions, I use "-", i.e.
> "-zed_pg_up", but didn't propose this as it is somewhat controversial
> – requires to use "--" when handling the function, e.g. when passing
> to `autoload -- -zed_pg_up`.
A proposal for a function naming scheme. The prefix and then its description:
- . (dot) - for normal yet private functions, i.e. functions that
shouldn't interfere with command-line completion, i.e. shouldn't be
completed when user enters e.g. "$ z<TAB>",
- + - for IO functions, e.g.: +myprj_print_msg or +myprj-print-msg
- @ - for API-like functions, i.e. functions that are used across
projects, that are exposed for use by some code with another ogigin,
.e.g @myprj-register-hook
- / - for debug-like functions, e.g. /myprj-dbg-print. The slash makes
the function impossible to be autoloaded, but the assumption is that
the debug functions shouldn't need this, at least not that it cannot
be resigned from,
- : - for a handler- or callback-, etc like functions; so e.g.
add-zsh-hook precmd :my-precmd-handler
So an example condensed code would look like this:
.prjid_register_hooks() {
integer ret
add-zsh-hook precmd :prjid-precmd-handler; ret+=$?
/prjid-dmsg "Installed precmd hook with result: $ret"
@otherprj-notice-hook precmd-hook :prjid-precmd-handler; ret+=$?
+prjid-print "Initialization complete (errors: $ret)"
}
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
next prev parent reply other threads:[~2019-07-29 0:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20180603055854epcas5p1e92f5a41384aeb9d1555751df74f57ee@epcas5p1.samsung.com>
2018-06-03 5:57 ` Sebastian Gniazdowski
2018-06-04 8:37 ` Peter Stephenson
2018-06-04 9:41 ` Sebastian Gniazdowski
2018-06-04 9:50 ` Peter Stephenson
2018-06-04 10:17 ` Sebastian Gniazdowski
2018-06-04 16:08 ` Oliver Kiddle
2018-06-05 14:40 ` Sebastian Gniazdowski
2019-07-28 11:01 ` Sebastian Gniazdowski [this message]
[not found] ` <20180604105042.69c54bee@camnpupstephen.cam.scsc.local>
2018-06-04 9:56 ` Peter Stephenson
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=CAKc7PVAARzLbdSefYZsn57NZF2BHR2X0LzH_-VjTH7-qHB5-FA@mail.gmail.com \
--to=sgniazdowski@gmail.com \
--cc=okiddle@yahoo.co.uk \
--cc=zsh-users@zsh.org \
/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).