emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp/international ucs-normalize.el


From: Kenichi Handa
Subject: [Emacs-diffs] emacs/lisp/international ucs-normalize.el
Date: Tue, 18 Aug 2009 01:26:05 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kenichi Handa <handa>   09/08/18 01:26:05

Modified files:
        lisp/international: ucs-normalize.el 

Log message:
        (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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/international/ucs-normalize.el?cvsroot=emacs&r1=1.3&r2=1.4

Patches:
Index: ucs-normalize.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/international/ucs-normalize.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- ucs-normalize.el    14 Aug 2009 09:38:13 -0000      1.3
+++ ucs-normalize.el    18 Aug 2009 01:26:05 -0000      1.4
@@ -108,7 +108,7 @@
 
 ;;; Code:
 
-(defconst ucs-normalize-version "1.1beta2")
+(defconst ucs-normalize-version "1.1")
 
 (eval-when-compile (require 'cl))
 
@@ -589,19 +589,26 @@
         (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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]