extract MarkOccurences code from ErlangEditor