Mercurial > emacs
changeset 88652:8b4e3bbe01d4
(coding-system-post-read-conversion)
(coding-system-pre-write-conversion)
(coding-system-translation-table-for-decode)
(coding-system-translation-table-for-encode): Get the right
properties.
(with-coding-priority): New macro.
(detect-coding-with-language-environment): Use it.
(coding-system-equal): Use coding-system-plist.
author | Dave Love <fx@gnu.org> |
---|---|
date | Sun, 26 May 2002 22:42:00 +0000 |
parents | ddc129ce7bc1 |
children | ab210513bef9 |
files | lisp/international/mule-util.el |
diffstat | 1 files changed, 21 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/international/mule-util.el Sun May 26 22:41:07 2002 +0000 +++ b/lisp/international/mule-util.el Sun May 26 22:42:00 2002 +0000 @@ -235,22 +235,22 @@ ;;;###autoload (defun coding-system-post-read-conversion (coding-system) "Return the value of CODING-SYSTEM's `post-read-conversion' property." - (coding-system-get coding-system 'post-read-conversion)) + (coding-system-get coding-system :post-read-conversion)) ;;;###autoload (defun coding-system-pre-write-conversion (coding-system) "Return the value of CODING-SYSTEM's `pre-write-conversion' property." - (coding-system-get coding-system 'pre-write-conversion)) + (coding-system-get coding-system :pre-write-conversion)) ;;;###autoload (defun coding-system-translation-table-for-decode (coding-system) "Return the value of CODING-SYSTEM's `translation-table-for-decode' property." - (coding-system-get coding-system 'translation-table-for-decode)) + (coding-system-get coding-system :decode-translation-table)) ;;;###autoload (defun coding-system-translation-table-for-encode (coding-system) "Return the value of CODING-SYSTEM's `translation-table-for-encode' property." - (coding-system-get coding-system 'translation-table-for-encode)) + (coding-system-get coding-system :encode-translation-table)) ;;;###autoload (defun coding-system-equal (coding-system-1 coding-system-2) @@ -258,13 +258,14 @@ Two coding systems are identical if two symbols are equal or one is an alias of the other." (or (eq coding-system-1 coding-system-2) - (and (equal (coding-system-spec coding-system-1) - (coding-system-spec coding-system-2)) + (and (equal (coding-system-plist coding-system-1) + (coding-system-plist coding-system-2)) (let ((eol-type-1 (coding-system-eol-type coding-system-1)) (eol-type-2 (coding-system-eol-type coding-system-2))) (or (eq eol-type-1 eol-type-2) (and (vectorp eol-type-1) (vectorp eol-type-2))))))) +;; Fixme: delete this? ;;;###autoload (defmacro detect-coding-with-priority (from to priority-list) "Detect a coding system of the text between FROM and TO with PRIORITY-LIST. @@ -290,13 +291,21 @@ language environment LANG-ENV." (let ((coding-priority (get-language-info lang-env 'coding-priority))) (if coding-priority - (detect-coding-with-priority - from to - (mapcar (function (lambda (x) - (cons (coding-system-get x 'coding-category) x))) - coding-priority)) - (detect-coding-region from to)))) + (with-coding-priority coding-priority + (detect-coding-region from to))))) +;;;###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." + (let ((current (make-symbol "current"))) + `(let ((,current (coding-system-priorities))) + (apply #'set-coding-priority ,coding-systems) + (unwind-protect + (progn ,@body) + (set-coding-priority ,current))))) +(put 'with-coding-priority 'lisp-indent-function 1) +(put 'with-coding-priority 'edebug-form-spec t) (provide 'mule-util)