]> code.delx.au - gnu-emacs/commitdiff
(ucs-normalize-version): Changed to 1.1.
authorKenichi Handa <handa@m17n.org>
Tue, 18 Aug 2009 01:26:28 +0000 (01:26 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 18 Aug 2009 01:26:28 +0000 (01:26 +0000)
(ucs-normalize-hfs-nfd-pre-write-conversion): New function.
(utf-8-hfs): Make it perform normalization on encoding too.

lisp/ChangeLog
lisp/international/ucs-normalize.el

index cc083c22aae2380660440e53228f9e0d39161395..876e322c36e4d6e87fbb6d211d8bc323c8129997 100644 (file)
@@ -1,5 +1,10 @@
 2009-08-18  Kenichi Handa  <handa@m17n.org>
 
+       * international/ucs-normalize.el (ucs-normalize-version): Changed
+       to 1.1.
+       (ucs-normalize-hfs-nfd-pre-write-conversion): New function.
+       (utf-8-hfs): Make it perform normalization on encoding too.
+
        * textmodes/paragraphs.el: Change to utf-8.  Adjust coding cookie.
        (sentence-end-without-space): Delete duplicated chars.
        (sentence-end-base): Likewise.
index 0c0f162efb248b8c094b0baef41069c8dcd0f6b4..22f0ca93eeba9011df770ca3b8ded579248eb688 100644 (file)
 
 ;;; Code:
 
-(defconst ucs-normalize-version "1.1beta2")
+(defconst ucs-normalize-version "1.1")
 
 (eval-when-compile (require 'cl))
 
@@ -589,19 +589,26 @@ COMPOSITION-PREDICATE will be used to compose region."
         (ucs-normalize-HFS-NFC-region (point-min) (point-max))
         (- (point-max) (point-min))))))
 
+;; Pre-write conversion for `utf-8-hfs'.
+(defun ucs-normalize-hfs-nfd-pre-write-conversion (from to)
+  (let ((old-buf (current-buffer)))
+    (set-buffer (generate-new-buffer " *temp*"))
+    (if (stringp from) 
+        (insert from)
+      (insert-buffer-substring old-buf from to))
+    (ucs-normalize-HFS-NFD-region (point-min) (point-max))
+    nil))
+
 ;;; coding-system definition
 (define-coding-system 'utf-8-hfs
-  "UTF-8 base coding system with normalization on decoding.
+  "UTF-8 based coding system for MacOS HFS file names.
 The singleton characters in HFS normalization exclusion will not
-be decomposed.  It doesn't perform normalization on encoding."
+be decomposed."
   :coding-type 'utf-8
   :mnemonic ?U
   :charset-list '(unicode)
-  ;; :decode-translation-table (not necessary)
   :post-read-conversion 'ucs-normalize-hfs-nfd-post-read-conversion
-  ;; NFD encoder is not necessary because MacOS will automatically do it.
-  ;; :encode-translation-table 'nfd-encode-translation-table
-  ;; :pre-write-conversion 'nfd-encode-function
+  :pre-write-conversion 'ucs-normalize-hfs-nfd-pre-write-conversion
   )
 
 (provide 'ucs-normalize)