From: tomo Date: Wed, 20 Aug 2003 08:14:46 +0000 (+0000) Subject: Sync up with r21-4-12-chise-0_21-pre4-for-libchise-b1-word-fix. X-Git-Tag: r21-4-12-chise-0_21-word-fix^2 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b46558ef54593b88b68eb30d3d182093a8e6331c;p=chise%2Fxemacs-chise.git.1 Sync up with r21-4-12-chise-0_21-pre4-for-libchise-b1-word-fix. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a12b692..61e6fa7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2003-08-19 MORIOKA Tomohiko + + * mule/mule-category.el (word-combining-categories): Don't setup + `word-combining-categories' in XEmacs CHISE. + (word-separating-categories): Add setting about Latin script in + XEmacs CHISE. + 2003-08-09 MORIOKA Tomohiko * mule/mule-coding.el (coded-charset-entity-reference-alist): Add diff --git a/lisp/mule/mule-category.el b/lisp/mule/mule-category.el index bcc1e03..a769751 100644 --- a/lisp/mule/mule-category.el +++ b/lisp/mule/mule-category.el @@ -1,8 +1,11 @@ ;;; mule-category.el --- category functions for XEmacs/Mule. ;; Copyright (C) 1992,93,94,95 Free Software Foundation, Inc. +;; Copyright (C) 1995, 1997, 1999 Electrotechnical Laboratory, JAPAN. +;; Licensed to the Free Software Foundation. ;; Copyright (C) 1995 Amdahl Corporation. ;; Copyright (C) 1995 Sun Microsystems. +;; Copyright (C) 2003 MORIOKA Tomohiko ;; This file is part of XEmacs. @@ -17,7 +20,7 @@ ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with XEmacs; see the file COPYING. If not, write to the +;; along with XEmacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. @@ -27,13 +30,13 @@ ;; type of char table. Some function names / arguments should be ;; parallel with syntax tables. -;; Written by Ben Wing . The initialization code +;; Written by Ben Wing . The initialization code ;; at the end of this file comes from Mule. ;; Some bugfixes by Jareth Hein ;;; Code: -(defvar defined-category-hashtable (make-hashtable 50)) +(defvar defined-category-hashtable (make-hash-table :size 50)) (defun define-category (designator doc-string) "Make a new category whose designator is DESIGNATOR. @@ -67,8 +70,8 @@ Categories are given by their designators." "Return an undefined category designator, or nil if there are none." (let ((a 32) found) (while (and (< a 127) (not found)) - (if (gethash a defined-category-hashtable) - (setq found a)) + (unless (gethash a defined-category-hashtable) + (setq found (make-char 'ascii a))) (setq a (1+ a))) found)) @@ -77,21 +80,21 @@ Categories are given by their designators." (check-argument-type 'defined-category-p designator) (gethash designator defined-category-hashtable)) -(defun modify-category-entry (char-range designator &optional table reset) +(defun modify-category-entry (char-range designator &optional category-table reset) "Add a category to the categories associated with CHAR-RANGE. CHAR-RANGE is a single character or a range of characters, as per `put-char-table'. The category is given by a designator character. -The changes are made in TABLE, which defaults to the current buffer's - category table. +The changes are made in CATEGORY-TABLE, which defaults to the current + buffer's category table. If optional fourth argument RESET is non-nil, previous categories associated with CHAR-RANGE are removed before adding the specified category." - (or table (setq table (category-table))) - (check-argument-type 'category-table-p table) + (or category-table (setq category-table (category-table))) + (check-argument-type 'category-table-p category-table) (check-argument-type 'defined-category-p designator) (if reset ;; clear all existing stuff. - (put-char-table char-range nil table)) + (put-char-table char-range nil category-table)) (map-char-table #'(lambda (key value) ;; make sure that this range has a bit-vector assigned to it @@ -101,25 +104,25 @@ If optional fourth argument RESET is non-nil, previous categories associated ;; set the appropriate bit in that vector. (aset value (- designator 32) 1) ;; put the vector back, thus assuring we have a unique setting for this range - (put-char-table key value table)) - table char-range)) + (put-char-table key value category-table)) + category-table char-range)) -(defun char-category-list (char &optional table) - "Return a list of the categories that CHAR is in. -TABLE defaults to the current buffer's category table. +(defun char-category-list (character &optional category-table) + "Return a list of the categories that CHARACTER is in. +CATEGORY-TABLE defaults to the current buffer's category table. The categories are given by their designators." - (or table (setq table (category-table))) - (check-argument-type 'category-table-p table) - (let ((vec (get-char-table char table))) + (or category-table (setq category-table (category-table))) + (check-argument-type 'category-table-p category-table) + (let ((vec (get-char-table character category-table))) (if (null vec) nil (let ((a 32) list) (while (< a 127) (if (= 1 (aref vec (- a 32))) - (setq list (cons a list))) + (setq list (cons (make-char 'ascii a) list))) (setq a (1+ a))) (nreverse list))))) -;; implimented in c, file chartab.c (97/3/14 jhod@po.iijnet.or.jp) +;; implemented in C, file chartab.c (97/3/14 jhod@po.iijnet.or.jp) ;(defun char-in-category-p (char category &optional table) ; "Return non-nil if CHAR is in CATEGORY. ;TABLE defaults to the current buffer's category table. @@ -135,8 +138,9 @@ The categories are given by their designators." "Describe the category specifications in the category table. The descriptions are inserted in a buffer, which is then displayed." (interactive) - (with-output-to-temp-buffer "*Help*" - (describe-category-table (category-table) standard-output))) + (with-displaying-help-buffer + (lambda () + (describe-category-table (category-table) standard-output)))) (defun describe-category-table (table stream) (let (first-char @@ -243,9 +247,11 @@ Each element is a list of a charset, a designator, and maybe a doc string.") (let (i l) (define-category ?a "ASCII character set.") + (define-category ?l "Latin-1 through Latin-5 character set") (setq i 32) (while (< i 127) (modify-category-entry i ?a) + (modify-category-entry i ?l) (setq i (1+ i))) (setq l predefined-category-list) (while l @@ -255,8 +261,43 @@ Each element is a list of a charset, a designator, and maybe a doc string.") (modify-category-entry (car (car l)) (nth 1 (car l))) (setq l (cdr l)))) +;;; Setting word boundary. + +(unless (featurep 'utf-2000) +(setq word-combining-categories + '((?l . ?l))) +) + +(setq word-separating-categories ; (2-byte character sets) + '((?A . ?K) ; Alpha numeric - Katakana + (?A . ?C) ; Alpha numeric - Chinese + (?H . ?A) ; Hiragana - Alpha numeric + (?H . ?K) ; Hiragana - Katakana + (?H . ?C) ; Hiragana - Chinese + (?K . ?A) ; Katakana - Alpha numeric + (?K . ?C) ; Katakana - Chinese + (?C . ?A) ; Chinese - Alpha numeric + (?C . ?K) ; Chinese - Katakana + )) + +(when (featurep 'utf-2000) + (setq word-separating-categories + (list* + '(?l . ?K) ; Latin - Katakana + '(?l . ?C) ; Latin - Chinese + '(?H . ?l) ; Hiragana - Latin + '(?K . ?l) ; Katakana - Latin + '(?C . ?l) ; Chinese - Latin + word-separating-categories))) + + ;;; At the present, I know Japanese and Chinese text can ;;; break line at any point under a restriction of 'kinsoku'. +;;; #### SJT this needs to be set by language environments and probably should +;;; be buffer-local---strategy for dealing with this: check all $language.el +;;; files and also mule-base/$language-utils.el files for variables set; +;;; these should be made buffer local and some kind of a- or p-list of vars +;;; to be set for a language environment created. (defvar word-across-newline "\\(\\cj\\|\\cc\\|\\ct\\)" "Regular expression of such characters which can be a word across newline.") diff --git a/src/ChangeLog b/src/ChangeLog index 9b505c4..e313344 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2003-08-19 MORIOKA Tomohiko + + * chartab.c (put_char_table): Modify for inherited coded-charsets + in XEmacs CHISE. + +2003-08-19 MORIOKA Tomohiko + + * chartab.c (Fput_char_table_map_function): Fixed. + (word_boundary_p): Don't check charset in XEmacs CHISE. + 2003-07-01 MORIOKA Tomohiko * mule-charset.c (charset_code_point): Fix problem when searching diff --git a/src/chartab.c b/src/chartab.c index e5663c1..142c03a 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -2358,7 +2358,8 @@ For internal use. Don't use it. */ (c, value)) { - put_char_id_table_0 (char_attribute_table_to_put, c, value_to_put); + put_char_id_table_0 (char_attribute_table_to_put, + XCHAR (c), value_to_put); return Qnil; } #endif @@ -2394,11 +2395,21 @@ put_char_table (Lisp_Char_Table *ct, struct chartab_range *range, */ if ( CHAR_TABLEP (encoding_table) ) { + Lisp_Object mother = XCHARSET_MOTHER (range->charset); + char_attribute_table_to_put = ct; value_to_put = val; Fmap_char_attribute (Qput_char_table_map_function, XCHAR_TABLE_NAME (encoding_table), Qnil); + if ( CHARSETP (mother) ) + { + struct chartab_range r; + + r.type = CHARTAB_RANGE_CHARSET; + r.charset = mother; + put_char_table (ct, &r, val); + } } #if 0 else @@ -4039,16 +4050,20 @@ word_boundary_p (Emchar c1, Emchar c2) c2 = cmpchar_component (c2, 0, 1); #endif +#ifndef UTF2000 if (EQ (CHAR_CHARSET (c1), CHAR_CHARSET (c2))) +#endif { tail = Vword_separating_categories; default_result = 0; } +#ifndef UTF2000 else { tail = Vword_combining_categories; default_result = 1; } +#endif category_set1 = CATEGORY_SET (c1); if (NILP (category_set1))