Mercurial > emacs
comparison lisp/international/mule-util.el @ 19264:6122dbba797f
(prefer-coding-system): Moved to mule-util.el.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sun, 10 Aug 1997 04:07:03 +0000 |
parents | 3c63e633c40c |
children | 7cf3d42a6fd7 |
comparison
equal
deleted
inserted
replaced
19263:9d34beb088bf | 19264:6122dbba797f |
---|---|
316 or one is an alias of the other." | 316 or one is an alias of the other." |
317 (or (eq coding-system-1 coding-system-2) | 317 (or (eq coding-system-1 coding-system-2) |
318 (equal (coding-system-plist coding-system-1) | 318 (equal (coding-system-plist coding-system-1) |
319 (coding-system-plist coding-system-2)))) | 319 (coding-system-plist coding-system-2)))) |
320 | 320 |
321 ;;;###autoload | |
322 (defun prefer-coding-system (coding-system) | |
323 "Add CODING-SYSTEM at the front of the priority list for automatic detection." | |
324 (interactive "zPrefer coding system: ") | |
325 (if (not (and coding-system (coding-system-p coding-system))) | |
326 (error "Invalid coding system `%s'" coding-system)) | |
327 (let ((coding-category (coding-system-category coding-system)) | |
328 (parent (coding-system-parent coding-system))) | |
329 (if (not coding-category) | |
330 ;; CODING-SYSTEM is no-conversion or undecided. | |
331 (error "Can't prefer the coding system `%s'" coding-system)) | |
332 (set coding-category (or parent coding-system)) | |
333 (if (not (eq coding-category (car coding-category-list))) | |
334 ;; We must change the order. | |
335 (setq coding-category-list | |
336 (cons coding-category | |
337 (delq coding-category coding-category-list)))) | |
338 (if (and parent (interactive-p)) | |
339 (message "Highest priority is set to %s (parent of %s)" | |
340 parent coding-system)) | |
341 (setq-default buffer-file-coding-system (or parent coding-system)))) | |
342 | |
343 | 321 |
344 ;;; Composite charcater manipulations. | 322 ;;; Composite charcater manipulations. |
345 | 323 |
346 ;;;###autoload | 324 ;;;###autoload |
347 (defun compose-region (start end) | 325 (defun compose-region (start end) |
371 p ch str) | 349 p ch str) |
372 (while (re-search-forward re-cmpchar nil t) | 350 (while (re-search-forward re-cmpchar nil t) |
373 (setq str (buffer-substring (match-beginning 0) (match-end 0))) | 351 (setq str (buffer-substring (match-beginning 0) (match-end 0))) |
374 (delete-region (match-beginning 0) (match-end 0)) | 352 (delete-region (match-beginning 0) (match-end 0)) |
375 (insert (decompose-composite-char (string-to-char str))))))) | 353 (insert (decompose-composite-char (string-to-char str))))))) |
354 | |
355 ;;;###autoload | |
356 (defun decompose-string (string) | |
357 "Decompose all composite characters in STRING." | |
358 (let* ((l (string-to-list string)) | |
359 (tail l) | |
360 ch) | |
361 (while tail | |
362 (setq ch (car tail)) | |
363 (setcar tail (if (cmpcharp ch) (decompose-composite-char ch) | |
364 (char-to-string ch))) | |
365 (setq tail (cdr tail))) | |
366 (apply 'concat l))) | |
376 | 367 |
377 ;;;###autoload | 368 ;;;###autoload |
378 (defconst reference-point-alist | 369 (defconst reference-point-alist |
379 '((tl . 0) (tc . 1) (tr . 2) | 370 '((tl . 0) (tc . 1) (tr . 2) |
380 (ml . 3) (mc . 4) (mr . 5) | 371 (ml . 3) (mc . 4) (mr . 5) |