Improve elisp code in count-chars-from-pos