emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102517: nnimap.el (nnimap-last-respo


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102517: nnimap.el (nnimap-last-response-string): Fix last unfolding fix.
Date: Thu, 25 Nov 2010 23:43:16 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102517
author: Lars Magne Ingebrigtsen <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Thu 2010-11-25 23:43:16 +0000
message:
  nnimap.el (nnimap-last-response-string): Fix last unfolding fix.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/nnimap.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-11-25 23:20:19 +0000
+++ b/lisp/gnus/ChangeLog       2010-11-25 23:43:16 +0000
@@ -7,6 +7,7 @@
 
        * nnimap.el (nnimap-unfold-quoted-lines): Refactor out.
        (nnimap-last-response-string): Unfold quoted lines, if they exist.
+       (nnimap-last-response-string): Fix last unfolding fix.
 
 2010-11-25  Katsumi Yamaoka  <address@hidden>
 

=== modified file 'lisp/gnus/nnimap.el'
--- a/lisp/gnus/nnimap.el       2010-11-25 23:05:10 +0000
+++ b/lisp/gnus/nnimap.el       2010-11-25 23:43:16 +0000
@@ -180,7 +180,14 @@
          (when (eobp)
            (return)))
        (setq article (match-string 1))
-       (nnimap-unfold-quoted-lines)
+       ;; Unfold quoted {number} strings.
+       (while (re-search-forward "[^]][ (]{\\([0-9]+\\)}\r?\n"
+                                 (1+ (line-end-position)) t)
+         (setq size (string-to-number (match-string 1)))
+         (delete-region (+ (match-beginning 0) 2) (point))
+         (setq string (buffer-substring (point) (+ (point) size)))
+         (delete-region (point) (+ (point) size))
+         (insert (format "%S" string)))
        (setq bytes (nnimap-get-length)
              lines nil)
        (beginning-of-line)
@@ -212,12 +219,13 @@
 
 (defun nnimap-unfold-quoted-lines ()
   ;; Unfold quoted {number} strings.
-  (while (re-search-forward "[^]][ (]{\\([0-9]+\\)}\r\n"
-                           (1+ (line-end-position)) t)
-    (setq size (string-to-number (match-string 1)))
-    (delete-region (+ (match-beginning 0) 2) (point))
-    (setq string (delete-region (point) (+ (point) size)))
-    (insert (format "%S" string))))
+  (let (size string)
+    (while (re-search-forward " {\\([0-9]+\\)}\r?\n" nil t)
+      (setq size (string-to-number (match-string 1)))
+      (delete-region (1+ (match-beginning 0)) (point))
+      (setq string (buffer-substring (point) (+ (point) size)))
+      (delete-region (point) (+ (point) size))
+      (insert (format "%S" string)))))
 
 (defun nnimap-get-length ()
   (and (re-search-forward "{\\([0-9]+\\)}" (line-end-position) t)
@@ -1607,11 +1615,11 @@
     (let ((end (point)))
       ;; Unfold quoted {num} lines, if they exist.
       (when (search-backward "}" nil t)
-       (save-excursion
-         (save-restriction
-           (narrow-to-region (point-min) end)
-           (goto-char (point-min))
-           (nnimap-unfold-quoted-lines))))
+       (save-restriction
+         (narrow-to-region (point-min) end)
+         (goto-char (point-min))
+         (nnimap-unfold-quoted-lines)
+         (goto-char (setq end (point-max)))))
       (forward-line -1)
       (when (not (bobp))
        (forward-line -1)


reply via email to

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