zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: <zsh-workers@zsh.org>
Subject: Re: suspend (^Z) behavior while a function is running is unclear
Date: Mon, 20 Feb 2012 16:35:57 +0000	[thread overview]
Message-ID: <20120220163557.672588e2@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20120220160944.GC7797@xvii.vinc17.org>

On Mon, 20 Feb 2012 17:09:45 +0100
Vincent Lefevre <vincent@vinc17.net> wrote:
> Now I'm thinking whether there should be an option to control that.
> Indeed, some functions may fail to work correctly if they are suspended
> in such a way. Some functions or { list } could be marked as not
> backgroundable, e.g. by setting an option at the beginning, in which
> case the ^Z could be ignored.

Useful, but I'm not sure an option is the right way of doing this... I
should think you'd want to do something like:

{
  stty susp undef
  ...
} always {
  stty susp '^z'
}

which you could encapsulate as

nosuspend() {
  {
    stty susp undef
    "$@"
  } always {
    stty susp '^z'
  }
}
compdef _precommand nosuspend

except you can do better by saving and restoring the setting.

A library module for manipulating terminal settings using parameters
(which you can make local) might be an interesting project for someone
with nothing better to do.

(By the way, I'm wondering how many of the other shells simply execute
to the end of the parent function when they see the "emacs" process
suspended?)

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog


  reply	other threads:[~2012-02-20 16:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20 13:02 Vincent Lefevre
2012-02-20 15:13 ` Peter Stephenson
2012-02-20 16:09   ` Vincent Lefevre
2012-02-20 16:35     ` Peter Stephenson [this message]
2012-02-20 17:41       ` Bart Schaefer
2012-02-20 18:33         ` Vincent Lefevre
2012-02-20 18:53           ` Bart Schaefer
2012-02-20 19:21             ` Vincent Lefevre
2012-02-20 19:48             ` Mikael Magnusson
2012-02-21  3:27               ` Bart Schaefer

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=20120220163557.672588e2@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.com \
    --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).