comparison lisp/mule/mule-misc.el @ 207:e45d5e7c476e r20-4b2

Import from CVS: tag r20-4b2
author cvs
date Mon, 13 Aug 2007 10:03:52 +0200
parents 6075d714658b
children
comparison
equal deleted inserted replaced
206:d3e9274cbc4e 207:e45d5e7c476e
1 ;; mule-misc.el --- Miscellaneous Mule functions. 1 ;; mule-misc.el --- Miscellaneous Mule functions.
2 2
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
3 ;; Copyright (C) 1992,93,94,95 Free Software Foundation, Inc. 5 ;; Copyright (C) 1992,93,94,95 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Amdahl Corporation. 6 ;; Copyright (C) 1995 Amdahl Corporation.
5 ;; Copyright (C) 1995 Sun Microsystems. 7 ;; Copyright (C) 1995 Sun Microsystems.
6 8
7 ;; This file is part of XEmacs. 9 ;; This file is part of XEmacs.
188 "Return a list of charsets except ascii in the region between START and END. 190 "Return a list of charsets except ascii in the region between START and END.
189 It might be available for compatibility with Mule 2.3, 191 It might be available for compatibility with Mule 2.3,
190 because its `find-charset-string' ignores ASCII charset." 192 because its `find-charset-string' ignores ASCII charset."
191 (delq 'ascii (charsets-in-region start end))) 193 (delq 'ascii (charsets-in-region start end)))
192 194
195 (defun split-char (char)
196 "Return list of charset and one or two position-codes of CHAR."
197 (let ((charset (char-charset char)))
198 (if (eq charset 'ascii)
199 (list charset char)
200 (let ((i 0)
201 (len (charset-dimension charset))
202 (code (if (integerp char)
203 char
204 (char-int char)))
205 dest)
206 (while (< i len)
207 (setq dest (cons (logand code 127) dest)
208 code (lsh code -7)
209 i (1+ i)))
210 (cons charset dest)
211 ))))
212
213
214 ;;; Commands
215
216 (defun set-buffer-process-coding-system (decoding encoding)
217 "Set coding systems for the process associated with the current buffer.
218 DECODING is the coding system to be used to decode input from the process,
219 ENCODING is the coding system to be used to encode output to the process.
220
221 For a list of possible values of CODING-SYSTEM, use \\[list-coding-systems]."
222 (interactive
223 "zCoding-system for process input: \nzCoding-system for process output: ")
224 (let ((proc (get-buffer-process (current-buffer))))
225 (if (null proc)
226 (error "no process")
227 (check-coding-system decoding)
228 (check-coding-system encoding)
229 (set-process-coding-system proc decoding encoding)))
230 (force-mode-line-update))
231
193 232
194 ;;; Language environments 233 ;;; Language environments
195 234
196 (defvar current-language-environment nil) 235 ;; (defvar current-language-environment nil)
197 236
198 (defvar language-environment-list nil) 237 ;; (defvar language-environment-list nil)
199 238
200 (defun current-language-environment () 239 ;; (defun current-language-environment ()
201 "Return the current language environment as a symbol. 240 ;; "Return the current language environment as a symbol.
202 Returns nil if `set-language-environment' has not been called." 241 ;; Returns nil if `set-language-environment' has not been called."
203 current-language-environment) 242 ;; current-language-environment)
204 243
205 (defun language-environment-list () 244 ;; (defun language-environment-list ()
206 "Return a list of all currently defined language environments." 245 ;; "Return a list of all currently defined language environments."
207 language-environment-list) 246 ;; language-environment-list)
208 247
209 (defun language-environment-p (sym) 248 ;; (defun language-environment-p (sym)
210 "True if SYM names a defined language environment." 249 ;; "True if SYM names a defined language environment."
211 (memq sym (language-environment-list))) 250 ;; (memq sym (language-environment-list)))
212 251
213 (defun set-language-environment (env) 252 ;; (defun set-language-environment (env)
214 "Set the current language environment to ENV." 253 ;; "Set the current language environment to ENV."
215 (interactive 254 ;; (interactive
216 (list (intern (completing-read "Language environment: " 255 ;; (list (intern (completing-read "Language environment: "
217 obarray 'language-environment-p 256 ;; obarray 'language-environment-p
218 'require-match)))) 257 ;; 'require-match))))
219 (when (not (string= (charset-registry 'ascii) "iso8859-1")) 258 ;; (when (not (string= (charset-registry 'ascii) "iso8859-1"))
220 (set-charset-registry 'ascii "iso8859-1")) 259 ;; (set-charset-registry 'ascii "iso8859-1"))
221 (let ((func (get env 'set-lang-environ))) 260 ;; (let ((func (get env 'set-lang-environ)))
222 (if (not (null func)) 261 ;; (if (not (null func))
223 (funcall func))) 262 ;; (funcall func)))
224 (setq current-language-environment env) 263 ;; (setq current-language-environment env)
225 (if (featurep 'egg) 264 ;; (if (featurep 'egg)
226 (egg-lang-switch-callback)) 265 ;; (egg-lang-switch-callback))
227 ;; (if (featurep 'quail) 266 ;; ;; (if (featurep 'quail)
228 ;; (quail-lang-switch-callback)) 267 ;; ;; (quail-lang-switch-callback))
229 ) 268 ;; )
230 269
231 (defun define-language-environment (env-sym doc-string enable-function) 270 ;; (defun define-language-environment (env-sym doc-string enable-function)
232 "Define a new language environment, named by ENV-SYM. 271 ;; "Define a new language environment, named by ENV-SYM.
233 DOC-STRING should be a string describing the environment. 272 ;; DOC-STRING should be a string describing the environment.
234 ENABLE-FUNCTION should be a function of no arguments that will be called 273 ;; ENABLE-FUNCTION should be a function of no arguments that will be called
235 when the language environment is made current." 274 ;; when the language environment is made current."
236 (put env-sym 'lang-environ-doc-string doc-string) 275 ;; (put env-sym 'lang-environ-doc-string doc-string)
237 (put env-sym 'set-lang-environ enable-function) 276 ;; (put env-sym 'set-lang-environ enable-function)
238 (setq language-environment-list (cons env-sym language-environment-list))) 277 ;; (setq language-environment-list (cons env-sym language-environment-list)))
239 278
240 (defun define-egg-environment (env-sym doc-string enable-function) 279 (defun define-egg-environment (env-sym doc-string enable-function)
241 "Define a new language environment for egg, named by ENV-SYM. 280 "Define a new language environment for egg, named by ENV-SYM.
242 DOC-STRING should be a string describing the environment. 281 DOC-STRING should be a string describing the environment.
243 ENABLE-FUNCTION should be a function of no arguments that will be called 282 ENABLE-FUNCTION should be a function of no arguments that will be called
244 when the language environment is made current." 283 when the language environment is made current."
245 (put env-sym 'egg-environ-doc-string doc-string) 284 (put env-sym 'egg-environ-doc-string doc-string)
246 (put env-sym 'set-egg-environ enable-function)) 285 (put env-sym 'set-egg-environ enable-function))
247 286
248 (defun define-quail-environment (env-sym doc-string enable-function) 287 ;; (defun define-quail-environment (env-sym doc-string enable-function)
249 "Define a new language environment for quail, named by ENV-SYM. 288 ;; "Define a new language environment for quail, named by ENV-SYM.
250 DOC-STRING should be a string describing the environment. 289 ;; DOC-STRING should be a string describing the environment.
251 ENABLE-FUNCTION should be a function of no arguments that will be called 290 ;; ENABLE-FUNCTION should be a function of no arguments that will be called
252 when the language environment is made current." 291 ;; when the language environment is made current."
253 (put env-sym 'quail-environ-doc-string doc-string) 292 ;; (put env-sym 'quail-environ-doc-string doc-string)
254 (put env-sym 'set-quail-environ enable-function)) 293 ;; (put env-sym 'set-quail-environ enable-function))
255 294
295 ;;; mule-misc.el ends here