summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2003-08-29 12:10:48 +0000
committerKenichi Handa <handa@m17n.org>2003-08-29 12:10:48 +0000
commitacafeff7025fa08c660ec6d2493a1a0d1a9804f7 (patch)
treedf18b78d3405a6953804caab500336d265be230a
parente019878d2cb1cdd075bc717a23d661c1cdb7cdee (diff)
downloademacs-acafeff7025fa08c660ec6d2493a1a0d1a9804f7.tar.gz
(kinsoku-longer, kinsoku-shorter): Do not choose a
line break position in the middle of a non-kinsoku (e.g. latin) word, making it skip until either a space or a character with category "|". (kinsoku-longer): Test for end of buffer.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/international/kinsoku.el27
2 files changed, 27 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0ed8576d537..72d91ce023b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2003-08-29 Thierry Emery <thierry.emery@club-internet.fr> (tiny change)
+
+ * kinsoku.el (kinsoku-longer, kinsoku-shorter): Do not choose a
+ line break position in the middle of a non-kinsoku (e.g. latin)
+ word, making it skip until either a space or a character with
+ category "|".
+ (kinsoku-longer): Test for end of buffer.
+
2003-08-28 Eli Zaretskii <eliz@elta.co.il>
* mail/rmail.el (rmail-convert-to-babyl-format): Detect
diff --git a/lisp/international/kinsoku.el b/lisp/international/kinsoku.el
index b551161a6f3..f90c6442c0e 100644
--- a/lisp/international/kinsoku.el
+++ b/lisp/international/kinsoku.el
@@ -121,11 +121,17 @@ The value 0 means there's no limitation.")
;; Try to resolve `kinsoku' restriction by making the current line longer.
(defun kinsoku-longer ()
- (let ((pos-and-column (save-excursion
- (forward-char 1)
- (while (aref (char-category-set (following-char)) ?>)
- (forward-char 1))
- (cons (point) (current-column)))))
+ (let ((pos-and-column
+ (save-excursion
+ (forward-char 1)
+ (while (and (not (eobp))
+ (or (aref (char-category-set (following-char)) ?>)
+ ;; protect non-kinsoku words
+ (not (or (eq (preceding-char) ? )
+ (aref (char-category-set (preceding-char))
+ ?|)))))
+ (forward-char 1))
+ (cons (point) (current-column)))))
(if (or (<= kinsoku-limit 0)
(< (cdr pos-and-column) (+ (current-fill-column) kinsoku-limit)))
(goto-char (car pos-and-column)))))
@@ -135,9 +141,14 @@ The value 0 means there's no limitation.")
(defun kinsoku-shorter (linebeg)
(let ((pos (save-excursion
(forward-char -1)
- (while (and (< linebeg (point))
- (or (aref (char-category-set (preceding-char)) ?<)
- (aref (char-category-set (following-char)) ?>)))
+ (while (and
+ (< linebeg (point))
+ (or (aref (char-category-set (preceding-char)) ?<)
+ (aref (char-category-set (following-char)) ?>)
+ ;; protect non-kinsoku words
+ (not (or (eq (preceding-char) ? )
+ (aref (char-category-set (preceding-char))
+ ?|)))))
(forward-char -1))
(point))))
(if (< linebeg pos)