diff options
| author | Katsumi Yamaoka | 2010-10-18 05:21:26 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2010-10-18 05:21:26 +0000 |
| commit | 73db8b08c9f739efe6a29670907a80a310b7a76c (patch) | |
| tree | 55efd3c6687eea8d991f841d4842cf2c2085a694 /lisp | |
| parent | 392f875a3b8fc71698ea16446863ba313650dae7 (diff) | |
| download | emacs-73db8b08c9f739efe6a29670907a80a310b7a76c.tar.gz emacs-73db8b08c9f739efe6a29670907a80a310b7a76c.zip | |
shr.el (shr-insert): Don't insert space behind a wide character categorized as kinsoku-bol, or between characters both categorized as nospace.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/gnus/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/gnus/shr.el | 79 |
2 files changed, 46 insertions, 39 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index fcb79363736..c5bad44a985 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-10-18 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 2 | |||
| 3 | * shr.el (shr-insert): Don't insert space behind a wide character | ||
| 4 | categorized as kinsoku-bol, or between characters both categorized as | ||
| 5 | nospace. | ||
| 6 | |||
| 1 | 2010-10-16 Andrew Cohen <cohen@andy.bu.edu> | 7 | 2010-10-16 Andrew Cohen <cohen@andy.bu.edu> |
| 2 | 8 | ||
| 3 | * gnus-sum.el (gnus-summary-refer-thread): Bug fix. Add the thread | 9 | * gnus-sum.el (gnus-summary-refer-thread): Bug fix. Add the thread |
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el index 998ad30aed2..db609286c11 100644 --- a/lisp/gnus/shr.el +++ b/lisp/gnus/shr.el | |||
| @@ -203,47 +203,48 @@ redirects somewhere else." | |||
| 203 | ((eq shr-folding-mode 'none) | 203 | ((eq shr-folding-mode 'none) |
| 204 | (insert text)) | 204 | (insert text)) |
| 205 | (t | 205 | (t |
| 206 | (let ((first t) | 206 | (when (and (string-match "\\`[ \t\n]" text) |
| 207 | column) | 207 | (not (bolp)) |
| 208 | (when (and (string-match "\\`[ \t\n]" text) | 208 | (not (eq (char-after (1- (point))) ? ))) |
| 209 | (not (bolp)) | 209 | (insert " ")) |
| 210 | (not (eq (char-after (1- (point))) ? ))) | 210 | (dolist (elem (split-string text)) |
| 211 | (insert " ")) | 211 | (when (and (bolp) |
| 212 | (dolist (elem (split-string text)) | 212 | (> shr-indentation 0)) |
| 213 | (when (and (bolp) | 213 | (shr-indent)) |
| 214 | (> shr-indentation 0)) | 214 | ;; The shr-start is a special variable that is used to pass |
| 215 | (shr-indent)) | 215 | ;; upwards the first point in the buffer where the text really |
| 216 | ;; The shr-start is a special variable that is used to pass | 216 | ;; starts. |
| 217 | ;; upwards the first point in the buffer where the text really | 217 | (unless shr-start |
| 218 | ;; starts. | 218 | (setq shr-start (point))) |
| 219 | (unless shr-start | 219 | ;; No space is needed behind a wide character categorized as |
| 220 | (setq shr-start (point))) | 220 | ;; kinsoku-bol, or between characters both categorized as nospace. |
| 221 | ;; No space is needed before or after a breakable character or | 221 | (let (prev) |
| 222 | ;; at the beginning of a line. | ||
| 223 | (when (and (eq (preceding-char) ? ) | 222 | (when (and (eq (preceding-char) ? ) |
| 224 | (or (= (line-beginning-position) (1- (point))) | 223 | (or (= (line-beginning-position) (1- (point))) |
| 225 | (aref fill-find-break-point-function-table | 224 | (and (aref fill-find-break-point-function-table |
| 226 | (char-after (- (point) 2))) | 225 | (setq prev (char-after (- (point) 2)))) |
| 227 | (aref fill-find-break-point-function-table | 226 | (aref (char-category-set prev) ?>)) |
| 228 | (aref elem 0)))) | 227 | (and (aref fill-nospace-between-words-table prev) |
| 229 | (delete-char -1)) | 228 | (aref fill-nospace-between-words-table |
| 230 | (insert elem) | 229 | (aref elem 0))))) |
| 231 | (while (> (current-column) shr-width) | 230 | (delete-char -1))) |
| 232 | (unless (prog1 | 231 | (insert elem) |
| 233 | (shr-find-fill-point) | 232 | (while (> (current-column) shr-width) |
| 234 | (when (eq (preceding-char) ? ) | 233 | (unless (prog1 |
| 235 | (delete-char -1)) | 234 | (shr-find-fill-point) |
| 236 | (insert "\n")) | 235 | (when (eq (preceding-char) ? ) |
| 237 | (put-text-property (1- (point)) (point) 'shr-break t) | 236 | (delete-char -1)) |
| 238 | ;; No space is needed at the beginning of a line. | 237 | (insert "\n")) |
| 239 | (if (eq (following-char) ? ) | 238 | (put-text-property (1- (point)) (point) 'shr-break t) |
| 240 | (delete-char 1))) | 239 | ;; No space is needed at the beginning of a line. |
| 241 | (when (> shr-indentation 0) | 240 | (if (eq (following-char) ? ) |
| 242 | (shr-indent)) | 241 | (delete-char 1))) |
| 243 | (end-of-line)) | 242 | (when (> shr-indentation 0) |
| 244 | (insert " ")) | 243 | (shr-indent)) |
| 245 | (unless (string-match "[ \t\n]\\'" text) | 244 | (end-of-line)) |
| 246 | (delete-char -1)))))) | 245 | (insert " ")) |
| 246 | (unless (string-match "[ \t\n]\\'" text) | ||
| 247 | (delete-char -1))))) | ||
| 247 | 248 | ||
| 248 | (eval-and-compile (autoload 'kinsoku-longer "kinsoku")) | 249 | (eval-and-compile (autoload 'kinsoku-longer "kinsoku")) |
| 249 | 250 | ||