From a0aec09f71b2a793ed996f1b37237d688e5c35b3 Mon Sep 17 00:00:00 2001 From: morioka Date: Mon, 9 Mar 1998 18:54:32 +0000 Subject: [PATCH] tm 7.65. --- ChangeLog | 77 +++++++++++++++++++++++++++++++++++++++++++++++ emu-18.el | 44 ++++++++++++++++++++++++++- emu-19.el | 33 +++++++++++++++++++- emu-e19.el | 88 +++++++++++++++++++++++++++++++++-------------------- emu-mule.el | 55 +++++++++++++++++++++++++++++++--- emu-nemacs.el | 61 ++++++++++++++++++++++++------------- emu-x20.el | 93 ++++++++++++++++++++++++++++++++++++++++++++++----------- emu-xemacs.el | 41 ++++++++++++++++++++++++- 8 files changed, 414 insertions(+), 78 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6e2fe6..35239e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,80 @@ +Mon May 27 14:04:12 1996 MORIOKA Tomohiko + + * tl: Version 7.27.1 was released. + + * emu-mule.el (charset-*): New constants. + + * emu-x20.el (charset-*): New constants. + (charset-description): New alias. + + * emu-e19.el (char-charset): + Use constant `charset-ascii' and `charset-latin-1'. + +Mon May 27 12:17:42 1996 MORIOKA Tomohiko + + * emu-nemacs.el (char-charset): Use constant `charset-ascii' and + `charset-jisx0208'. + + * emu-nemacs.el (charset-ascii): New constant. + (charset-jisx0208): New constant. + +Mon May 27 12:06:05 1996 MORIOKA Tomohiko + + * emu-mule.el (charset-description): New alias. + (charset-registry): New alias. + (charset-columns): New alias. + (charset-direction): New alias. + +Mon May 27 11:28:24 1996 MORIOKA Tomohiko + + * emu-mule.el (string-columns): New alias. + + * emu-nemacs.el, emu-e19.el, emu-x20.el (string-columns): New + alias; You should use it instead of `string-width'. + +Mon May 27 10:07:19 1996 MORIOKA Tomohiko + + * emu-nemacs.el (truncate-string): Use function `char-columns' + instead of `char-width'. + +Mon May 27 10:01:14 1996 MORIOKA Tomohiko + + * emu-mule.el (char-columns): New alias. + + * emu-nemacs.el, emu-e19.el, emu-x20.el (char-columns): New + function; You should use it instead of `char-width'. + +Sat May 25 20:23:36 1996 MORIOKA Tomohiko + + * emu-xemacs.el (invisible-p): New function. + (next-visible-point): New function. + +Sat May 25 20:21:22 1996 MORIOKA Tomohiko + + * emu-19.el (invisible-p): New function. + (next-visible-point): New function. + +Sat May 25 20:14:52 1996 MORIOKA Tomohiko + + * emu-18.el (invisible-p): New function. + (next-visible-point): New function. + +Sat May 25 19:51:23 1996 MORIOKA Tomohiko + + * emu-18.el (invisible-region): New function. + (visible-region): New function. + +Sat May 25 19:28:13 1996 MORIOKA Tomohiko + + * emu-xemacs.el (invisible-region): New function. + (visible-region): New function. + +Sat May 25 19:22:50 1996 MORIOKA Tomohiko + + * emu-19.el (invisible-region): New function. + (visible-region): New function. + + Thu May 23 01:31:02 1996 MORIOKA Tomohiko * tl: Version 7.27 was released. diff --git a/emu-18.el b/emu-18.el index 97f0ac1..efd408e 100644 --- a/emu-18.el +++ b/emu-18.el @@ -6,7 +6,7 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: emu-18.el,v 7.15 1996/05/09 15:09:00 morioka Exp $ +;;; $Id: emu-18.el,v 7.18 1996/05/26 02:05:52 morioka Exp $ ;;; Keywords: emulation, compatibility ;;; ;;; This file is part of tl (Tiny Library). @@ -221,6 +221,48 @@ With optional non-nil ALL, force redisplay of all mode-lines. (defun tl:overlay-buffer (overlay)) +;;; @@ visible/invisible +;;; + +(defun invisible-region (start end) + (let ((buffer-read-only nil) ;Okay even if write protected. + (modp (buffer-modified-p))) + (if (save-excursion + (goto-char (1- end)) + (eq (following-char) ?\n) + ) + (setq end (1- end)) + ) + (unwind-protect + (subst-char-in-region start end ?\n ?\^M t) + (set-buffer-modified-p modp) + ))) + +(defun visible-region (start end) + (let ((buffer-read-only nil) ;Okay even if write protected. + (modp (buffer-modified-p))) + (unwind-protect + (subst-char-in-region start end ?\^M ?\n t) + (set-buffer-modified-p modp) + ))) + +(defun invisible-p (pos) + (save-excursion + (goto-char pos) + (eq (following-char) ?\^M) + )) + +(defun next-visible-point (pos) + (save-excursion + (goto-char pos) + (end-of-line) + (if (eq (following-char) ?\n) + (forward-char) + ) + (point) + )) + + ;;; @ mouse ;;; diff --git a/emu-19.el b/emu-19.el index 7eec5d3..fe741f3 100644 --- a/emu-19.el +++ b/emu-19.el @@ -6,7 +6,7 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: emu-19.el,v 7.4 1996/05/14 16:22:38 morioka Exp $ +;;; $Id: emu-19.el,v 7.7 1996/05/26 01:48:47 morioka Exp $ ;;; Keywords: emulation, compatibility ;;; ;;; This file is part of tl (Tiny Library). @@ -37,6 +37,37 @@ (defalias 'tl:overlay-buffer 'overlay-buffer) +;;; @@ visible/invisible +;;; + +(defun invisible-region (start end) + (if (save-excursion + (goto-char (1- end)) + (eq (following-char) ?\n) + ) + (setq end (1- end)) + ) + (put-text-property start end 'invisible t) + ) + +(defun visible-region (start end) + (put-text-property start end 'invisible nil) + ) + +(defun invisible-p (pos) + (get-text-property pos 'invisible) + ) + +(defun next-visible-point (pos) + (save-excursion + (goto-char (next-single-property-change pos 'invisible)) + (if (eq (following-char) ?\n) + (forward-char) + ) + (point) + )) + + ;;; @ mouse ;;; diff --git a/emu-e19.el b/emu-e19.el index e4c79a9..118879e 100644 --- a/emu-e19.el +++ b/emu-e19.el @@ -6,7 +6,7 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: emu-e19.el,v 7.14 1996/05/15 14:00:04 morioka Exp $ +;;; $Id: emu-e19.el,v 7.18 1996/05/27 12:25:34 morioka Exp $ ;;; Keywords: emulation, compatibility, Mule, Latin-1 ;;; ;;; This file is part of tl (Tiny Library). @@ -40,36 +40,14 @@ ;;; @ character set ;;; -(defconst lc-ascii 0) -(defconst lc-ltn1 129) - -(defun char-charset (chr) - "Return the character set of char CHR. -\[emu-e19.el; XEmacs 20 emulating function]" - (if (< chr 128) - lc-ascii - lc-ltn1)) - -(defalias 'char-leading-char 'char-charset) +(defconst charset-ascii 0 "Character set of ASCII") +(defconst charset-latin-1 129 "Character set of ISO-8859-1") -(defun find-charset-string (str) - "Return a list of leading-chars in the string. -\[emu-e19.el; Mule emulating function]" - (if (string-match "[\200-\377]" str) - (list lc-ltn1) - )) +;;; @@ for Mule emulation +;;; -(defun find-charset-region (start end) - "Return a list of leading-chars in the region between START and END. -\[emu-e19.el; Mule emulating function]" - (if (save-excursion - (save-restriction - (narrow-to-region start end) - (goto-char start) - (re-search-forward "[\200-\377]" nil t) - )) - (list lc-ltn1) - )) +(defconst lc-ascii 0) +(defconst lc-ltn1 129) ;;; @ coding-system @@ -118,13 +96,54 @@ between START and END. [emu-e19.el; Mule emulating function]" ) -;;; @ character and string +;;; @ character ;;; (defun char-bytes (chr) 1) -(defun char-width (chr) 1) -(defalias 'string-width 'length) +(defun char-columns (character) + "Return number of columns a CHARACTER occupies when displayed. +\[emu-nemacs.el]" + 1) + +(defun char-charset (chr) + "Return the character set of char CHR. +\[emu-e19.el; XEmacs 20 emulating function]" + (if (< chr 128) + charset-ascii + charset-latin-1)) + +(defun find-charset-string (str) + "Return a list of leading-chars in the string. +\[emu-e19.el; Mule emulating function]" + (if (string-match "[\200-\377]" str) + (list lc-ltn1) + )) + +(defun find-charset-region (start end) + "Return a list of leading-chars in the region between START and END. +\[emu-e19.el; Mule emulating function]" + (if (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char start) + (re-search-forward "[\200-\377]" nil t) + )) + (list lc-ltn1) + )) + +;;; @@ for Mule emulation +;;; + +(defalias 'char-width 'char-columns) + +(defalias 'char-leading-char 'char-charset) + + +;;; @ string +;;; + +(defalias 'string-columns 'length) (defun string-to-char-list (str) (mapcar (function identity) str) @@ -143,6 +162,11 @@ Optional non-nil arg START-COLUMN specifies the starting column. (substring str start-column width) ) +;;; @@ for Mule emulation +;;; + +(defalias 'string-width 'length) + ;;; @ end ;;; diff --git a/emu-mule.el b/emu-mule.el index 00eefb4..a015cf0 100644 --- a/emu-mule.el +++ b/emu-mule.el @@ -2,11 +2,11 @@ ;;; emu-mule.el --- Mule 2.* emulation module for Mule ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: emu-mule.el,v 7.13 1996/05/14 16:28:33 morioka Exp $ +;;; $Id: emu-mule.el,v 7.21 1996/05/27 14:08:00 morioka Exp $ ;;; Keywords: emulation, compatibility, Mule ;;; ;;; This file is part of tl (Tiny Library). @@ -60,7 +60,44 @@ ;;; @ character set ;;; -(defalias 'char-charset 'char-leading-char) +;; 94 character set +(defconst charset-ascii lc-ascii "ASCII") +(defconst charset-jisx0201-kana lc-kana "JIS X0201 Katakana") +(defconst charset-jisx0201-latin lc-roman "JIS X0201 Latin") + +;; 96 character set +(defconst charset-latin-1 lc-ltn1 "ISO-8859-1 (Latin-1)") +(defconst charset-latin-2 lc-ltn2 "ISO-8859-2 (Latin-2)") +(defconst charset-latin-3 lc-ltn3 "ISO-8859-3 (Latin-3)") +(defconst charset-latin-4 lc-ltn4 "ISO-8859-4 (Latin-4)") +(defconst charset-cyrillic lc-crl "ISO-8859-5 (Cyrillic)") +(defconst charset-arabic lc-arb "ISO-8859-6 (Arabic)") +(defconst charset-greek lc-grk "ISO-8859-7 (Greek)") +(defconst charset-hebrew lc-hbw "ISO-8859-8 (Hebrew)") +(defconst charset-latin-5 lc-ltn5 "ISO-8859-9 (Latin-5)") + +;; 94x94 character set +(defconst charset-jisx0208-1978 lc-jpold "JIS X0208-1978") +(defconst charset-gb2312 lc-cn "GB 2312-1980") +(defconst charset-jisx0208 lc-jp "JIS X0208-1983") +(defconst charset-ksc5601 lc-kr "KS C5601-1987") +(defconst charset-jisx0212 lc-jp2 "JIS X0212-1990") +(defconst charset-cns11643-1 lc-cns1 "CNS 11643-1986 plane 1") +(defconst charset-cns11643-2 lc-cns2 "CNS 11643-1986 plane 2") +(defconst charset-cns11643-3 lc-cns3 "CNS 11643-1986 plane 3") +(defconst charset-cns11643-4 lc-cns4 "CNS 11643-1986 plane 4") +(defconst charset-cns11643-5 lc-cns5 "CNS 11643-1986 plane 5") +(defconst charset-cns11643-6 lc-cns6 "CNS 11643-1986 plane 6") +(defconst charset-cns11643-7 lc-cns7 "CNS 11643-1986 plane 7") + +;; Big 5 +(defconst charset-big5-1 lc-big5-1 "Big5 Level 1") +(defconst charset-big5-2 lc-big5-2 "Big5 Level 2") + +(defalias 'charset-description 'char-description) +(defalias 'charset-registry 'char-registry) +(defalias 'charset-columns 'char-width) +(defalias 'charset-direction 'char-direction) ;;; @ coding system @@ -91,9 +128,19 @@ encoded in CODING-SYSTEM. [emu-mule.el]" ) -;;; @ character and string +;;; @ character +;;; + +(defalias 'char-charset 'char-leading-char) + +(defalias 'char-columns 'char-width) + + +;;; @ string ;;; +(defalias 'string-columns 'string-width) + (defalias 'string-to-int-list 'string-to-char-list) (or (fboundp 'truncate-string) diff --git a/emu-nemacs.el b/emu-nemacs.el index f12efec..986c3b6 100644 --- a/emu-nemacs.el +++ b/emu-nemacs.el @@ -7,7 +7,7 @@ ;;; Author: MORIOKA Tomohiko ;;; modified by KOBAYASHI Shuhei ;;; Version: -;;; $Id: emu-nemacs.el,v 7.19 1996/05/09 15:06:53 morioka Exp $ +;;; $Id: emu-nemacs.el,v 7.27 1996/05/27 12:27:59 morioka Exp $ ;;; Keywords: emulation, compatibility, NEmacs, Mule ;;; ;;; This file is part of tl (Tiny Library). @@ -34,17 +34,14 @@ ;;; @ character set ;;; -(defconst lc-ascii 0) -(defconst lc-jp 146) +(defconst charset-ascii 0 "Character set of ASCII") +(defconst charset-jisx0208 146 "Character set of JIS X0208-1983") -(defun char-charset (chr) - "Return the character set of char CHR. -\[emu-nemacs.el; XEmacs 20 emulating function]" - (if (< chr 128) - lc-ascii - lc-jp)) +;;; @@ for Mule emulation +;;; -(defalias 'char-leading-char 'char-charset) +(defconst lc-ascii 0) +(defconst lc-jp 146) ;;; @ coding system @@ -121,23 +118,40 @@ else returns nil. [emu-nemacs.el; Mule emulating function]" ) -;;; @ character and string +;;; @ character ;;; +(defun char-charset (chr) + "Return the character set of char CHR. +\[emu-nemacs.el; XEmacs 20 emulating function]" + (if (< chr 128) + charset-ascii + charset-jisx0208)) + (defun char-bytes (chr) "Return number of bytes CHAR will occupy in a buffer. \[emu-nemacs.el; Mule emulating function]" (if (< chr 128) 1 2)) -(defun char-width (chr) - "Return number of columns CHAR will occupy when displayed. -\[emu-nemacs.el; Mule emulating function]" - (if (< chr 128) 1 2)) +(defun char-columns (character) + "Return number of columns a CHARACTER occupies when displayed. +\[emu-nemacs.el]" + (if (< character 128) + 1 + 2)) -(defun string-width (str) - "Return number of columns STRING will occupy. -\[emu-nemacs.el; Mule emulating function]" - (length str)) +;;; @@ for Mule emulation +;;; + +(defalias 'char-leading-char 'char-charset) + +(defalias 'char-width 'char-columns) + + +;;; @ string +;;; + +(defalias 'string-columns 'length) (defun sref (str idx) "Return the character in STR at index IDX. @@ -213,19 +227,24 @@ Optional non-nil arg START-COLUMN specifies the starting column. "" (while (< column start-column) (setq ch (aref str from) - column (+ column (char-width ch)) + column (+ column (char-columns ch)) from (+ from (char-bytes ch)))) (if (< width max-width) (progn (setq to from) (while (<= column width) (setq ch (aref str to) - column (+ column (char-width ch)) + column (+ column (char-columns ch)) to-prev to to (+ to (char-bytes ch)))) (setq to to-prev))) (substring str from to)))) +;;; @@ for Mule emulation +;;; + +(defalias 'string-width 'length) + ;;; @ text property emulation ;;; diff --git a/emu-x20.el b/emu-x20.el index ceced57..a4cb1fa 100644 --- a/emu-x20.el +++ b/emu-x20.el @@ -6,7 +6,7 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: emu-x20.el,v 7.4 1996/05/20 15:52:28 morioka Exp $ +;;; $Id: emu-x20.el,v 7.11 1996/05/27 14:09:18 morioka Exp $ ;;; Keywords: emulation, compatibility, Mule, XEmacs ;;; ;;; This file is part of tl (Tiny Library). @@ -39,20 +39,35 @@ ;;; @ character set ;;; -(defalias 'char-leading-char 'char-charset) - -(defun find-charset-string (string) - "Return a list of charsets in the STRING except ascii. -\[emu-x20.el; Mule emulating function]" - (delq 'ascii (charsets-in-string string)) - ) - -(defun find-charset-region (start end) - "Return a list of charsets except ascii -in the region between START and END. -\[emu-x20.el; Mule emulating function]" - (delq 'ascii (charsets-in-region start end)) - ) +(mapcar (lambda (charset) + (set + (cond ((eq charset 'japanese-kana) 'charset-jisx0201-kana) + ((eq charset 'japanese-roman) 'charset-jisx0201-latin) + ((eq charset 'japanese-old) 'charset-jisx0208-1978) + ((eq charset 'chinese-gb) 'charset-gb2312) + ((eq charset 'japanese) 'charset-jisx0208) + ((eq charset 'koran) 'charset-ksc5601) + ((eq charset 'japanese-2) 'charset-jisx0212) + ((eq charset 'chinese-cns-1) 'charset-cns11643-1) + ((eq charset 'chinese-cns-2) 'charset-cns11643-2) + ((eq charset 'chinese-cns-3) 'charset-cns11643-3) + ((eq charset 'chinese-cns-4) 'charset-cns11643-4) + ((eq charset 'chinese-cns-5) 'charset-cns11643-5) + ((eq charset 'chinese-cns-6) 'charset-cns11643-6) + ((eq charset 'chinese-cns-7) 'charset-cns11643-7) + ((eq charset 'chinese-big5-1) 'charset-big5-1) + ((eq charset 'chinese-big5-2) 'charset-big5-2) + (t (intern (concat "charset-" (symbol-name charset)))) + ) + charset) + ) + (charset-list) + ) + +(defalias 'charset-description 'charset-doc-string) + +;;; @@ for Mule emulation +;;; (defconst lc-ascii 'ascii) (defconst lc-ltn1 'latin-1) @@ -131,13 +146,42 @@ in the region between START and END. (defalias 'character-decode-region 'decode-coding-region) -;;; @ character and string +;;; @ character ;;; (defun char-bytes (chr) 1) -(defun char-width (chr) 1) -(defalias 'string-width 'length) +(defun char-columns (character) + "Return number of columns a CHARACTER occupies when displayed. +\[emu-x20.el]" + (charset-columns (char-charset character)) + ) + +;;; @@ Mule emulating aliases +;;; +;;; You should not use them. + +(defalias 'char-width 'char-columns) + +(defalias 'char-leading-char 'char-charset) + + +;;; @ string +;;; + +(defun string-columns (string) + "Return number of columns STRING occupies when displayed. +\[emu-x20.el]" + (let ((col 0) + (len (length string)) + (i 0)) + (while (< i len) + (setq col (+ col (char-columns (aref string i)))) + (setq i (1+ i)) + ) + col)) + +(defalias 'string-width 'string-column) (defun string-to-int-list (str) (mapcar #'char-int str) @@ -154,6 +198,19 @@ Optional non-nil arg START-COLUMN specifies the starting column. (substring str start-column width) ) +(defun find-charset-string (string) + "Return a list of charsets in the STRING except ascii. +\[emu-x20.el; Mule emulating function]" + (delq 'ascii (charsets-in-string string)) + ) + +(defun find-charset-region (start end) + "Return a list of charsets except ascii +in the region between START and END. +\[emu-x20.el; Mule emulating function]" + (delq 'ascii (charsets-in-region start end)) + ) + ;;; @ end ;;; diff --git a/emu-xemacs.el b/emu-xemacs.el index 4e2a69f..f71e462 100644 --- a/emu-xemacs.el +++ b/emu-xemacs.el @@ -6,7 +6,7 @@ ;;; ;;; Author: MORIOKA Tomohiko ;;; Version: -;;; $Id: emu-xemacs.el,v 7.5 1996/05/15 14:05:34 morioka Exp $ +;;; $Id: emu-xemacs.el,v 7.8 1996/05/26 02:13:21 morioka Exp $ ;;; Keywords: emulation, compatibility, XEmacs ;;; ;;; This file is part of tl (Tiny Library). @@ -69,6 +69,45 @@ ) +;;; @@ visible/invisible +;;; + +(defun invisible-region (start end) + (if (save-excursion + (goto-char start) + (eq (following-char) ?\n) + ) + (setq start (1+ start)) + ) + (put-text-property start end 'invisible t) + ) + +(defun visible-region (start end) + (put-text-property start end 'invisible nil) + ) + +(defun invisible-p (pos) + (if (save-excursion + (goto-char pos) + (eq (following-char) ?\n) + ) + (setq pos (1+ pos)) + ) + (get-text-property pos 'invisible) + ) + +(defun next-visible-point (pos) + (save-excursion + (if (save-excursion + (goto-char pos) + (eq (following-char) ?\n) + ) + (setq pos (1+ pos)) + ) + (next-single-property-change pos 'invisible) + )) + + ;;; @ mouse ;;; -- 1.7.10.4