aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1997-10-23 12:05:45 +0000
committerKenichi Handa1997-10-23 12:05:45 +0000
commita6acd8a293c4099a1659ee43e8164585fd4cf4ed (patch)
tree4b0a9ba592ad28b68e4d2bbdbdf23ac1e60ecffc
parent9a0eac6e7ac71e13395c61cb0fd801b897655939 (diff)
downloademacs-a6acd8a293c4099a1659ee43e8164585fd4cf4ed.tar.gz
emacs-a6acd8a293c4099a1659ee43e8164585fd4cf4ed.zip
(load-with-code-conversion): Update
preloaded-file-list, bind load-file-name and inhibit-frame-unsplittable properly. (make-char): Make it a function. Set it byte-compile property to optimize byte-compiled codes. (make-coding-system): New optional arg charsets. Set property `safe-charsets' of the coding system to it.
-rw-r--r--lisp/international/mule.el60
1 files changed, 44 insertions, 16 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 717a3494491..5111840a0c7 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -51,8 +51,11 @@ Return t if file exists."
51 (get-buffer-create (generate-new-buffer-name " *load*")))) 51 (get-buffer-create (generate-new-buffer-name " *load*"))))
52 (load-in-progress t)) 52 (load-in-progress t))
53 (or nomessage (message "Loading %s..." file)) 53 (or nomessage (message "Loading %s..." file))
54 (if purify-flag
55 (setq preloaded-file-list (cons file preloaded-file-list)))
54 (unwind-protect 56 (unwind-protect
55 (progn 57 (let ((load-file-name fullname)
58 (inhibit-file-name-operation nil))
56 (save-excursion 59 (save-excursion
57 (set-buffer buffer) 60 (set-buffer buffer)
58 ;; This is buffer-local. 61 ;; This is buffer-local.
@@ -220,15 +223,25 @@ See the function `charset-info' for more detail."
220 "Set CHARSET's property list to PLIST, and retrun PLIST." 223 "Set CHARSET's property list to PLIST, and retrun PLIST."
221 (aset (charset-info charset) 14 plist)) 224 (aset (charset-info charset) 14 plist))
222 225
223(defmacro make-char (charset &optional c1 c2) 226(defun make-char (charset &optional c1 c2)
224 "Return a character of CHARSET and position-codes CODE1 and CODE2. 227 "Return a character of CHARSET and position-codes CODE1 and CODE2.
225CODE1 and CODE2 are optional, but if you don't supply 228CODE1 and CODE2 are optional, but if you don't supply
226sufficient position-codes, return a generic character which stands for 229sufficient position-codes, return a generic character which stands for
227all characters or group of characters in the character sets. 230all characters or group of characters in the character sets.
228A generic character can be used to index a char table (e.g. syntax-table)." 231A generic character can be used to index a char table (e.g. syntax-table)."
229 (if (charset-quoted-standard-p charset) 232 (make-char-internal (charset-id charset) c1 c2))
230 `(make-char-internal ,(charset-id (nth 1 charset)) ,c1 ,c2) 233
231 `(make-char-internal (charset-id ,charset) ,c1 ,c2))) 234(put 'make-char 'byte-compile
235 (function
236 (lambda (form)
237 (let ((charset (nth 1 form)))
238 (if (charset-quoted-standard-p charset)
239 (byte-compile-normal-call
240 (cons 'make-char-internal
241 (cons (charset-id (nth 1 charset)) (nthcdr 2 form))))
242 (byte-compile-normal-call
243 (cons 'make-char-internal
244 (cons (list 'charset-id charset) (nthcdr 2 form)))))))))
232 245
233(defun charset-list () 246(defun charset-list ()
234 "Return list of charsets ever defined. 247 "Return list of charsets ever defined.
@@ -264,10 +277,10 @@ See also the documentation of make-char."
264(defconst coding-spec-plist-idx 3) 277(defconst coding-spec-plist-idx 3)
265(defconst coding-spec-flags-idx 4) 278(defconst coding-spec-flags-idx 4)
266 279
267;; PLIST is a property list of a coding system. A coding system has 280;; PLIST is a property list of a coding system. To share PLIST among
268;; PLIST in coding-spec instead of having it in normal proper list of 281;; alias coding systems, a coding system has PLIST in coding-spec
269;; Lisp symbol to share PLIST among alias coding systems. Here's a 282;; instead of having it in normal property list of Lisp symbol.
270;; list of properties to be held in PLIST. 283;; Here's a list of coding system properties currently being used.
271;; 284;;
272;; o coding-category 285;; o coding-category
273;; 286;;
@@ -309,6 +322,16 @@ See also the documentation of make-char."
309;; o character-unification-table-for-encode 322;; o character-unification-table-for-encode
310;; 323;;
311;; The value is a unification table to be applied on encoding. 324;; The value is a unification table to be applied on encoding.
325;;
326;; o safe-charsets
327;;
328;; The value is a list of charsets safely supported by the coding
329;; system. The value t means that all charsets Emacs handles are
330;; supported. Even if some charset is not in this list, it doesn't
331;; mean that the charset can't be encoded in the coding system,
332;; instead, it just means that some other receiver of a text encoded
333;; in the coding system won't be able to handle that charset.
334
312 335
313;; Return coding-spec of CODING-SYSTEM 336;; Return coding-spec of CODING-SYSTEM
314(defsubst coding-system-spec (coding-system) 337(defsubst coding-system-spec (coding-system)
@@ -409,10 +432,11 @@ coding system whose eol-type is N."
409 subsidiaries)) 432 subsidiaries))
410 433
411(defun make-coding-system (coding-system type mnemonic doc-string 434(defun make-coding-system (coding-system type mnemonic doc-string
412 &optional flags) 435 &optional flags safe-charsets)
413 "Define a new CODING-SYSTEM (symbol). 436 "Define a new CODING-SYSTEM (symbol).
414Remaining arguments are TYPE, MNEMONIC, DOC-STRING, and FLAGS (optional) which 437Remaining arguments are TYPE, MNEMONIC, DOC-STRING, FLAGS (optional),
415construct a coding-spec of CODING-SYSTEM in the following format: 438and CHARSETS (optional) which construct a coding-spec of CODING-SYSTEM
439in the following format:
416 [TYPE MNEMONIC DOC-STRING PLIST FLAGS] 440 [TYPE MNEMONIC DOC-STRING PLIST FLAGS]
417TYPE is an integer value indicating the type of coding-system as follows: 441TYPE is an integer value indicating the type of coding-system as follows:
418 0: Emacs internal format, 442 0: Emacs internal format,
@@ -427,7 +451,10 @@ MNEMONIC is a character to be displayed on mode line for the coding-system.
427DOC-STRING is a documentation string for the coding-system. 451DOC-STRING is a documentation string for the coding-system.
428 452
429PLIST is the propert list for CODING-SYSTEM. This function sets 453PLIST is the propert list for CODING-SYSTEM. This function sets
430properties coding-category and alias-coding-systems. 454properties coding-category, alias-coding-systems, safe-charsets. The
455first two are set automatically. The last one is set to the argument
456SAFE-CHARSETS. SAFE-CHARSETS is a list of character sets encoded
457safely in CODING-SYSTEM, or t which means all character sets are safe.
431 458
432FLAGS specifies more precise information of each TYPE. 459FLAGS specifies more precise information of each TYPE.
433 460
@@ -455,8 +482,8 @@ FLAGS specifies more precise information of each TYPE.
455 to initial at each beginning of line on output. 482 to initial at each beginning of line on output.
456 DESIGNATION-BOL non-nil means designation sequences should be placed 483 DESIGNATION-BOL non-nil means designation sequences should be placed
457 at beginning of line on output. 484 at beginning of line on output.
458 SAFE non-nil means convert unexpected characters to `?' on output. 485 SAFE non-nil means convert unsafe characters to `?' on output.
459 Unexpected characters are what not specified in CHARSETn directly. 486 Unsafe characters are what not specified in SAFE-CHARSET.
460 ACCEPT-LATIN-EXTRA-CODE non-nil means code-detection routine accepts 487 ACCEPT-LATIN-EXTRA-CODE non-nil means code-detection routine accepts
461 a code specified in `latin-extra-code-table' (which see) as a valid 488 a code specified in `latin-extra-code-table' (which see) as a valid
462 code of the coding system. 489 code of the coding system.
@@ -542,7 +569,8 @@ FLAGS specifies more precise information of each TYPE.
542 (setq coding-category 'coding-category-raw-text))) 569 (setq coding-category 'coding-category-raw-text)))
543 570
544 (let ((plist (list 'coding-category coding-category 571 (let ((plist (list 'coding-category coding-category
545 'alias-coding-systems (list coding-system)))) 572 'alias-coding-systems (list coding-system)
573 'safe-charsets safe-charsets)))
546 (if no-initial-designation 574 (if no-initial-designation
547 (setq plist (cons 'no-initial-designation 575 (setq plist (cons 'no-initial-designation
548 (cons no-initial-designation plist)))) 576 (cons no-initial-designation plist))))