121 |
|
|
122 |
;; Try to resolve `kinsoku' restriction by making the current line longer. |
;; Try to resolve `kinsoku' restriction by making the current line longer. |
123 |
(defun kinsoku-longer () |
(defun kinsoku-longer () |
124 |
(let ((pos-and-column (save-excursion |
(let ((pos-and-column |
125 |
(forward-char 1) |
(save-excursion |
126 |
(while (aref (char-category-set (following-char)) ?>) |
(forward-char 1) |
127 |
(forward-char 1)) |
(while (and (not (eobp)) |
128 |
(cons (point) (current-column))))) |
(or (aref (char-category-set (following-char)) ?>) |
129 |
|
;; protect non-kinsoku words |
130 |
|
(not (or (eq (preceding-char) ? ) |
131 |
|
(aref (char-category-set (preceding-char)) |
132 |
|
?|))))) |
133 |
|
(forward-char 1)) |
134 |
|
(cons (point) (current-column))))) |
135 |
(if (or (<= kinsoku-limit 0) |
(if (or (<= kinsoku-limit 0) |
136 |
(< (cdr pos-and-column) (+ (current-fill-column) kinsoku-limit))) |
(< (cdr pos-and-column) (+ (current-fill-column) kinsoku-limit))) |
137 |
(goto-char (car pos-and-column))))) |
(goto-char (car pos-and-column))))) |
141 |
(defun kinsoku-shorter (linebeg) |
(defun kinsoku-shorter (linebeg) |
142 |
(let ((pos (save-excursion |
(let ((pos (save-excursion |
143 |
(forward-char -1) |
(forward-char -1) |
144 |
(while (and (< linebeg (point)) |
(while (and |
145 |
(or (aref (char-category-set (preceding-char)) ?<) |
(< linebeg (point)) |
146 |
(aref (char-category-set (following-char)) ?>))) |
(or (aref (char-category-set (preceding-char)) ?<) |
147 |
|
(aref (char-category-set (following-char)) ?>) |
148 |
|
;; protect non-kinsoku words |
149 |
|
(not (or (eq (preceding-char) ? ) |
150 |
|
(aref (char-category-set (preceding-char)) |
151 |
|
?|))))) |
152 |
(forward-char -1)) |
(forward-char -1)) |
153 |
(point)))) |
(point)))) |
154 |
(if (< linebeg pos) |
(if (< linebeg pos) |