That's right.

It works most of the time for me but sadly sometimes it still puts the buff on a ranged instead of a melee.

You can also make a party sort macro (/psort) or just throw the command on the Dragon Sight macro.