Gnus development mailing list
 help / color / mirror / Atom feed
From: "Kan-Ru Chen (陳侃如)" <kanru@kanru.info>
To: ding@gnus.org
Subject: [PATCH] Fix expiring for nnmbox backend
Date: Fri, 02 Aug 2013 01:23:17 +0800	[thread overview]
Message-ID: <87pptxl3zu.fsf@kanru.info> (raw)

(This message does not show up in the group so I posted again.)

The nnmbox-request-article function should not alter the point
position of the mbox buffer as it's usually used in a temporary
buffer.
---
 lisp/nnmbox.el |   50 ++++++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/lisp/nnmbox.el b/lisp/nnmbox.el
index 3228eac..87ca908 100644
--- a/lisp/nnmbox.el
+++ b/lisp/nnmbox.el
@@ -148,28 +148,29 @@
 (deffoo nnmbox-request-article (article &optional newsgroup server buffer)
   (nnmbox-possibly-change-newsgroup newsgroup server)
   (with-current-buffer nnmbox-mbox-buffer
-    (when (nnmbox-find-article article)
-      (let (start stop)
-       (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
-       (setq start (point))
-       (forward-line 1)
-       (setq stop (if (re-search-forward (concat "^"
-                                                 message-unix-mail-delimiter)
-                                         nil 'move)
-                      (match-beginning 0)
-                    (point)))
-       (let ((nntp-server-buffer (or buffer nntp-server-buffer)))
-         (set-buffer nntp-server-buffer)
-         (erase-buffer)
-         (insert-buffer-substring nnmbox-mbox-buffer start stop)
-         (goto-char (point-min))
-         (while (looking-at "From ")
-           (delete-char 5)
-           (insert "X-From-Line: ")
-           (forward-line 1))
-         (if (numberp article)
-             (cons nnmbox-current-group article)
-           (nnmbox-article-group-number nil)))))))
+    (save-excursion
+      (when (nnmbox-find-article article)
+        (let (start stop)
+          (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
+          (setq start (point))
+          (forward-line 1)
+          (setq stop (if (re-search-forward (concat "^"
+                                                    message-unix-mail-delimiter)
+                                            nil 'move)
+                         (match-beginning 0)
+                       (point)))
+          (let ((nntp-server-buffer (or buffer nntp-server-buffer)))
+            (set-buffer nntp-server-buffer)
+            (erase-buffer)
+            (insert-buffer-substring nnmbox-mbox-buffer start stop)
+            (goto-char (point-min))
+            (while (looking-at "From ")
+              (delete-char 5)
+              (insert "X-From-Line: ")
+              (forward-line 1))
+            (if (numberp article)
+                (cons nnmbox-current-group article)
+              (nnmbox-article-group-number nil))))))))
 
 (deffoo nnmbox-request-group (group &optional server dont-check info)
   (nnmbox-possibly-change-newsgroup nil server)
@@ -255,8 +256,9 @@
          (if (setq is-old
                    (nnmail-expired-article-p
                     newsgroup
-                    (buffer-substring
-                     (point) (progn (end-of-line) (point))) force))
+                    (save-excursion
+                       (buffer-substring
+                        (point) (progn (end-of-line) (point)))) force))
              (progn
                (unless (eq nnmail-expiry-target 'delete)
                  (with-temp-buffer
-- 
1.7.10.4



             reply	other threads:[~2013-08-01 17:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 17:23 Kan-Ru Chen (陳侃如) [this message]
2013-08-01 21:10 ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pptxl3zu.fsf@kanru.info \
    --to=kanru@kanru.info \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).