* deuglify.el (gnus-outlook-rearrange-article): Add missing citation
authorReiner Steib <Reiner.Steib@gmx.de>
Fri, 26 May 2006 17:50:12 +0000 (17:50 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Fri, 26 May 2006 17:50:12 +0000 (17:50 +0000)
marks.

* message.el (message-indent-citation): Add optional arguments to allow
using it outside of message buffers.

lisp/ChangeLog
lisp/deuglify.el
lisp/message.el

index 81794f1..1a86e72 100644 (file)
@@ -1,5 +1,11 @@
 2006-05-26  Reiner Steib  <Reiner.Steib@gmx.de>
 
+       * deuglify.el (gnus-outlook-rearrange-article): Add missing citation
+       marks.
+
+       * message.el (message-indent-citation): Add optional arguments to allow
+       using it outside of message buffers.
+
        * gnus-art.el (gnus-article-unfold-long-headers): New variable.
        (gnus-article-treat-unfold-headers): Use it.
        (gnus-article-truncate-lines): New variable.
index 8eb75ce..83cf7fc 100644 (file)
@@ -338,6 +338,7 @@ NODISPLAY is non-nil, don't redisplay the article buffer."
 
 (defun gnus-outlook-rearrange-article (attr-start)
   "Put the text from ATTR-START to the end of buffer at the top of the article buffer."
+  ;; FIXME: 1.  (*) text/plain          ( ) text/html
   (let ((inhibit-read-only t)
        (cite-marks gnus-outlook-deuglify-cite-marks))
     (gnus-with-article-buffer
@@ -352,8 +353,18 @@ NODISPLAY is non-nil, don't redisplay the article buffer."
                    (point-max))))
          ;; handle the case where the full quote is below the
          ;; signature
-         (if (< to attr-start)
+         (when (< to attr-start)
+           (setq to (point-max)))
+         (save-excursion
+           (narrow-to-region attr-start to)
+           (goto-char attr-start)
+           (forward-line)
+           (unless (looking-at ">")
+             (message-indent-citation (point) (point-max) 'yank-only)
+             (goto-char (point-max))
+             (newline)
              (setq to (point-max)))
+           (widen))
          (transpose-regions cur attr-start attr-start to))))))
 
 ;; John Doe <john.doe@some.domain> wrote in message
index 628f804..fe43782 100644 (file)
@@ -3300,14 +3300,15 @@ Numeric argument means justify as well."
     (let ((fill-prefix message-yank-prefix))
       (fill-individual-paragraphs (point) (point-max) justifyp))))
 
-(defun message-indent-citation ()
+(defun message-indent-citation (&optional start end yank-only)
   "Modify text just inserted from a message to be cited.
 The inserted text should be the region.
 When this function returns, the region is again around the modified text.
 
 Normally, indent each nonblank line `message-indentation-spaces' spaces.
 However, if `message-yank-prefix' is non-nil, insert that prefix on each line."
-  (let ((start (point)))
+  (unless start (setq start (point)))
+  (unless yank-only
     ;; Remove unwanted headers.
     (when message-ignored-cited-headers
       (let (all-removed)
@@ -3335,21 +3336,21 @@ However, if `message-yank-prefix' is non-nil, insert that prefix on each line."
       (insert "\n"))
     (while (and (zerop (forward-line -1))
                (looking-at "$"))
-      (message-delete-line))
-    ;; Do the indentation.
-    (if (null message-yank-prefix)
-       (indent-rigidly start (mark t) message-indentation-spaces)
-      (save-excursion
-       (goto-char start)
-       (while (< (point) (mark t))
-         (cond ((looking-at ">")
-                (insert message-yank-cited-prefix))
-               ((looking-at "^$")
-                (insert message-yank-empty-prefix))
-               (t
-                (insert message-yank-prefix)))
-         (forward-line 1))))
-    (goto-char start)))
+      (message-delete-line)))
+  ;; Do the indentation.
+  (if (null message-yank-prefix)
+      (indent-rigidly start (or end (mark t)) message-indentation-spaces)
+    (save-excursion
+      (goto-char start)
+      (while (< (point) (or end (mark t)))
+       (cond ((looking-at ">")
+              (insert message-yank-cited-prefix))
+             ((looking-at "^$")
+              (insert message-yank-empty-prefix))
+             (t
+              (insert message-yank-prefix)))
+       (forward-line 1))))
+  (goto-char start))
 
 (defun message-yank-original (&optional arg)
   "Insert the message being replied to, if any.