> I mentioned "non-BMP characters" in the previous reply. I understood that NSString counts numbers of UTF-16 units instead of numbers of characters, so NSString counts length of a non-BMP character as 2. Thanks for your detailed description. I fixed my patch to adjust the numbers in `selectedRange', so that emacs can recognize the range properly. Attached patch also includes the patch `im-cursor-position-fix.diff', so you don't need to apply it now. ...BTW, I tried your Mac port today, and it seems to be working fine for me. I hope it will be merged soon.