From 0c3154d204ceee8ebcc33630baa7f7d11693557a Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Sun, 10 Aug 1997 04:07:03 +0000 Subject: [PATCH] (set-default-coding-systems): Doc-string modified. (prefer-coding-system): Moved from mule-util.el. Call set-default-coding-systems. --- lisp/international/mule-cmds.el | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 6169b1fe5a8..925e705d7aa 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -177,13 +177,44 @@ With arg, make them enable iff arg is positive." (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. -- 2.39.2