Synch to No Gnus 200602140155.
authoryamaoka <yamaoka>
Tue, 14 Feb 2006 01:55:36 +0000 (01:55 +0000)
committeryamaoka <yamaoka>
Tue, 14 Feb 2006 01:55:36 +0000 (01:55 +0000)
lisp/ChangeLog
lisp/gnus-draft.el

index c7355d1..d67e5f9 100644 (file)
@@ -1,3 +1,11 @@
+2006-02-14  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-draft.el (gnus-draft-send): Replace message-narrow-to-head
+       with message-narrow-to-headers.
+       (gnus-draft-setup): Narrow to header to run message-fetch-field.
+       (gnus-draft-check-draft-articles articles): New function.
+       (gnus-draft-edit-message, gnus-draft-send-message): Use it.
+
 2006-02-13  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * gnus-art.el (gnus-article-browse-html-parts):
@@ -7,8 +15,8 @@
 
 2006-02-13  Andreas Seltenreich  <uwi7@stud.uni-karlsruhe.de>
 
-        * nnweb.el (nnweb-google-wash-article): Update regexps.
-        (nnweb-group-alist): Use defvoo instead of defvar.
+       * nnweb.el (nnweb-google-wash-article): Update regexps.
+       (nnweb-group-alist): Use defvoo instead of defvar.
 
 2006-02-13  Katsumi Yamaoka  <yamaoka@jpl.org>
 
index a808eef..ced0a40 100644 (file)
@@ -99,6 +99,7 @@
   (interactive)
   (let ((article (gnus-summary-article-number))
        (group gnus-newsgroup-name))
+    (gnus-draft-check-draft-articles (list article))
     (gnus-summary-mark-as-read article gnus-canceled-mark)
     (gnus-draft-setup article group t)
     (set-buffer-modified-p t)
   (let* ((articles (gnus-summary-work-articles n))
         (total (length articles))
         article)
+    (gnus-draft-check-draft-articles articles)
     (while (setq article (pop articles))
       (gnus-summary-remove-process-mark article)
       (unless (memq article gnus-newsgroup-unsendable)
     ;; We read the meta-information that says how and where
     ;; this message is to be sent.
     (save-restriction
-      (message-narrow-to-head)
+      (message-narrow-to-headers)
       (when (re-search-forward
             (concat "^" (regexp-quote gnus-agent-target-move-group-header)
                     ":") nil t)
          (goto-char (point-min))
          (search-forward "\n\n")
          (forward-char -1)
+         (save-restriction
+           (narrow-to-region (point-min) (point))
+           (setq ga
+                 (message-fetch-field gnus-draft-meta-information-header)))
          (insert mail-header-separator)
          (forward-line 1)
-         (setq ga (message-fetch-field gnus-draft-meta-information-header))
          (message-set-auto-save-file-name))))
     (gnus-backlog-remove-article group narticle)
     (when (and ga
   "Say whether ARTICLE is sendable."
   (not (memq article gnus-newsgroup-unsendable)))
 
+(defun gnus-draft-check-draft-articles (articles)
+  "Check whether the draft articles ARTICLES are under edit."
+  (when (equal gnus-newsgroup-name "nndraft:drafts")
+    (let ((buffers (buffer-list))
+         file buffs buff)
+      (save-current-buffer
+       (while (and articles
+                   (not buff))
+         (setq file (nndraft-article-filename (pop articles))
+               buffs buffers)
+         (while buffs
+           (set-buffer (setq buff (pop buffs)))
+           (if (and buffer-file-name
+                    (string-equal (file-truename buffer-file-name)
+                                  (file-truename file))
+                    (buffer-modified-p))
+               (setq buffs nil)
+             (setq buff nil)))))
+      (when buff
+       (let* ((window (get-buffer-window buff t))
+              (frame (and window (window-frame window))))
+         (if frame
+             (gnus-select-frame-set-input-focus frame)
+           (pop-to-buffer buff t)))
+       (error "The draft %s is under edit" file)))))
+
 (provide 'gnus-draft)
 
 ;;; gnus-draft.el ends here