emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108110: Fix for the buffer-local


From: Leo Liu
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108110: Fix for the buffer-local rcirc-encode-coding-system case
Date: Wed, 15 Aug 2012 20:26:48 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108110
committer: Leo Liu <address@hidden>
branch nick: emacs-24
timestamp: Wed 2012-08-15 20:26:48 +0800
message:
  Fix for the buffer-local rcirc-encode-coding-system case
  
  in rcirc-split-message.
modified:
  lisp/ChangeLog
  lisp/net/rcirc.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-08-14 19:07:53 +0000
+++ b/lisp/ChangeLog    2012-08-15 12:26:48 +0000
@@ -1,3 +1,8 @@
+2012-08-15  Leo Liu  <address@hidden>
+
+       * net/rcirc.el (rcirc-split-message): Fix for buffer-local
+       rcirc-encode-coding-system.
+
 2012-08-13  Leo Liu  <address@hidden>
 
        * net/rcirc.el (rcirc-split-message): New function.

=== modified file 'lisp/net/rcirc.el'
--- a/lisp/net/rcirc.el 2012-08-13 17:22:42 +0000
+++ b/lisp/net/rcirc.el 2012-08-15 12:26:48 +0000
@@ -796,22 +796,23 @@
 
 (defun rcirc-split-message (message)
   "Split MESSAGE into chunks within `rcirc-max-message-length'."
-  (with-temp-buffer
-    (insert message)
-    (goto-char (point-min))
-    (let (result)
-      (while (not (eobp))
-       (goto-char (or (byte-to-position rcirc-max-message-length)
-                      (point-max)))
-       ;; max message length is 512 including CRLF
-       (while (and (not (bobp))
-                   (> (length
-                       (encode-coding-region (point-min) (point)
-                                             rcirc-encode-coding-system t))
-                      rcirc-max-message-length))
-         (forward-char -1))
-       (push (delete-and-extract-region (point-min) (point)) result))
-      (nreverse result))))
+  ;; `rcirc-encode-coding-system' can have buffer-local value.
+  (let ((encoding rcirc-encode-coding-system))
+    (with-temp-buffer
+      (insert message)
+      (goto-char (point-min))
+      (let (result)
+       (while (not (eobp))
+         (goto-char (or (byte-to-position rcirc-max-message-length)
+                        (point-max)))
+         ;; max message length is 512 including CRLF
+         (while (and (not (bobp))
+                     (> (length (encode-coding-region
+                                 (point-min) (point) encoding t))
+                        rcirc-max-message-length))
+           (forward-char -1))
+         (push (delete-and-extract-region (point-min) (point)) result))
+       (nreverse result)))))
 
 (defun rcirc-send-message (process target message &optional noticep silent)
   "Send TARGET associated with PROCESS a privmsg with text MESSAGE.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]