Why "flexible" that way? "However" vs. "only"...How are they related to each other??
As an adverb, but (meaning, nothing more than) is synonymous with only:
EX: He was only/but a child"
EX: Hopes that last but/only a moment
Note their origin in Old English (OE), but (adv.) unless, without, outside (of); only (adv.) unique, solitary. There's a semantic tie between outside (of) and solitary .
As a conjunction, but was not used as a conjunction in OE. Today, but (meaning with the exception that) is synonymous with however. Both mark an opposition in passing from one thought to another; possible tie: outside of the fact that...
EX: This is not winter, but it is almost as cold.
EX: This is not winter; it is, however, almost as cold
Usage: but marks the opposition with a medium degree of strength. however is weaker, and throws the opposition into the background. (still is stronger than but, and marks the opposition more emphatically.)
I'm interested in the deriviation. How does a single word "but" have two meanings which don't seem to be related to each other?
Derivation? I don't understand what you mean by 'derivation'.
According to the previous post, the difference in meaning between the two but's has to do with function: one is an adverb, the other a conjunction. The similarity in meaning between but/only and but/however has to do with semantic extension: but means, outside (of)/not inside ~ unique ~ the exception. As an exception it's also an opposition; only means, unique, solitary, sole; however expresses an opposition.