changeset 24485:ab39ea2168e7

(detect-coding-with-priority): Restore the internal database.
author Kenichi Handa <handa@m17n.org>
date Mon, 15 Mar 1999 00:51:20 +0000
parents d4ee4399e999
children 8c7fdc02cb78
files lisp/international/mule-util.el
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/international/mule-util.el	Mon Mar 15 00:11:22 1999 +0000
+++ b/lisp/international/mule-util.el	Mon Mar 15 00:51:20 1999 +0000
@@ -258,13 +258,19 @@
   "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."
-  `(let* ((prio-list ,priority-list)
-	  (coding-category-list coding-category-list)
-	  ,@(mapcar (function (lambda (x) (list x x))) coding-category-list))
-     (mapcar (function (lambda (x) (set (car x) (cdr x))))
-	     prio-list)
-     (set-coding-priority (mapcar (function (lambda (x) (car x))) prio-list))
-     (detect-coding-region ,from ,to)))
+  `(unwind-protect
+       (let* ((prio-list ,priority-list)
+	      (coding-category-list coding-category-list)
+	      ,@(mapcar (function (lambda (x) (list x x)))
+			coding-category-list))
+	 (mapcar (function (lambda (x) (set (car x) (cdr x))))
+		 prio-list)
+	 (set-coding-priority (mapcar (function (lambda (x) (car x)))
+				      prio-list))
+	 (detect-coding-region ,from ,to))
+     ;; We must restore the internal database.
+     (set-coding-priority coding-category-list)
+     (update-coding-systems-internal)))
 
 ;;;###autoload
 (defun detect-coding-with-language-environment (from to lang-env)