]> code.delx.au - gnu-emacs/blobdiff - lisp/international/mule-util.el
Update copyright year to 2014 by running admin/update-copyright.
[gnu-emacs] / lisp / international / mule-util.el
index 7b152a47727c11ce04a129ed5a2c488078f4ac51..efafb96538b5ad30bc0f21b8d57303b4bacda97b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mule-util.el --- utility functions for multilingual environment (mule)
 
-;; Copyright (C) 1997-1998, 2000-201 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2014 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;; String manipulations while paying attention to multibyte
 ;;; characters.
 
-;;;###autoload
-(defun string-to-sequence (string type)
-  "Convert STRING to a sequence of TYPE which contains characters in STRING.
-TYPE should be `list' or `vector'."
-;;;  (let ((len (length string))
-;;;       (i 0)
-;;;       val)
-    (cond ((eq type 'list)
-          ;; Applicable post-Emacs 20.2 and asymptotically ~10 times
-          ;; faster than the code below:
-          (append string nil))
-;;;       (setq val (make-list len 0))
-;;;       (let ((l val))
-;;;         (while (< i len)
-;;;           (setcar l (aref string i))
-;;;           (setq l (cdr l) i (1+ i))))))
-         ((eq type 'vector)
-          ;; As above.
-          (vconcat string))
-;;;       (setq val (make-vector len 0))
-;;;       (while (< i len)
-;;;         (aset val i (aref string i))
-;;;         (setq i (1+ i))))
-         (t
-          (error "Invalid type: %s" type)))
-;;;    val)
-)
-
-;;;###autoload
-(make-obsolete 'string-to-sequence
-              "use `string-to-list' or `string-to-vector'."
-              "22.1")
-
 ;;;###autoload
 (defsubst string-to-list (string)
   "Return a list of characters in STRING."
@@ -158,59 +125,6 @@ defaults to \"...\"."
       (concat head-padding (substring str from-idx idx)
              tail-padding ellipsis))))
 
