aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/international/mule-util.el33
1 files changed, 21 insertions, 12 deletions
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index e962c9be19a..9bdb4843e80 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -235,22 +235,22 @@ Optional 3rd argument NIL-FOR-TOO-LONG non-nil means return nil
235;;;###autoload 235;;;###autoload
236(defun coding-system-post-read-conversion (coding-system) 236(defun coding-system-post-read-conversion (coding-system)
237 "Return the value of CODING-SYSTEM's `post-read-conversion' property." 237 "Return the value of CODING-SYSTEM's `post-read-conversion' property."
238 (coding-system-get coding-system 'post-read-conversion)) 238 (coding-system-get coding-system :post-read-conversion))
239 239
240;;;###autoload 240;;;###autoload
241(defun coding-system-pre-write-conversion (coding-system) 241(defun coding-system-pre-write-conversion (coding-system)
242 "Return the value of CODING-SYSTEM's `pre-write-conversion' property." 242 "Return the value of CODING-SYSTEM's `pre-write-conversion' property."
243 (coding-system-get coding-system 'pre-write-conversion)) 243 (coding-system-get coding-system :pre-write-conversion))
244 244
245;;;###autoload 245;;;###autoload
246(defun coding-system-translation-table-for-decode (coding-system) 246(defun coding-system-translation-table-for-decode (coding-system)
247 "Return the value of CODING-SYSTEM's `translation-table-for-decode' property." 247 "Return the value of CODING-SYSTEM's `translation-table-for-decode' property."
248 (coding-system-get coding-system 'translation-table-for-decode)) 248 (coding-system-get coding-system :decode-translation-table))
249 249
250;;;###autoload 250;;;###autoload
251(defun coding-system-translation-table-for-encode (coding-system) 251(defun coding-system-translation-table-for-encode (coding-system)
252 "Return the value of CODING-SYSTEM's `translation-table-for-encode' property." 252 "Return the value of CODING-SYSTEM's `translation-table-for-encode' property."
253 (coding-system-get coding-system 'translation-table-for-encode)) 253 (coding-system-get coding-system :encode-translation-table))
254 254
255;;;###autoload 255;;;###autoload
256(defun coding-system-equal (coding-system-1 coding-system-2) 256(defun coding-system-equal (coding-system-1 coding-system-2)
@@ -258,13 +258,14 @@ Optional 3rd argument NIL-FOR-TOO-LONG non-nil means return nil
258Two coding systems are identical if two symbols are equal 258Two coding systems are identical if two symbols are equal
259or one is an alias of the other." 259or one is an alias of the other."
260 (or (eq coding-system-1 coding-system-2) 260 (or (eq coding-system-1 coding-system-2)
261 (and (equal (coding-system-spec coding-system-1) 261 (and (equal (coding-system-plist coding-system-1)
262 (coding-system-spec coding-system-2)) 262 (coding-system-plist coding-system-2))
263 (let ((eol-type-1 (coding-system-eol-type coding-system-1)) 263 (let ((eol-type-1 (coding-system-eol-type coding-system-1))
264 (eol-type-2 (coding-system-eol-type coding-system-2))) 264 (eol-type-2 (coding-system-eol-type coding-system-2)))
265 (or (eq eol-type-1 eol-type-2) 265 (or (eq eol-type-1 eol-type-2)
266 (and (vectorp eol-type-1) (vectorp eol-type-2))))))) 266 (and (vectorp eol-type-1) (vectorp eol-type-2)))))))
267 267
268;; Fixme: delete this?
268;;;###autoload 269;;;###autoload
269(defmacro detect-coding-with-priority (from to priority-list) 270(defmacro detect-coding-with-priority (from to priority-list)
270 "Detect a coding system of the text between FROM and TO with PRIORITY-LIST. 271 "Detect a coding system of the text between FROM and TO with PRIORITY-LIST.
@@ -290,13 +291,21 @@ The detection takes into account the coding system priorities for the
290language environment LANG-ENV." 291language environment LANG-ENV."
291 (let ((coding-priority (get-language-info lang-env 'coding-priority))) 292 (let ((coding-priority (get-language-info lang-env 'coding-priority)))
292 (if coding-priority 293 (if coding-priority
293 (detect-coding-with-priority 294 (with-coding-priority coding-priority
294 from to 295 (detect-coding-region from to)))))
295 (mapcar (function (lambda (x)
296 (cons (coding-system-get x 'coding-category) x)))
297 coding-priority))
298 (detect-coding-region from to))))
299 296
297;;;###autoload
298(defmacro with-coding-priority (coding-systems &rest body)
299 "Execute BODY like `progn' with CODING-SYSTEMS at the front of priority list.
300CODING-SYSTEMS is a list of coding systems."
301 (let ((current (make-symbol "current")))
302 `(let ((,current (coding-system-priorities)))
303 (apply #'set-coding-priority ,coding-systems)
304 (unwind-protect
305 (progn ,@body)
306 (set-coding-priority ,current)))))
307(put 'with-coding-priority 'lisp-indent-function 1)
308(put 'with-coding-priority 'edebug-form-spec t)
300 309
301(provide 'mule-util) 310(provide 'mule-util)
302 311