Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix expiring for nnmbox backend
@ 2013-08-01 17:23 Kan-Ru Chen (陳侃如)
  2013-08-01 21:10 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Kan-Ru Chen (陳侃如) @ 2013-08-01 17:23 UTC (permalink / raw)
  To: ding

(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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix expiring for nnmbox backend
  2013-08-01 17:23 [PATCH] Fix expiring for nnmbox backend Kan-Ru Chen (陳侃如)
@ 2013-08-01 21:10 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-01 21:10 UTC (permalink / raw)
  To: Kan-Ru Chen (陳侃如); +Cc: ding

"Kan-Ru Chen (陳侃如)" <kanru@kanru.info> writes:

> The nnmbox-request-article function should not alter the point
> position of the mbox buffer as it's usually used in a temporary
> buffer.

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-01 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-01 17:23 [PATCH] Fix expiring for nnmbox backend Kan-Ru Chen (陳侃如)
2013-08-01 21:10 ` Lars Magne Ingebrigtsen

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).