emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el,v


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/lisp/international/mule-cmds.el,v
Date: Fri, 01 Aug 2008 12:46:31 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kenichi Handa <handa>   08/08/01 12:46:31

Index: mule-cmds.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/international/mule-cmds.el,v
retrieving revision 1.336
retrieving revision 1.337
diff -u -b -r1.336 -r1.337
--- mule-cmds.el        31 Jul 2008 16:51:45 -0000      1.336
+++ mule-cmds.el        1 Aug 2008 12:46:30 -0000       1.337
@@ -2788,9 +2788,11 @@
      (function (lambda (x) (format "#x%02X" x))))
    str " "))
 
-(defun encode-coding-char (char coding-system)
+(defun encode-coding-char (char coding-system &optional charset)
   "Encode CHAR by CODING-SYSTEM and return the resulting string.
-If CODING-SYSTEM can't safely encode CHAR, return nil."
+If CODING-SYSTEM can't safely encode CHAR, return nil.
+The 3rd optional argument CHARSET, if non-nil, is a charset preferred
+on encoding."
   (let* ((str1 (string-as-multibyte (string char)))
         (str2 (string-as-multibyte (string char char)))
         (found (find-coding-systems-string str1))
@@ -2806,6 +2808,9 @@
        ;; string and two-char string, then check how many bytes at the
        ;; tail of both encoded strings are the same.
 
+       (when charset
+         (put-text-property 0 1 'charset charset str1)
+         (put-text-property 0 2 'charset charset str2))
        (setq enc1 (encode-coding-string str1 coding-system)
              i1 (length enc1)
              enc2 (encode-coding-string str2 coding-system)




reply via email to

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