[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: all xterms



On Sun, Oct 31, 1999 at 12:44:19PM +0100, Roland Rosenfeld wrote:
> On Sun, 31 Oct 1999, Anthony Towns wrote:
> > For example, instead of having a symlink to the real
> > /usr/bin/foo-1.2 in /etc/alternatives/foo, have an automagically
> > generated script that looks something like:
> > 	#!/bin/sh
> > 	prog=`basename $1`
> > 	if [ "$HOME" && -e "$HOME/.alternatives/$prog ]; then
> > 		exec $HOME/.alternatives/$prog
> > 	fi
> > 	exec /usr/bin/foo-1.2
> Depending on what program should be started with this mechanism (for
> example /usr/bin/csh as a fast /bin/csh), this will slow down the
> startup process of this binary very much.

`very much' ? You are kidding, right? I'm getting maybe 0.04s overhead
per call. And considering the usual candidates for the alternatives
mechanism are xterms and emacsen and such, that ain't much. Hell,
	xterm -e true
uses up ten times that much processor time anyway.

And if you're _really_ that desperate for speed (you're invoking something
in a /really/ tight loop), you can just use /usr/bin/xemacs-20.4 by name
instead of just /usr/bin/xemacs. Big deal, if you're desperate for speed,
you make those sort of hacks.

I don't get this complaint at all.

> > (Of course, you'd only want to do this for exectuables. Manpages and
> > whatnot would still have to make do with a symlink)
> That's not very intuitive, isn't it?

It's also not easily avoidable. `man sensible-foo' won't tell you which
options it *really* takes either, it'll at best tell you which manpages
you should be looking at, or more likely tell you nothing at all.

> So if we want a special handling
> for some alternatives (in this case all(?) executables), we can also
> make a special handling for _some_ executables using "sensible-*"
> wrappers, which evaluate an environment variable.  

...which needs to be rewritten again and again, instead of just making use
of a single mechanism.

> The latter variant has some advantages:
> - It can be activated temporarily (for example in an alias), which
>   isn't possible using symlinks.

alias xterm='/usr/bin/rxvt'

How isn't that possible?

> > OTOH, you could just encourage your users to do something like:
> > 	mkdir ~/bin
> > 	ln -s /usr/bin/rxvt ~/bin/xterm
>                                   ^^^^^ x-terminal-emulator
> > 	echo 'export PATH=~/bin:$PATH' >>.bashrc
> > and be done with it.
> 
> This sounds much more acceptable to me than your previous idea.  It's
> especially the way I normally use.  But this also has some (minor)
> disadvantages:
> - The man pages are not in sync with the executables

	mkdir -p ~/man/man1
	ln -sf /usr/X11R6/man/man1/rxvt.1.gz man/man1/x-terminal-emulator.1.gz
	echo 'export MANPATH=~/man:`manpath`' >>.bashrc

> - Some scripts set the PATH at the beginning, which may remove ~/bin
>   from it.

Such scripts are broken.

> I personally still think, that a sensible-x-terminal-emulator script
> would be the easiest (and most intuitive) way to realize this.

IMO, anything that's a good idea for a `sensible-x-terminal-emulator'
script is a good idea for all the other things that make use of
alternatives, so we should just extend it.

Cheers,
aj

-- 
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. PGP encrypted mail preferred.

 ``The thing is: trying to be too generic is EVIL. It's stupid, it 
        results in slower code, and it results in more bugs.''
                                        -- Linus Torvalds

Attachment: pgpHPb5IylZM6.pgp
Description: PGP signature


Reply to: