X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fmule%2Fmule-category.el;h=a7697513cfc6d5857b1cd678e78f515fbf33c15f;hb=6f6c2759db74292539455548959e9668891f6962;hp=160c91d40108dcee33dab75074d54ab052719b31;hpb=46f51e794ddb493a8a76ec2f3be00b41e3b0be22;p=chise%2Fxemacs-chise.git.1 diff --git a/lisp/mule/mule-category.el b/lisp/mule/mule-category.el index 160c91d..a769751 100644 --- a/lisp/mule/mule-category.el +++ b/lisp/mule/mule-category.el @@ -5,6 +5,7 @@ ;; 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. @@ -19,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. @@ -35,7 +36,7 @@ ;;; 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. @@ -79,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 @@ -103,16 +104,16 @@ 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) @@ -121,7 +122,7 @@ The categories are given by their designators." (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. @@ -262,8 +263,10 @@ Each element is a list of a charset, a designator, and maybe a doc string.") ;;; 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 @@ -277,8 +280,24 @@ Each element is a list of a charset, a designator, and maybe a doc string.") (?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.")