From a56a1cce9283ab4b731a4bc96c06fd4c649d7763 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Thu, 25 Nov 2010 23:05:10 +0000 Subject: [PATCH] nnimap.el (nnimap-unfold-quoted-lines): Refactor out. nnimap.el (nnimap-last-response-string): Unfold quoted lines, if they exist. --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/nnimap.el | 24 +++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 4bc94f9008a..1f1f4cb1f65 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2010-11-25 Lars Magne Ingebrigtsen + + * nnimap.el (nnimap-unfold-quoted-lines): Refactor out. + (nnimap-last-response-string): Unfold quoted lines, if they exist. + 2010-11-25 Katsumi Yamaoka * shr.el (shr-insert): Fix the way to fold lines. diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 86bba98c208..5fd5e2f11c6 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -180,13 +180,7 @@ textual parts.") (when (eobp) (return))) (setq article (match-string 1)) - ;; 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))) + (nnimap-unfold-quoted-lines) (setq bytes (nnimap-get-length) lines nil) (beginning-of-line) @@ -216,6 +210,15 @@ textual parts.") (insert ".") (forward-line 1))))) +(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)))) + (defun nnimap-get-length () (and (re-search-forward "{\\([0-9]+\\)}" (line-end-position) t) (string-to-number (match-string 1)))) @@ -1602,6 +1605,13 @@ textual parts.") (save-excursion (forward-line 1) (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)))) (forward-line -1) (when (not (bobp)) (forward-line -1) -- 2.39.2