summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/fill.el65
-rw-r--r--lisp/textmodes/ispell.el36
-rw-r--r--lisp/textmodes/sgml-mode.el4
3 files changed, 39 insertions, 66 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index e5b3a64db84..6aae79a825f 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -368,15 +368,29 @@ and `fill-nobreak-invisible'."
(looking-at paragraph-start))))
(run-hook-with-args-until-success 'fill-nobreak-predicate)))))
-;; Put `fill-find-break-point-function' property to charsets which
-;; require special functions to find line breaking point.
-(dolist (pair '((katakana-jisx0201 . kinsoku)
- (chinese-gb2312 . kinsoku)
- (japanese-jisx0208 . kinsoku)
- (japanese-jisx0212 . kinsoku)
- (chinese-big5-1 . kinsoku)
- (chinese-big5-2 . kinsoku)))
- (put-charset-property (car pair) 'fill-find-break-point-function (cdr pair)))
+(defvar fill-find-break-point-function-table (make-char-table nil)
+ "Char-table of special functions to find line breaking point.")
+
+(defvar fill-nospace-between-words-table (make-char-table nil)
+ "Char-table of characters that don't use space between words.")
+
+(progn
+ ;; Register `kinsoku' for scripts HAN, KANA, BOPOMPFO, and CJK-MISS.
+ ;; Also tell that they don't use space between words.
+ (map-char-table
+ #'(lambda (key val)
+ (when (memq val '(han kana bopomofo cjk-misc))
+ (set-char-table-range fill-find-break-point-function-table
+ key 'kinsoku)
+ (set-char-table-range fill-nospace-between-words-table
+ key t)))
+ char-script-table)
+ ;; Do the same thing also for full width characters and half
+ ;; width kana variants.
+ (set-char-table-range fill-find-break-point-function-table
+ '(#xFF01 . #xFFE6) 'kinsoku)
+ (set-char-table-range fill-nospace-between-words-table
+ '(#xFF01 . #xFFE6) 'kinsoku))
(defun fill-find-break-point (limit)
"Move point to a proper line breaking position of the current line.
@@ -387,15 +401,9 @@ after or before a non-ASCII character. If the charset of the
character has the property `fill-find-break-point-function', this
function calls the property value as a function with one arg LINEBEG.
If the charset has no such property, do nothing."
- (let* ((ch (following-char))
- (charset (char-charset ch))
- func)
- (if (eq charset 'ascii)
- (setq ch (preceding-char)
- charset (char-charset ch)))
- (if (charsetp charset)
- (setq func
- (get-charset-property charset 'fill-find-break-point-function)))
+ (let ((func (or
+ (aref fill-find-break-point-function-table (following-char))
+ (aref fill-find-break-point-function-table (preceding-char)))))
(if (and func (fboundp func))
(funcall func limit))))
@@ -454,14 +462,13 @@ Point is moved to just past the fill prefix on the first line."
(goto-char from)
(if enable-multibyte-characters
;; Delete unnecessay newlines surrounded by words. The
- ;; character category `|' means that we can break a line
- ;; at the character. And, charset property
- ;; `nospace-between-words' tells how to concatenate
- ;; words. If the value is non-nil, never put spaces
- ;; between words, thus delete a newline between them.
- ;; If the value is nil, delete a newline only when a
- ;; character preceding a newline has text property
- ;; `nospace-between-words'.
+ ;; character category `|' means that we can break a line at the
+ ;; character. And, char-table
+ ;; `fill-nospace-between-words-table' tells how to concatenate
+ ;; words. If a character has non-nil value in the table, never
+ ;; put spaces between words, thus delete a newline between them.
+ ;; Otherwise, delete a newline only when a character preceding a
+ ;; newline has non-nil value in that table.
(while (search-forward "\n" to t)
(if (get-text-property (match-beginning 0) 'fill-space)
(replace-match (get-text-property (match-beginning 0) 'fill-space))
@@ -469,10 +476,8 @@ Point is moved to just past the fill prefix on the first line."
(next (following-char)))
(if (and (or (aref (char-category-set next) ?|)
(aref (char-category-set prev) ?|))
- (or (get-charset-property (char-charset prev)
- 'nospace-between-words)
- (get-text-property (1- (match-beginning 0))
- 'nospace-between-words)))
+ (or (aref fill-nospace-between-words-table next)
+ (aref fill-nospace-between-words-table prev)))
(delete-char -1))))))
(goto-char from)
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 5bc685af65b..a8b7d1bd7df 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1184,28 +1184,7 @@ Protects against bogus binding of `enable-multibyte-characters' in XEmacs."
(decode-coding-string str (ispell-get-coding-system))
str))
-(put 'ispell-unified-chars-table 'char-table-extra-slots 0)
-
-;; Char-table that maps an Unicode character (charset:
-;; latin-iso8859-1, mule-unicode-0100-24ff, mule-unicode-2500-34ff) to
-;; a string in which all equivalent characters are listed.
-
-(defconst ispell-unified-chars-table
- (let ((table (make-char-table 'ispell-unified-chars-table)))
- (map-char-table
- #'(lambda (c v)
- (if (and v (/= c v))
- (let ((unified (or (aref table v) (string v))))
- (aset table v (concat unified (string c))))))
- ucs-mule-8859-to-mule-unicode)
- table))
-
-;; Return a string decoded from Nth element of the current dictionary
-;; while splicing equivalent characters into the string. This splicing
-;; is done only if the string is a regular expression of the form
-;; "[...]" because, otherwise, splicing will result in incorrect
-;; regular expression matching.
-
+;; Return a string decoded from Nth element of the current dictionary.
(defun ispell-get-decoded-string (n)
(let* ((slot (or
(assoc ispell-current-dictionary ispell-local-dictionary-alist)
@@ -1214,17 +1193,8 @@ Protects against bogus binding of `enable-multibyte-characters' in XEmacs."
(when (and (> (length str) 0)
(not (multibyte-string-p str)))
(setq str (ispell-decode-string str))
- (if (and (= (aref str 0) ?\[)
- (eq (string-match "\\]" str) (1- (length str))))
- (setq str
- (string-as-multibyte
- (mapconcat
- #'(lambda (c)
- (let ((unichar (aref ucs-mule-8859-to-mule-unicode c)))
- (if unichar
- (aref ispell-unified-chars-table unichar)
- (string c))))
- str ""))))
+ (or (multibyte-string-p str)
+ (setq str (string-to-multibyte str)))
(setcar (nthcdr n slot) str))
str))
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index aa24a724877..a3341db3ae3 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -114,8 +114,6 @@ This takes effect when first loading the `sgml-mode' library.")
(define-key map "\"" 'sgml-name-self))
(when (memq ?' sgml-specials)
(define-key map "'" 'sgml-name-self)))
- (define-key map (vector (make-char 'latin-iso8859-1))
- 'sgml-maybe-name-self)
(let ((c 127)
(map (nth 1 map)))
(while (< (setq c (1+ c)) 256)
@@ -211,7 +209,7 @@ This takes effect when first loading the `sgml-mode' library.")
(let ((table (make-char-table 'sgml-table))
(i 32)
elt)
- (while (< i 256)
+ (while (< i 128)
(setq elt (aref sgml-char-names i))
(if elt (aset table (make-char 'latin-iso8859-1 i) elt))
(setq i (1+ i)))