diff options
author | Anders Lindgren <andlind@gmail.com> | 2015-12-24 09:50:26 +0100 |
---|---|---|
committer | Anders Lindgren <andlind@gmail.com> | 2015-12-24 09:50:26 +0100 |
commit | d107eda498f94423d846b0e2f1be7facab417b2a (patch) | |
tree | a6445cb96041c22579a12507deed013ede4724fc /src | |
parent | 076172ba824783636094bbe7a63018c07077733c (diff) | |
download | emacs-d107eda498f94423d846b0e2f1be7facab417b2a.tar.gz |
; Revert "File-name completion of non-ASCII characters on OS X (bug#22169)"
; This reverts commit 09053075225fec8a6cf7a72017a6dfc1ec6b6f0c.
; This caused a build from scratch to fail.
Diffstat (limited to 'src')
-rw-r--r-- | src/nsfns.m | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/nsfns.m b/src/nsfns.m index 5fa68c0a15c..edc02e8350b 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2099,6 +2099,39 @@ there was no result. */) } +DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc, + Sns_convert_utf8_nfd_to_nfc, 1, 1, 0, + doc: /* Return an NFC string that matches the UTF-8 NFD string STR. */) + (Lisp_Object str) +{ +/* TODO: If GNUstep ever implements precomposedStringWithCanonicalMapping, + remove this. */ + NSString *utfStr; + Lisp_Object ret = Qnil; + NSAutoreleasePool *pool; + + CHECK_STRING (str); + pool = [[NSAutoreleasePool alloc] init]; + utfStr = [NSString stringWithUTF8String: SSDATA (str)]; +#ifdef NS_IMPL_COCOA + if (utfStr) + utfStr = [utfStr precomposedStringWithCanonicalMapping]; +#endif + if (utfStr) + { + const char *cstr = [utfStr UTF8String]; + if (cstr) + ret = build_string (cstr); + } + + [pool release]; + if (NILP (ret)) + error ("Invalid UTF-8"); + + return ret; +} + + #ifdef NS_IMPL_COCOA /* Compile and execute the AppleScript SCRIPT and return the error @@ -3174,6 +3207,7 @@ be used as the image of the icon representing the frame. */); defsubr (&Sns_emacs_info_panel); defsubr (&Sns_list_services); defsubr (&Sns_perform_service); + defsubr (&Sns_convert_utf8_nfd_to_nfc); defsubr (&Sns_popup_font_panel); defsubr (&Sns_popup_color_panel); |