emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/gnus/nnmbox.el, v [EMACS_22_BASE]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/gnus/nnmbox.el, v [EMACS_22_BASE]
Date: Tue, 09 Oct 2007 08:55:59 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         EMACS_22_BASE
Changes by:     Miles Bader <miles>     07/10/09 08:55:59

Index: lisp/gnus/nnmbox.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/gnus/nnmbox.el,v
retrieving revision 1.14.2.1
retrieving revision 1.14.2.2
diff -u -b -r1.14.2.1 -r1.14.2.2
--- lisp/gnus/nnmbox.el 25 Jul 2007 04:20:05 -0000      1.14.2.1
+++ lisp/gnus/nnmbox.el 9 Oct 2007 08:55:56 -0000       1.14.2.2
@@ -153,11 +153,11 @@
        (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
        (setq start (point))
        (forward-line 1)
-       (or (and (re-search-forward
-                 (concat "^" message-unix-mail-delimiter) nil t)
-                (forward-line -1))
-           (goto-char (point-max)))
-       (setq stop (point))
+       (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)
@@ -313,39 +313,45 @@
   (nnmbox-possibly-change-newsgroup group server)
   (nnmail-check-syntax)
   (let ((buf (current-buffer))
-       result)
-    (goto-char (point-min))
-    ;; The From line may have been quoted by movemail.
-    (when (looking-at (concat ">" message-unix-mail-delimiter))
-      (delete-char 1))
-    (if (looking-at "X-From-Line: ")
-       (replace-match "From ")
-      (insert "From nobody " (current-time-string) "\n"))
+       result cont)
     (and
      (nnmail-activate 'nnmbox)
-     (progn
-       (set-buffer buf)
+     (with-temp-buffer
+       (insert-buffer-substring buf)
        (goto-char (point-min))
-       (search-forward "\n\n" nil t)
-       (forward-line -1)
+       (cond (;; The From line may have been quoted by movemail.
+             (looking-at (concat ">" message-unix-mail-delimiter))
+             (delete-char 1)
+             (forward-line 1))
+            ((looking-at "X-From-Line: ")
+             (replace-match "From ")
+             (forward-line 1))
+            (t
+             (insert "From nobody " (current-time-string) "\n")))
+       (narrow-to-region (point)
+                        (if (search-forward "\n\n" nil 'move)
+                            (1- (point))
+                          (point)))
        (while (re-search-backward "^X-Gnus-Newsgroup: " nil t)
         (delete-region (point) (progn (forward-line 1) (point))))
        (when nnmail-cache-accepted-message-ids
-        (nnmail-cache-insert (nnmail-fetch-field "message-id") 
+        (nnmail-cache-insert (message-fetch-field "message-id")
                              group
-                             (nnmail-fetch-field "subject")
-                             (nnmail-fetch-field "from")))
+                             (message-fetch-field "subject")
+                             (message-fetch-field "from")))
+       (widen)
        (setq result (if (stringp group)
                        (list (cons group (nnmbox-active-number group)))
                      (nnmail-article-group 'nnmbox-active-number)))
+       (prog1
        (if (and (null result)
                (yes-or-no-p "Moved to `junk' group; delete article? "))
           (setq result 'junk)
-        (setq result (car (nnmbox-save-mail result)))))
-     (save-excursion
-       (set-buffer nnmbox-mbox-buffer)
+            (setq result (car (nnmbox-save-mail result))))
+        (setq cont (buffer-string))))
+     (with-current-buffer nnmbox-mbox-buffer
        (goto-char (point-max))
-       (insert-buffer-substring buf)
+       (insert cont)
        (when last
         (when nnmail-cache-accepted-message-ids
           (nnmail-cache-close))
@@ -360,7 +366,20 @@
     (if (not (nnmbox-find-article article))
        nil
       (nnmbox-delete-mail t t)
+      (insert
+       (with-temp-buffer
       (insert-buffer-substring buffer)
+        (goto-char (point-min))
+        (when (looking-at "X-From-Line:")
+          (delete-region (point) (progn (forward-line 1) (point))))
+        (while (re-search-forward (concat "^" message-unix-mail-delimiter)
+                                  nil t)
+          (goto-char (match-beginning 0))
+          (insert ">"))
+        (goto-char (point-max))
+        (unless (bolp)
+          (insert "\n"))
+        (buffer-string)))
       (nnmbox-save-buffer)
       t)))
 
@@ -430,21 +449,20 @@
   (save-excursion
     (save-restriction
       (narrow-to-region
-       (save-excursion
+       (prog2
         (re-search-backward (concat "^" message-unix-mail-delimiter) nil t)
         (if leave-delim (progn (forward-line 1) (point))
-          (match-beginning 0)))
-       (progn
-        (forward-line 1)
+            (match-beginning 0))
+        (forward-line 1))
         (or (and (re-search-forward (concat "^" message-unix-mail-delimiter)
                                     nil t)
-                 (if (and (not (bobp)) leave-delim)
-                     (progn (forward-line -2) (point))
-                   (match-beginning 0)))
-            (point-max))))
+               (match-beginning 0))
+          (point-max)))
       (goto-char (point-min))
       ;; Only delete the article if no other group owns it as well.
-      (when (or force (not (re-search-forward "^X-Gnus-Newsgroup: " nil t)))
+      (when (or force
+               (not (re-search-forward "^X-Gnus-Newsgroup: " nil t))
+               (search-backward "\n\n" nil t))
        (delete-region (point-min) (point-max))))))
 
 (defun nnmbox-possibly-change-newsgroup (newsgroup &optional server)
@@ -552,14 +570,16 @@
   (let ((delim (concat "^" message-unix-mail-delimiter)))
     (goto-char (point-min))
     ;; This might come from somewhere else.
-    (unless (looking-at delim)
-      (insert "From nobody " (current-time-string) "\n")
-      (goto-char (point-min)))
-    ;; Quote all "From " lines in the article.
+    (if (looking-at delim)
     (forward-line 1)
+      (insert "From nobody " (current-time-string) "\n"))
+    ;; Quote all "From " lines in the article.
     (while (re-search-forward delim nil t)
-      (beginning-of-line)
-      (insert "> "))
+      (goto-char (match-beginning 0))
+      (insert ">")))
+  (goto-char (point-max))
+  (unless (bolp)
+    (insert "\n"))
     (nnmail-insert-lines)
     (nnmail-insert-xref group-art)
     (nnmbox-insert-newsgroup-line group-art)
@@ -569,7 +589,7 @@
        (setq alist (cdr alist))))
     (run-hooks 'nnmail-prepare-save-mail-hook)
     (run-hooks 'nnmbox-prepare-save-mail-hook)
-    group-art))
+  group-art)
 
 (defun nnmbox-insert-newsgroup-line (group-art)
   (save-excursion




reply via email to

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