[E-Lang] Announcing the Interim Internal E stl-0.8.9p Release

Mark S. Miller markm@caplet.com
Sat, 10 Feb 2001 15:10:02 -0800


At 06:08 AM Friday 2/9/01, Mark S. Miller wrote:
>Anyone know how to create file extension associations from KDE or Gnome?  Is 
>it per desktop environment, or is there a more widely accepted way to do 
>this?  Can it be done from Java?  What do people actually do about the 
>inevitable name space conflicts in this tiny name space?  On MSWindows I 
>grab the extensions *.e, *.emaker, *.updoc, *.vat, and *.cap.  I'd like to 
>do the same in general.

At 10:04 AM Friday 2/9/01, Dan Bornstein wrote:
>I think it's more a matter of associating the magic number with the right
>program, and then you'll work across the OS in general, not just in some
>random GUI environment. On recent Linuxes, I think there's some "magic" you
>can do in /proc to add new associations (which you can add to your
>rc.local, or equivalent). On other Unices it may require adding a new
>loadable kernel module or even modifying and recompiling the kernel.
>
>A friend of mine recently went through this exercise in order to make jar
>files marked executable do the "right" thing on Linux. (Note, there's no
>obvious right way to control things like heap/stack size or provide other
>VM control commandline arguments in this situation.) If you're interested,
>I'll pry him for details.
>
>So, you have to make sure that something in the first dozen or so bytes of
>your files can uniquely identify your various types, and then key off of
>that. For text scripts, you're probably best off sticking with the old
>"#!/usr/bin/env" trick.


If the answer's this hard, I'm probably not asking the right question.  As 
far as whether "exec" will see a file as an executable, or likewise whether 
I can use it as a command name in a shell, I'm already using the 
"#!/usr/bin/env .." trick happily.  Rather, I'm asking about interactive use 
from the desktop.

Can't something be done with mime types?  The "mime.types" file (or some 
such) associates extensions with "internet media types", such as *.txt => 
"text/plain".  Browsers at least know which program to launch when receiving 
a particular mime type.  Where is this information kept?  Do browsers and 
(some) desktops share this info?

After a bit of poking around, under KDE it looks like the relevant info may 
be in "~/.kde/share/mimelnk/", and something called "Bindings".  I was able 
to change the icon associated with all *.txt (plain/text) files on my KDE 
desktop, but I didn't succeed at binding text files to emacs (as the 
application to launch on double click) rather than it's default text editor.

If this is the right place, the good news is that it's per user without 
requiring any privileges beyond the user's.  The bad news is that it's also 
per desktop, which probably means that it's only worth doing for Gnome, if 
at all.

I hate to say this, but it looks like MSWindows does a better job at 
facilitating such customization than (at least) KDE on RedHat Linux 7.


        Cheers,
        --MarkM