emacs and /etc/alternatives

Toshio Kuratomi a.badger at gmail.com
Fri Mar 9 22:17:40 UTC 2007


On Fri, 2007-03-09 at 14:12 -0500, Jesse Keating wrote:
> On Friday 09 March 2007 14:02:13 Toshio Kuratomi wrote:
> > I don't believe circular depenencies per se are problems.  Certain
> > instances are.  (Someone please correct me if I'm wrong, here.)  In this
> > case, breaking out the dependency into a virtual provides would be the
> > standard way to show that emacs-common requires one of /usr/bin/emacs-x
> > or /usr/bin/emacs-nox.
> >
> > ### Main package is old emacs-common
> > Requires: binemacs = %{version}-%{release}
> >
> > %package x
> > Provides: binemacs = %{version}-%{release}
> > Requires: %{name} = %{version}-%{release}
> >
> > %package nox
> > Provides: binemacs = %{version}-%{release}
> > Requires: %{name} = %{version}-%{release}
> >
> > s/binemacs/WhateverVirtualProvideStrikesYourFancy/
> 
> I thought about this, but what stopped me was I kept thinking that one would 
> want to set a preference in the /usr/bin/emacs file, and that would require 
> modification of the file, or an /etc/ file to set preference which led be 
> back to well, we have alternatives....
> 
> Of course, if we don't give a care what /usr/bin/emacs runs, so long as it 
> runs, then we could keep the script as is and use this Provides method and 
> move on.

As we've seen from the discussion about alternatives setting the
preference at the wrong level; setting the preference in /usr/bin/emacs
is pushing a user-preference out to the system where it doesn't belong.
We want the user to set the preference.  The script needs slight
modification to have a preferred value passed in via ENV VAR.

#!/bin/sh

PROG_NAME=`basename $0`

for i in $PREFERRED_EMACS x nox; do
  [ -x "/usr/bin/${PROG_NAME}-$i" ] && exec -a
${PROG_NAME} /usr/bin/${PROG_NAME}-$i "$@"
done

echo "Can't find $PROG_NAME" 1>&2
exit 1

The user can set PREFERRED_EMACS to x or nox or kde or wx or whatever
interfaces the future GNU emacs supports.  If its installed on this
system, it'll be invoked, else the script falls back to looking for an
emacs to run.

If there were a multitude of options, you could even set your own
fallback order.

-Toshio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-maintainers/attachments/20070309/499801a1/attachment.sig>


More information about the Fedora-maintainers mailing list