-;;; Test suite for truncate-string-to-width
-;; (dolist (test '((("" 0) . "")
-;;             (("x" 1) . "x")
-;;             (("xy" 1) . "x")
-;;             (("xy" 2 1) . "y")
-;;             (("xy" 0) . "")
-;;             (("xy" 3) . "xy")
-;;             (("\e$AVP\e(B" 0) . "")
-;;             (("\e$AVP\e(B" 1) . "")
-;;             (("\e$AVP\e(B" 2) . "\e$AVP\e(B")
-;;             (("\e$AVP\e(B" 1 nil ? ) . " ")
-;;             (("\e$AVPND\e(B" 3 1 ? ) . "  ")
-;;             (("x\e$AVP\e(Bx" 2) . "x")
-;;             (("x\e$AVP\e(Bx" 3) . "x\e$AVP\e(B")
-;;             (("x\e$AVP\e(Bx" 3) . "x\e$AVP\e(B")
-;;             (("x\e$AVP\e(Bx" 4 1) . "\e$AVP\e(Bx")
-;;             (("kor\e$(CGQ\e(Be\e$(C1[\e(Ban" 8 1 ? ) . "or\e$(CGQ\e(Be\e$(C1[\e(B")
-;;             (("kor\e$(CGQ\e(Be\e$(C1[\e(Ban" 7 2 ? ) . "r\e$(CGQ\e(Be ")
-;;             (("" 0 nil nil "...") . "")
-;;             (("x" 3 nil nil "...") . "x")
-;;             (("\e$AVP\e(B" 3 nil nil "...") . "\e$AVP\e(B")
-;;             (("foo" 3 nil nil "...") . "foo")
-;;             (("foo" 2 nil nil "...") . "fo") ;; XEmacs failure?
-;;             (("foobar" 6 0 nil "...") . "foobar")
-;;             (("foobarbaz" 6 nil nil "...") . "foo...")
-;;             (("foobarbaz" 7 2 nil "...") . "ob...")
-;;             (("foobarbaz" 9 3 nil "...") . "barbaz")
-;;             (("\e$A$3\e(Bh\e$A$s\e(Be\e$A$K\e(Bl\e$A$A\e(Bl\e$A$O\e(Bo" 15 1 ?  t) . " h\e$A$s\e(Be\e$A$K\e(Bl\e$A$A\e(Bl\e$A$O\e(Bo")
-;;             (("\e$A$3\e(Bh\e$A$s\e(Be\e$A$K\e(Bl\e$A$A\e(Bl\e$A$O\e(Bo" 14 1 ?  t) . " h\e$A$s\e(Be\e$A$K\e(Bl\e$A$A\e(B...")
-;;             (("x" 3 nil nil "\e$(Gemk#\e(B") . "x")
-;;             (("\e$AVP\e(B" 2 nil nil "\e$(Gemk#\e(B") . "\e$AVP\e(B")
-;;             (("\e$AVP\e(B" 1 nil ?x "\e$(Gemk#\e(B") . "x") ;; XEmacs error
-;;             (("\e$AVPND\e(B" 3 nil ?  "\e$(Gemk#\e(B") . "\e$AVP\e(B ") ;; XEmacs error
-;;             (("foobarbaz" 4 nil nil  "\e$(Gemk#\e(B") . "\e$(Gemk#\e(B")
-;;             (("foobarbaz" 5 nil nil  "\e$(Gemk#\e(B") . "f\e$(Gemk#\e(B")
-;;             (("foobarbaz" 6 nil nil  "\e$(Gemk#\e(B") . "fo\e$(Gemk#\e(B")
-;;             (("foobarbaz" 8 3 nil "\e$(Gemk#\e(B") . "b\e$(Gemk#\e(B")
-;;             (("\e$A$3\e(Bh\e$A$s\e(Be\e$A$K\e(Bl\e$A$A\e(Bl\e$A$O\e(Bo" 14 4 ?x "\e$AHU1>\e$(Gk#\e(B") . "xe\e$A$KHU1>\e$(Gk#\e(B")
-;;             (("\e$A$3\e(Bh\e$A$s\e(Be\e$A$K\e(Bl\e$A$A\e(Bl\e$A$O\e(Bo" 13 4 ?x "\e$AHU1>\e$(Gk#\e(B") . "xex\e$AHU1>\e$(Gk#\e(B")
-;;             ))
-;;   (let (ret)
-;;     (condition-case e
-;;     (setq ret (apply #'truncate-string-to-width (car test)))
-;;       (error (setq ret e)))
-;;     (unless (equal ret (cdr test))
-;;       (error "%s: expected %s, got %s"
-;;          (prin1-to-string (cons 'truncate-string-to-width (car test)))
-;;          (prin1-to-string (cdr test))
-;;          (if (consp ret)
-;;              (format "error: %s: %s" (car ret)
-;;                      (prin1-to-string (cdr ret)))
-;;            (prin1-to-string ret))))))
-
 \f
 ;;; Nested alist handler.  Nested alist is alist whose elements are
 ;;; also nested alist.
@@ -330,10 +244,9 @@ operations such as `find-coding-systems-region'."
   "Detect a coding system of the text between FROM and TO with PRIORITY-LIST.
 PRIORITY-LIST is an alist of coding categories vs the corresponding
 coding systems ordered by priority."
+  (declare (obsolete with-coding-priority "23.1"))
   `(with-coding-priority (mapcar #'cdr ,priority-list)
      (detect-coding-region ,from ,to)))
-(make-obsolete 'detect-coding-with-priority
-              "use `with-coding-priority' and `detect-coding-region'." "23.1")
 
 ;;;###autoload
 (defun detect-coding-with-language-environment (from to lang-env)
@@ -401,7 +314,7 @@ per-character basis, this may not be accurate."
 (provide 'mule-util)
 
 ;; Local Variables:
-;; coding: iso-2022-7bit
+;; coding: utf-8
 ;; End:
 
 ;;; mule-util.el ends here