-;;; mule-util.el --- utility functions for mulitilingual environment (mule)
+;;; mule-util.el --- utility functions for multilingual environment (mule)
-;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008, 2009, 2010 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
+;; 2005, 2006, 2007, 2008, 2009, 2010, 2011
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H14PRO021
;; Copyright (C) 2003
;;; 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."
(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.
;;;###autoload
(defmacro with-coding-priority (coding-systems &rest body)
"Execute BODY like `progn' with CODING-SYSTEMS at the front of priority list.
-CODING-SYSTEMS is a list of coding systems. See `set-coding-priority'.
-This affects the implicit sorting of lists of coding sysems returned by
+CODING-SYSTEMS is a list of coding systems. See `set-coding-system-priority'.
+This affects the implicit sorting of lists of coding systems returned by
operations such as `find-coding-systems-region'."
(let ((current (make-symbol "current")))
`(let ((,current (coding-system-priority-list)))
(unwind-protect
(progn ,@body)
(apply #'set-coding-system-priority ,current)))))
-(put 'with-coding-priority 'lisp-indent-function 1)
+;;;###autoload(put 'with-coding-priority 'lisp-indent-function 1)
(put 'with-coding-priority 'edebug-form-spec t)
;;;###autoload
"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)
(provide 'mule-util)
;; Local Variables:
-;; coding: iso-2022-7bit
+;; coding: utf-8
;; End:
-;; arch-tag: 5bdb52b6-a3a5-4529-b7a0-37d01b0e570b
;;; mule-util.el ends here