diff options
| -rw-r--r-- | lisp/erc/erc-backend.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index 7eec56e363b..814ecfae85a 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el | |||
| @@ -466,14 +466,18 @@ If this is set to nil, never try to reconnect." | |||
| 466 | The length is specified in `erc-split-line-length'. | 466 | The length is specified in `erc-split-line-length'. |
| 467 | 467 | ||
| 468 | Currently this is called by `erc-send-input'." | 468 | Currently this is called by `erc-send-input'." |
| 469 | (if (< (length longline) | 469 | (let ((charset (car (erc-coding-system-for-target nil)))) |
| 470 | erc-split-line-length) | ||
| 471 | (list longline) | ||
| 472 | (with-temp-buffer | 470 | (with-temp-buffer |
| 473 | (insert longline) | 471 | (insert longline) |
| 472 | ;; The line lengths are in octets, not characters (because these | ||
| 473 | ;; are server protocol limits), so we have to first make the | ||
| 474 | ;; text into bytes, then fold the bytes on "word" boundaries, | ||
| 475 | ;; and then make the bytes into text again. | ||
| 476 | (encode-coding-region (point-min) (point-max) charset) | ||
| 474 | (let ((fill-column erc-split-line-length)) | 477 | (let ((fill-column erc-split-line-length)) |
| 475 | (fill-region (point-min) (point-max) | 478 | (fill-region (point-min) (point-max) |
| 476 | nil t)) | 479 | nil t)) |
| 480 | (decode-coding-region (point-min) (point-max) charset) | ||
| 477 | (split-string (buffer-string) "\n")))) | 481 | (split-string (buffer-string) "\n")))) |
| 478 | 482 | ||
| 479 | (defun erc-forward-word () | 483 | (defun erc-forward-word () |