I take a piece of the same wood, off the same side of the stock if possible (starting with a blank) and cut it to about 1/2" square and 6" long and clamp this in a sturdy vise. Then I set my freshly sharpened plane to where it will shave off smooth curls thick enough for the needed work. I iron the curls with a steam iron flat and cut with scissors while wet. Then I apply Elmers wood staining glue and slide the shaving edgewise in the inlet and put in the lock, barrel, tang, whatever. The repair will be nearly invisible and will take common stains. If your gap is larger than this, then the other solutions above are good ones.