diff options
| author | Lars Magne Ingebrigtsen | 2010-11-25 23:43:16 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2010-11-25 23:43:16 +0000 |
| commit | 733de8e2d0b968cd1c11fd45b2cda9fc8c164364 (patch) | |
| tree | 315b415b066e7e816fdde5cf920706c6c893947e | |
| parent | 443ecb08cdd0691a8b5e7cfa203b5d5707c94f0b (diff) | |
| download | emacs-733de8e2d0b968cd1c11fd45b2cda9fc8c164364.tar.gz emacs-733de8e2d0b968cd1c11fd45b2cda9fc8c164364.zip | |
nnimap.el (nnimap-last-response-string): Fix last unfolding fix.
| -rw-r--r-- | lisp/gnus/ChangeLog | 1 | ||||
| -rw-r--r-- | lisp/gnus/nnimap.el | 32 |
2 files changed, 21 insertions, 12 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 6f79bc2d252..b8e01b6cef5 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | * nnimap.el (nnimap-unfold-quoted-lines): Refactor out. | 8 | * nnimap.el (nnimap-unfold-quoted-lines): Refactor out. |
| 9 | (nnimap-last-response-string): Unfold quoted lines, if they exist. | 9 | (nnimap-last-response-string): Unfold quoted lines, if they exist. |
| 10 | (nnimap-last-response-string): Fix last unfolding fix. | ||
| 10 | 11 | ||
| 11 | 2010-11-25 Katsumi Yamaoka <yamaoka@jpl.org> | 12 | 2010-11-25 Katsumi Yamaoka <yamaoka@jpl.org> |
| 12 | 13 | ||
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 5fd5e2f11c6..58af211ca4b 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -180,7 +180,14 @@ textual parts.") | |||
| 180 | (when (eobp) | 180 | (when (eobp) |
| 181 | (return))) | 181 | (return))) |
| 182 | (setq article (match-string 1)) | 182 | (setq article (match-string 1)) |
| 183 | (nnimap-unfold-quoted-lines) | 183 | ;; Unfold quoted {number} strings. |
| 184 | (while (re-search-forward "[^]][ (]{\\([0-9]+\\)}\r?\n" | ||
| 185 | (1+ (line-end-position)) t) | ||
| 186 | (setq size (string-to-number (match-string 1))) | ||
| 187 | (delete-region (+ (match-beginning 0) 2) (point)) | ||
| 188 | (setq string (buffer-substring (point) (+ (point) size))) | ||
| 189 | (delete-region (point) (+ (point) size)) | ||
| 190 | (insert (format "%S" string))) | ||
| 184 | (setq bytes (nnimap-get-length) | 191 | (setq bytes (nnimap-get-length) |
| 185 | lines nil) | 192 | lines nil) |
| 186 | (beginning-of-line) | 193 | (beginning-of-line) |
| @@ -212,12 +219,13 @@ textual parts.") | |||
| 212 | 219 | ||
| 213 | (defun nnimap-unfold-quoted-lines () | 220 | (defun nnimap-unfold-quoted-lines () |
| 214 | ;; Unfold quoted {number} strings. | 221 | ;; Unfold quoted {number} strings. |
| 215 | (while (re-search-forward "[^]][ (]{\\([0-9]+\\)}\r\n" | 222 | (let (size string) |
| 216 | (1+ (line-end-position)) t) | 223 | (while (re-search-forward " {\\([0-9]+\\)}\r?\n" nil t) |
| 217 | (setq size (string-to-number (match-string 1))) | 224 | (setq size (string-to-number (match-string 1))) |
| 218 | (delete-region (+ (match-beginning 0) 2) (point)) | 225 | (delete-region (1+ (match-beginning 0)) (point)) |
| 219 | (setq string (delete-region (point) (+ (point) size))) | 226 | (setq string (buffer-substring (point) (+ (point) size))) |
| 220 | (insert (format "%S" string)))) | 227 | (delete-region (point) (+ (point) size)) |
| 228 | (insert (format "%S" string))))) | ||
| 221 | 229 | ||
| 222 | (defun nnimap-get-length () | 230 | (defun nnimap-get-length () |
| 223 | (and (re-search-forward "{\\([0-9]+\\)}" (line-end-position) t) | 231 | (and (re-search-forward "{\\([0-9]+\\)}" (line-end-position) t) |
| @@ -1607,11 +1615,11 @@ textual parts.") | |||
| 1607 | (let ((end (point))) | 1615 | (let ((end (point))) |
| 1608 | ;; Unfold quoted {num} lines, if they exist. | 1616 | ;; Unfold quoted {num} lines, if they exist. |
| 1609 | (when (search-backward "}" nil t) | 1617 | (when (search-backward "}" nil t) |
| 1610 | (save-excursion | 1618 | (save-restriction |
| 1611 | (save-restriction | 1619 | (narrow-to-region (point-min) end) |
| 1612 | (narrow-to-region (point-min) end) | 1620 | (goto-char (point-min)) |
| 1613 | (goto-char (point-min)) | 1621 | (nnimap-unfold-quoted-lines) |
| 1614 | (nnimap-unfold-quoted-lines)))) | 1622 | (goto-char (setq end (point-max))))) |
| 1615 | (forward-line -1) | 1623 | (forward-line -1) |
| 1616 | (when (not (bobp)) | 1624 | (when (not (bobp)) |
| 1617 | (forward-line -1) | 1625 | (forward-line -1) |