1 ;;; mcs-xmu.el --- Functions to unify ISO646 characters for XEmacs-mule
3 ;; Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: emulation, compatibility, Mule
8 ;; This file is part of APEL (A Portable Emacs Library).
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; This module will be loaded from mcs-xm automatically.
28 ;; There is no guarantee that it will work alone.
32 (defcustom mime-iso646-character-unification-alist
38 (cons (cons (char-to-string (make-char 'latin-jisx0201 i))
45 (cons (cons (char-to-string (make-char 'latin-jisx0201 i))
50 "Alist unified string vs. canonical string."
52 :type '(repeat (cons string string)))
54 (defcustom mime-unified-character-face nil
55 "Face of unified character."
59 (defcustom mime-character-unification-limit-size 2048
60 "Limit size to unify characters. It is referred by the function
61 `decode-mime-charset-region-with-iso646-unification'. If the length of
62 the specified region (start end) is larger than its value, the function
63 works for only decoding MIME-CHARSET. If it is nil, size is unlimited."
65 :type '(radio (integer :tag "Max size")
66 (const :tag "Unlimited" nil)))
68 (defun decode-mime-charset-region-with-iso646-unification (start end charset
72 (narrow-to-region start end)
74 (or (null mime-character-unification-limit-size)
75 (<= (- end start) mime-character-unification-limit-size))
76 (decode-mime-charset-region-default start end charset lbt))
77 (let ((rest mime-iso646-character-unification-alist))
79 (let ((pair (car rest))
81 (goto-char (point-min))
82 (while (search-forward (car pair) nil t)
83 (let ((str (cdr pair)))
84 (if mime-unified-character-face
87 'face mime-unified-character-face str))
88 (replace-match str 'fixed-case 'literal)
91 (setq rest (cdr rest)))))
100 ;;; mcs-xmu.el ends here