Basically it's pretty simple. If speed is dropping, regardless of the cause (wind shift or hole), you head off or up closer to the fastest point of sail (about 110-120 degrees off the wind).

In gusty conditions, keeping on a steady line is almost impossible if you want to maintain maximum speed. Yes, you will most likely sail a snake-shaped course. This is true upwind and downwind as well as a beam reach. The only variation would be a beam reach where heading above 90 degrees would only be done if overpowered, since it will slow you down a bit, assuming your goal is maximum speed.

With the black patches, the angle of the sun can fool you into thinking the gust is bigger than it really is. I see this in the late afternoon when the sun gets lower and you are heading into the sun.

One racing lesson that takes a long time to learn is how high you can point without sacrificing too much speed. In other words, what is the fastest line to the upwind mark. Point too high and you lose too much speed. Point too low and you go fast, but don't gain upwind distance. Somewhere in between there is the "best line" and only experience will teach you where it is.