Commit e74d7926 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

(detect-coding-with-priority): Restore the internal database.

parent d645aaa4
......@@ -258,13 +258,19 @@ or one is an alias of the other."
"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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment