# HG changeset patch # User Kenichi Handa # Date 871186023 0 # Node ID 6e152439176f9af819de8c0d7a01acb5165cd275 # Parent a042f26b7a4c26a5c1a3ab0c4c7f379a899b9a9f (set-default-coding-systems): Doc-string modified. (prefer-coding-system): Moved from mule-util.el. Call set-default-coding-systems. diff -r a042f26b7a4c -r 6e152439176f lisp/international/mule-cmds.el --- a/lisp/international/mule-cmds.el Sun Aug 10 04:07:03 1997 +0000 +++ b/lisp/international/mule-cmds.el Sun Aug 10 04:07:03 1997 +0000 @@ -177,13 +177,44 @@ (call-interactively cmd)))) (defun set-default-coding-systems (coding-system) - "Set default value of various coding systems to CODING-SYSTEM." + "Set default value of various coding systems to CODING-SYSTEM. +The follwing coding systems are set: + o coding system of a newly created buffer + o default coding system for terminal output + o default coding system for keyboard input + o default coding system for subprocess I/O" (check-coding-system coding-system) (setq-default buffer-file-coding-system coding-system) (setq default-terminal-coding-system coding-system) (setq default-keyboard-coding-system coding-system) (setq default-process-coding-system (cons coding-system coding-system))) +(defun prefer-coding-system (coding-system) + "Add CODING-SYSTEM at the front of the priority list for automatic detection. +This also sets the following coding systems to CODING-SYSTEM: + o coding system of a newly created buffer + o default coding system for terminal output + o default coding system for keyboard input + o default coding system for subprocess I/O" + (interactive "zPrefer coding system: ") + (if (not (and coding-system (coding-system-p coding-system))) + (error "Invalid coding system `%s'" coding-system)) + (let ((coding-category (coding-system-category coding-system)) + (parent (coding-system-parent coding-system))) + (if (not coding-category) + ;; CODING-SYSTEM is no-conversion or undecided. + (error "Can't prefer the coding system `%s'" coding-system)) + (set coding-category (or parent coding-system)) + (if (not (eq coding-category (car coding-category-list))) + ;; We must change the order. + (setq coding-category-list + (cons coding-category + (delq coding-category coding-category-list)))) + (if (and parent (interactive-p)) + (message "Highest priority is set to %s (parent of %s)" + parent coding-system)) + (set-default-coding-systems (or parent coding-system)))) + ;;; Language support staffs.