zsh-users
 help / color / mirror / code / Atom feed
* Problem with function
@ 2002-05-07 10:03 Bruno Bonfils
  2002-05-07 10:16 ` Borsenkow Andrej
  2002-05-07 15:03 ` Bart Schaefer
  0 siblings, 2 replies; 3+ messages in thread
From: Bruno Bonfils @ 2002-05-07 10:03 UTC (permalink / raw)
  To: zsh-users

Hi all,

i want to use dynamic titles with screen. That why's i want to do a
print before each command, like this :

mutt () {
        print -Pn "\e]0; Mutt\a"
        \mutt
}

when i do that, i still have the mutt's completion, but when i press
enter, the print are executed (and work with screen) but the zsh
session crash :(

I hope you can help me, bests regards

-- 
 Bruno Bonfils             KeyID F39DCCF5    
 Sys Admin GNU/Linux 
 http://www.debian-fr.org


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

* RE: Problem with function
  2002-05-07 10:03 Problem with function Bruno Bonfils
@ 2002-05-07 10:16 ` Borsenkow Andrej
  2002-05-07 15:03 ` Bart Schaefer
  1 sibling, 0 replies; 3+ messages in thread
From: Borsenkow Andrej @ 2002-05-07 10:16 UTC (permalink / raw)
  To: 'Bruno Bonfils', zsh-users


> i want to use dynamic titles with screen. That why's i want to do a
> print before each command, like this :
> 
> mutt () {
>         print -Pn "\e]0; Mutt\a"
>         \mutt
> }
> 
> when i do that, i still have the mutt's completion, but when i press
> enter, the print are executed (and work with screen) but the zsh
> session crash :(
> 

Set title in preexec function. You do not say what version you have;
info from current version:

preexec
     Executed just after a command has been read and is about to be
     executed.  If the history mechanism is active (and the line was not
     discarded from the history buffer), the string that the user typed
     is passed as the first argument, otherwise it is an empty string.
     The actual command that will be executed (including expanded
     aliases) is passed in two different forms: the second argument is
     a single-line, size-limited version of the command (with things
     like function bodies elided); the third argument contains the full
     text that is being executed.

-andrej


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

* Re: Problem with function
  2002-05-07 10:03 Problem with function Bruno Bonfils
  2002-05-07 10:16 ` Borsenkow Andrej
@ 2002-05-07 15:03 ` Bart Schaefer
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2002-05-07 15:03 UTC (permalink / raw)
  To: Bruno Bonfils, zsh-users

On May 7, 12:03pm, Bruno Bonfils wrote:
}
} mutt () {
}         print -Pn "\e]0; Mutt\a"
}         \mutt
} }
} 
} the print are executed (and work with screen) but the zsh
} session crash :(

Using \mutt does NOT stop the mutt function from being called.  It only
stops an *alias* for mutt from expanding, if you had one.  Zsh crashes
because the heap overflows allocating memory for the infinitely recursive
function that you've written.

You want:

    mutt () {
      print -Pn "\e]0; Mutt\a"
      command mutt
    }

This is question 3.16 in the FAQ, by the way.

If you compiled zsh yourself, check out the --enable-max-function-depth
flag that you can pass to the configure script.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

end of thread, other threads:[~2002-05-07 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-07 10:03 Problem with function Bruno Bonfils
2002-05-07 10:16 ` Borsenkow Andrej
2002-05-07 15:03 ` Bart Schaefer

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