comparison lisp/mule/kinsoku.el @ 118:7d55a9ba150c r20-1b11

Import from CVS: tag r20-1b11
author cvs
date Mon, 13 Aug 2007 09:24:17 +0200
parents fe104dbd9147
children
comparison
equal deleted inserted replaced
117:578fd4947a72 118:7d55a9ba150c
193 (defun kinsoku-bol-p () 193 (defun kinsoku-bol-p ()
194 "Check if point would break forbidden beginning-of-line rules 194 "Check if point would break forbidden beginning-of-line rules
195 Uses category \'s\' to check. 195 Uses category \'s\' to check.
196 pointで改行すると行頭禁則に触れるかどう瘢雹かをかえす。 196 pointで改行すると行頭禁則に触れるかどう瘢雹かをかえす。
197 行頭禁則文字は\'s\'のcategoryで指定する。" 197 行頭禁則文字は\'s\'のcategoryで指定する。"
198 (let ((ch (following-char))) 198 (let ((ch (char-after)))
199 (if (or 199 (if (and ch
200 (and kinsoku-ascii (char-in-category-p ch ?a)) 200 (or
201 (and kinsoku-jis (char-in-category-p ch ?j)) 201 (and kinsoku-ascii (char-in-category-p ch ?a))
202 (and kinsoku-gb (char-in-category-p ch ?c)) 202 (and kinsoku-jis (char-in-category-p ch ?j))
203 (and kinsoku-big5 (char-in-category-p ch ?t))) 203 (and kinsoku-gb (char-in-category-p ch ?c))
204 (and kinsoku-big5 (char-in-category-p ch ?t))))
204 (char-in-category-p ch ?s) 205 (char-in-category-p ch ?s)
205 nil))) 206 nil)))
206 207
207 (defun kinsoku-eol-p () 208 (defun kinsoku-eol-p ()
208 "Check if point would break forbidden end-of-line rules 209 "Check if point would break forbidden end-of-line rules
209 Uses category \'e\' to check. 210 Uses category \'e\' to check.
210 pointで改行すると行末禁則に触れるかどう瘢雹かをかえす。 211 pointで改行すると行末禁則に触れるかどう瘢雹かをかえす。
211 行末禁則文字は\'s\'のcategoryで指定する。" 212 行末禁則文字は\'s\'のcategoryで指定する。"
212 (let ((ch (preceding-char))) 213 (let ((ch (char-before)))
213 (if (or 214 (if (and ch
214 (and kinsoku-ascii (char-in-category-p ch ?a)) 215 (or
215 (and kinsoku-jis (char-in-category-p ch ?j)) 216 (and kinsoku-ascii (char-in-category-p ch ?a))
216 (and kinsoku-gb (char-in-category-p ch ?c)) 217 (and kinsoku-jis (char-in-category-p ch ?j))
217 (and kinsoku-big5 (char-in-category-p ch ?t))) 218 (and kinsoku-gb (char-in-category-p ch ?c))
219 (and kinsoku-big5 (char-in-category-p ch ?t))))
218 (char-in-category-p ch ?e) 220 (char-in-category-p ch ?e)
219 nil))) 221 nil)))
220 222
221 (defvar kinsoku-extend-limit nil 223 (defvar kinsoku-extend-limit nil
222 "Defines how many characters kinsoku will search forward before giving up. 224 "Defines how many characters kinsoku will search forward before giving up.
246 (if (and (numberp kinsoku-extend-limit) 248 (if (and (numberp kinsoku-extend-limit)
247 (>= kinsoku-extend-limit 0)) 249 (>= kinsoku-extend-limit 0))
248 kinsoku-extend-limit 250 kinsoku-extend-limit
249 10000))) ;;; 10000 is deliberatly unreasonably large 251 10000))) ;;; 10000 is deliberatly unreasonably large
250 ch1 ch2) 252 ch1 ch2)
251 (while (and (<= (+ (current-column) 253 (while (and (setq ch1 (char-after))
252 (char-width (setq ch1 (following-char)))) 254 (<= (+ (current-column)
255 (char-width ch1 ))
253 max-column) 256 max-column)
254 (not (bolp)) 257 (not (bolp))
255 (not (eolp)) 258 (not (eolp))
256 (or (kinsoku-eol-p) 259 (or (kinsoku-eol-p)
257 (kinsoku-bol-p) 260 (kinsoku-bol-p)
258 ;;; don't break in the middle of an English word 261 ;;; don't break in the middle of an English word
259 (and (char-in-category-p ch1 ?a) 262 (and (char-in-category-p ch1 ?a)
260 (char-in-category-p (setq ch2 (preceding-char)) ?a) 263 (setq ch2 (char-before))
264 (char-in-category-p ch2 ?a)
261 (= ?w (char-syntax ch2)) 265 (= ?w (char-syntax ch2))
262 (= ?w (char-syntax ch1))))) 266 (= ?w (char-syntax ch1)))))
263 (forward-char)) 267 (forward-char))
264 (if (or (kinsoku-eol-p) (kinsoku-bol-p)) 268 (if (or (kinsoku-eol-p) (kinsoku-bol-p))
265 (kinsoku-process-shrink)))) 269 (kinsoku-process-shrink))))