From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 15869085 for ; Sat, 22 Jun 2019 21:32:36 +0000 (UTC) Received: (qmail 13854 invoked by alias); 22 Jun 2019 21:32:29 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23985 Received: (qmail 2514 invoked by uid 1010); 22 Jun 2019 21:32:29 -0000 X-Qmail-Scanner-Diagnostics: from mail-ot1-f43.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25482. spamassassin: 3.4.2. Clear:RC:0(209.85.210.43):SA:0(-2.0/5.0):. Processed in 3.218629 secs); 22 Jun 2019 21:32:29 -0000 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.210.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CnBsB6A9ITnAEaq1H/EFhZkr1czriRb3IdtVmJNY8yk=; b=UmwElKhn4FBNM+EhtymHxd54oZHfrVu6W39K2iw2tnb6MggVPqcC5smSCXEYGTUvhr jn1E6HR5VwyNgmBBtEwgUhW3WVVxUkM1ILIBm+kh1m7zLKqzbiOHdjShSapomL1nNd/o ko+EC6se2pwMDITo3FQ8u/yk+6UxdgRfLBFNk2GZGS1L2nXrMu4Zto641qb0mhcgD3CJ Hka5cu+jnBN1KtDb54ADvsaC6sdP0kHB0NpIfUX78yTECng7wf5KIpfc3BBriXDNzqVy dReV2qxM3O2nZckElQTLPIsyxjzDob0uWL7GVLn6cRJizC5Ab8mM2T5vVtgmMKQSh0SS gVPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CnBsB6A9ITnAEaq1H/EFhZkr1czriRb3IdtVmJNY8yk=; b=VxSvWhqyIaZgr5EbBJLkWj7oEhTJLE3/G3zGqxrANg3sgCPmerT+NfkCRs/W0AORaN w/9C2ezhjIkbh5AIluUoe2gskMCJeRAlwKi8HSq2naERTlHnEykRjVP0tw7dokcRfoPz SaMeTgSQ7qYC8l5T3uOYe8efbJGb3n0yvkoJCRK3Q0vDU9Fs0oGo2reMF5/HfzxGgEmv xKjjbXkUkd4awCoYo+Qw0g0e5A8/C+s3nljlydRwjLcWPTmlu+VJaixeQgU4khR1nMb6 2Br3ke3hRxT7JUkSwJ/xjhXuIk00NqD1RtTaXPZ11dnH/XYXCNEJFm8KoqKSGMEzbDOp cA/A== X-Gm-Message-State: APjAAAXDmUEp0LYtpfvhPz9+vBXctO01fV7L8Bc7r3iPBImb/hP1j50h wAj+6rTl//JV/XNlDuSBwi2HvF7Ox0eE+kRx88g= X-Google-Smtp-Source: APXvYqyoXiDeL8jJCqfIjYYdLjCO8ZrRIW50tw6mYGNuocxH01Ago18Dkv8TluzI4lb2F1sGKwi3gyJO6TOGWI8A3ds= X-Received: by 2002:a9d:758b:: with SMTP id s11mr10361876otk.130.1561239113888; Sat, 22 Jun 2019 14:31:53 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sebastian Gniazdowski Date: Sat, 22 Jun 2019 23:31:42 +0200 Message-ID: Subject: Re: A function to display message under the prompt without zle active To: Roman Perepelitsa Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" On Sat, 22 Jun 2019 at 23:17, Roman Perepelitsa wrote: > > On Sat, Jun 22, 2019 at 10:49 PM Sebastian Gniazdowski > 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