zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: A function to display message under the prompt without zle active
Date: Sat, 22 Jun 2019 23:31:42 +0200	[thread overview]
Message-ID: <CAKc7PVBR2upUO+Tnjc+mb8A85Py1NFnb-meFAzj=8ehkPy9fwg@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMrkkYfZ3nnjy3a+RE=W1pO+UJ4aU=0NT5EDekd+x0kJRg@mail.gmail.com>

On Sat, 22 Jun 2019 at 23:17, Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
>
> On Sat, Jun 22, 2019 at 10:49 PM Sebastian Gniazdowski
> <sgniazdowski@gmail.com> wrote:
> >
> > The command line seems to be blcoked after first using the descriptor.
>
> Silly bugs. This isn't production code, I just typed it into GMail to
> give an idea. Removing `while` should fix it. There is also a missing
> `local` and quotes. With these fixes in place:
>
>     function _zle_msg_process() {
>       emulate -L zsh
>       local line
>       IFS='' read -r -u $zle_msg_fd line && zle -M $line
>     }
>
> The rest of the code stays the same. The nice thing about this
> implementation is that it's fork-free.

Thanks for the code, this distinct property might get handy in some situations.

> Depending on your needs you might also want to open the file descriptor
> with `sysopen -rw -o cloexec`.
>
> Note that zle will hang if you write something to the file descriptor
> without a terminating \n.
>
> Roman.

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

      parent reply	other threads:[~2019-06-22 21:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-22 17:17 Sebastian Gniazdowski
2019-06-22 17:45 ` Roman Perepelitsa
2019-06-22 20:49   ` Sebastian Gniazdowski
2019-06-22 21:17     ` Roman Perepelitsa
2019-06-22 21:19       ` Roman Perepelitsa
2019-06-22 21:31       ` Sebastian Gniazdowski [this message]

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='CAKc7PVBR2upUO+Tnjc+mb8A85Py1NFnb-meFAzj=8ehkPy9fwg@mail.gmail.com' \
    --to=sgniazdowski@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --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).