zsh-workers
 help / color / mirror / code / Atom feed
* [RFC] zsh/zpython module
@ 2013-01-23 18:20 zyx
  2013-01-24 19:14 ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: zyx @ 2013-01-23 18:20 UTC (permalink / raw)
  To: zsh-workers

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 - Путь выхода из кризиса!


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-28 17:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23 18:20 [RFC] zsh/zpython module zyx
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

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).