Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: suspend (^Z) behavior while a function is running is unclear



On Mon, 20 Feb 2012 17:09:45 +0100
Vincent Lefevre <vincent@xxxxxxxxxx> 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@xxxxxxx>            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



Messages sorted by: Reverse Date, Date, Thread, Author