Can't make an substitution's exception to work

I’m making #hist feature for the /longs. The rule I want to make is that in the s_s pair, only the first letter would change:
ignore sub s s’;
sub s’ by longs;

It doesn’t work. Funnily enough, the opposite thing does:
ignore sub s’ s;
sub s’ by longs;

I’m not answering your question, but I leave related Typophile threads:
http://typophile.com/node/72041
http://babelstone.blogspot.co.uk/2006/06/rules-for-long-s.html

Edit: It doesn’t work because the first s is substituted since there is no preceding s. So, because the first s has become long s already, when it moves on to the second s, there is no preceding s (therefore it becomes longs too).

So the code should be like this:

ignore sub longs s’;
sub s’ by longs;

Alternatively, you can do it in two steps. First, you substitute all s’s with longs, then substitute some back to normal s. In the case of double-s situation, the code looks like this:

sub s by longs;
sub longs longs’ by s;

Two suggestions:

Why? This should be for the user to decide. That is, of course, unless you have a very specific application for this contextual substitution.

Secondly, I recommend you use /s.hist as a name rather than /longs because this feature is expected to change only on the glyph level, not on the character level. And /longs is connected to a different Unicode value (017F) than /s (0073). You can quickly make a component copy by typing “longs=s.hist” into the dialog that appears after Font > Add Glyphs.