zsh-workers
 help / color / mirror / code / Atom feed
From: zyx@np.by
To: zsh-workers@zsh.org
Subject: [RFC] zsh/zpython module
Date: Wed, 23 Jan 2013 21:20:46 +0300 (FET)	[thread overview]
Message-ID: <54223.77.37.228.65.1358965246.smail@mail.np.by> (raw)

Wondering if I write zsh/zpython module will it be included?

This is the module that embeds python interpreter into zsh. Proposed features:

Minimal:
- zpython command similar to :python in vim.
- zsh python module capable of setting the environment variables.
Intended:
- zpython command
- zsh python module capable of
  - getting and setting local, global and exported variables, including special ones
  - defining zsh commands
  - defining “magic variables” (those that are running python code when their value is requested)
  - defining zle widgets

Reasoning:
1. there are some jobs that when implemented using shell scripting or external commands are very time-consuming. I know two examples of this: zsh-syntax-highlighting and new powerline prompt (it has very noticeable delay in its current status, but even just `PS1='$(python -c "print 2")'` has noticeable delay).
2. I know no other good ways of doing this: if I put powerline into background all IPC I can imagine is a crap:
  - pipes are not available;
  - zsh/zpty is an overkill;
  - coproc can run only one process in background;
  - UNIX sockets/FIFO files require some place you can write to on filesystem, require some effort to generate unique names, require garbage-collecting when shell quits or stops using prompt, require collecting stale files after a crash.
3. Any method is going to lose performance for IPC: fist you need to tell that new prompt is needed and update changed environment variables (like `$?`), then wait until kernel wakes the background process up and it will generate the prompt, then wait until kernel wakes your process up to get and display new value. Zsh/zpython is running python in the same process, no need in IPC. And Vim has already shown that powerline performs pretty well in this case.

I will welcome any comments about where I should look first when writing this module, what else I could include and what I could not because it is not easily doable.


------------
http://titov.by - Путь выхода из кризиса!


             reply	other threads:[~2013-01-23 19:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23 18:20 zyx [this message]
2013-01-24 19:14 ` Peter Stephenson
2013-01-28  4:16   ` zyx
2013-01-28  4:44     ` zyx
2013-01-28  9:56       ` Peter Stephenson
2013-01-28 16:57         ` zyx
2013-01-28 17:41           ` 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=54223.77.37.228.65.1358965246.smail@mail.np.by \
    --to=zyx@np.by \
    --cc=zsh-workers@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).