ability to determine markup format from file variables

It would be really nice to have ability to name README as just README without any extensions, putting file format declaration in so-called file variables, like:

    .. -*- mode: rst -*-
    # -*- mode: markdown -*-

I believe that file variables are used widely enough to make them recognizable (i.e. they are used by Python to determine source file encoding).

I'm not sure my code is good enough for you, but I'm not used to writing Ruby unfortunately. If the request as a whole makes sense, but implementation is questionable, I'll be glad to fix it.