[OS X Emacs] Paste of Umlaut-characters from PDF in Preview: shifted dots?

Stefan Vollmar vollmar at nf.mpg.de
Sun Aug 7 16:52:47 EDT 2011

Dear Carsten,

On 07.08.2011, at 15:55, Carsten Bormann wrote:

> It is a problem with PDF viewers in OSX.  They create clipboard clippings that are essentially Unicode NFD.  Most Emacs users expect to work in NFC, which is the rational thing to do (see RFC 5198), but Apple is a bit challenged here.  Emacs has code that mostly fixes the file system's insistence on NFD, but doesn't fix the clipboard.
> I have the following code in my .emacs:
> (defun utfix (rs re)
>  (interactive "r")
>  (save-excursion
>    (goto-char rs)
> (cond
> ;; Emacs 23
> ((equal emacs-major-version 23)
>    (utf-8m-post-read-latin-conversion (- re rs)))
> ((equal emacs-major-version 24)
>    (ns-utf8-nfd-post-read-conversion (- re rs)))
> )
>    ))
> Run this (M-x utfix RET) while a region is selected and the NFD patches in that region will be rationalized to NFC.
> (Note that what you actually see is a problem in Emacs with the display of NFD unicode, but for em this problem actually is a feature as it alerts me to the presence of NFD text in my documents that won't work right in most environments.)

thank you for the detailed reply!

I have tried to run your code in Aquamacs 2.3a and it yielded
cond: Symbol's function definition is void: utf-8m-post-read-latin-conversion

However, this version:

(defun utfix (rs re)
  (interactive "r")
    (goto-char rs)
    (ns-utf8-nfd-post-read-conversion (- re rs)))

works (so apparently Aquamacs 2.3a based on GNU Emacs behaves more like Emacs 24.x than 23.x?).

As far as I can see, your code solves my problem just fine without changing any other text properties. Maybe it should become part of next Aquamacs release and being applied by default to any clipboard contents before it is pasted? Do you see a reason not to do this?

Warm regards,
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
E-Mail: vollmar at nf.mpg.de   http://www.nf.mpg.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4409 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20110807/d7a095b5/attachment.p7s>

More information about the MacOSX-Emacs mailing list