rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: John (_You_ hide, they seek.) Mackin <john@vetsci.su.oz.au>
To: The rc Mailing List <rc@hawkwind.utcs.toronto.edu>
Subject: rc initialisation
Date: Sun, 28 Jun 1992 16:00:25 -0400	[thread overview]
Message-ID: <199206290600.18625.rc.balid@vetsci.su.oz.au> (raw)

A file of rc tricks would be a good idea, especially since everyone
seems to have forgotten one of my favourites.

Chris's suggestion for getting initialisation to happen on every
new interactive rc is:

	fn prompt { if (! ~ $cpid $pid) {cpid=$pid; ... } }

This code is correct, but I think that most of the time this is not
what you want.  The original poster was looking for a way to get
an stty to happen when they fired off a new xterm.  If you use this
method, then the stty will happen not only at the very beginning of
the xterm, but every time a new interactive rc is spawned in the
xterm.  My counter-proposal is:

	fn prompt { do the initialisation; fn prompt }

This differs from Chris's in that the initialisation is definitely
only executed -once-, and in that the prompt function doesn't
hang around to clutter the environment and slow your shells down.
I think that in the huge majority of cases, these differences
will be advantages.

For a concrete example, here's the file in $home/bin that spawns
my window manager:

    #!/home/john/bin/rc

    fn prompt {
    	stty new
    	fn prompt
    }

    pathos $0 $*

On other matters mentioned recently, very briefly:

(1) Chris is 100% correct in his statement that no changes need be made
to rc to deal with any initialisation at all, with the possible
exception of rsh; and also 100% correct that we shouldn't try to change
rc to `work around' rsh.  (If we're sufficiently clever we can get rsh
to work right most of the time, I think.).

(2) Don't even THINK about making all rc's source .rcrc.  If we want
that kind of braindeath, we can use zsh.  The whole point of the way
rc works is that subshells -are- completely initialised from the
environment.

OK,
John.


             reply	other threads:[~1992-06-28 20:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-06-28 20:00 John Mackin [this message]
1992-06-29 22:22 ` Chris Siebenmann

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=199206290600.18625.rc.balid@vetsci.su.oz.au \
    --to=john@vetsci.su.oz.au \
    --cc=rc@hawkwind.utcs.toronto.edu \
    /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.
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).