diff options
| author | Kenichi Handa | 1997-08-10 04:07:03 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-08-10 04:07:03 +0000 |
| commit | 0c3154d204ceee8ebcc33630baa7f7d11693557a (patch) | |
| tree | 63a41174d2bbf566023b0165ac738076c71ecb33 /lisp | |
| parent | f6eb8ace4f205a3d6cb8d9a638b6e540a57e56bf (diff) | |
| download | emacs-0c3154d204ceee8ebcc33630baa7f7d11693557a.tar.gz emacs-0c3154d204ceee8ebcc33630baa7f7d11693557a.zip | |
(set-default-coding-systems):
Doc-string modified.
(prefer-coding-system): Moved from mule-util.el. Call
set-default-coding-systems.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/international/mule-cmds.el | 33 |
1 files changed, 32 insertions, 1 deletions
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." | |||
| 177 | (call-interactively cmd)))) | 177 | (call-interactively cmd)))) |
| 178 | 178 | ||
| 179 | (defun set-default-coding-systems (coding-system) | 179 | (defun set-default-coding-systems (coding-system) |
| 180 | "Set default value of various coding systems to CODING-SYSTEM." | 180 | "Set default value of various coding systems to CODING-SYSTEM. |
| 181 | The follwing coding systems are set: | ||
| 182 | o coding system of a newly created buffer | ||
| 183 | o default coding system for terminal output | ||
| 184 | o default coding system for keyboard input | ||
| 185 | o default coding system for subprocess I/O" | ||
| 181 | (check-coding-system coding-system) | 186 | (check-coding-system coding-system) |
| 182 | (setq-default buffer-file-coding-system coding-system) | 187 | (setq-default buffer-file-coding-system coding-system) |
| 183 | (setq default-terminal-coding-system coding-system) | 188 | (setq default-terminal-coding-system coding-system) |
| 184 | (setq default-keyboard-coding-system coding-system) | 189 | (setq default-keyboard-coding-system coding-system) |
| 185 | (setq default-process-coding-system (cons coding-system coding-system))) | 190 | (setq default-process-coding-system (cons coding-system coding-system))) |
| 186 | 191 | ||
| 192 | (defun prefer-coding-system (coding-system) | ||
| 193 | "Add CODING-SYSTEM at the front of the priority list for automatic detection. | ||
| 194 | This also sets the following coding systems to CODING-SYSTEM: | ||
| 195 | o coding system of a newly created buffer | ||
| 196 | o default coding system for terminal output | ||
| 197 | o default coding system for keyboard input | ||
| 198 | o default coding system for subprocess I/O" | ||
| 199 | (interactive "zPrefer coding system: ") | ||
| 200 | (if (not (and coding-system (coding-system-p coding-system))) | ||
| 201 | (error "Invalid coding system `%s'" coding-system)) | ||
| 202 | (let ((coding-category (coding-system-category coding-system)) | ||
| 203 | (parent (coding-system-parent coding-system))) | ||
| 204 | (if (not coding-category) | ||
| 205 | ;; CODING-SYSTEM is no-conversion or undecided. | ||
| 206 | (error "Can't prefer the coding system `%s'" coding-system)) | ||
| 207 | (set coding-category (or parent coding-system)) | ||
| 208 | (if (not (eq coding-category (car coding-category-list))) | ||
| 209 | ;; We must change the order. | ||
| 210 | (setq coding-category-list | ||
| 211 | (cons coding-category | ||
| 212 | (delq coding-category coding-category-list)))) | ||
| 213 | (if (and parent (interactive-p)) | ||
| 214 | (message "Highest priority is set to %s (parent of %s)" | ||
| 215 | parent coding-system)) | ||
| 216 | (set-default-coding-systems (or parent coding-system)))) | ||
| 217 | |||
| 187 | 218 | ||
| 188 | ;;; Language support staffs. | 219 | ;;; Language support staffs. |
| 189 | 220 | ||