Ah-ha! I had dim memories of learning a general rule of thumb for how to handle the A in RP English, so I went looking for it.
Until around the 1600s everyone, no matter where they lived, pronounced a the short way, as in trap. But in the 17th century it became fashionable in London to lengthen the a sound before the sounds s, f and th (so-called “bath” types of words). This pronunciation was then exaggerated, making the a sound even longer. Then the long a began to appear before an m or n if they were followed by another consonant (grant, sample, for instance).