Sync up with nana-gnus-6_13_2.
authorkeiichi <keiichi>
Fri, 18 Jun 1999 06:28:59 +0000 (06:28 +0000)
committerkeiichi <keiichi>
Fri, 18 Jun 1999 06:28:59 +0000 (06:28 +0000)
Nana-TIPS.ja
lisp/gnus-sum.el
lisp/mess-lcl.el
lisp/message.el
lisp/nnheader.el
lisp/nnmail.el

index 7dfd05d..673ef56 100644 (file)
@@ -11,6 +11,12 @@ SEMI \e$B$O\e(B 1.12.1 \e$B0J>e$N$b$N\e(B (1.13 \e$B7ONs$N:G?7$N$b$N$r?d>)$7$^$9!#\e(B
 \e$B$,I,MW$G$9!#\e(B
 ====================================================================
 
+* Cancel sending message from hooks.
+
+`mesage-send-hook' \e$B$K@_Dj$5$l$?4X?tFb$G!"\e(B
+(throw 'message-sending-cancel t) 
+\e$B$H$9$k$3$H$K$h$C$F!"%a%C%;!<%8$NAw?.$r<h$j$d$a$k$3$H$,$G$-$^$9!#\e(B
+
 * Fuzzy matching
 
 gnus-simplify-buffer-fuzzy
index d0dcc55..8d86fad 100644 (file)
@@ -1071,20 +1071,13 @@ gnus-simplify-subject-fuzzy-regexp."
       (gnus-simplify-buffer-fuzzy-step
        "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
       (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
-
     (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
-    (gnus-simplify-buffer-fuzzy-step " +" " ")
-    (setq modified-tick nil)
-    (while (not (eq modified-tick (buffer-modified-tick)))
-      (setq modified-tick (buffer-modified-tick))
-      (gnus-simplify-buffer-fuzzy-step
-       "\\([^\000-\177]\\) \\([^\000-\177]\\)" "\\1\\2")
-      (gnus-simplify-buffer-fuzzy-step
-       "\\([\000-\177]\\) \\([^\000-\177]\\)" "\\1\\2")
-      (gnus-simplify-buffer-fuzzy-step
-       "\\([^\000-\177]\\) \\([\000-\177]\\)" "\\1\\2"))
-    (gnus-simplify-buffer-fuzzy-step " $")
-    (gnus-simplify-buffer-fuzzy-step "^ +")))
+    (goto-char (point-min))
+    (while (re-search-forward " +" nil t)
+      (delete-region (match-beginning 0) (match-end 0))
+      (or (bolp) (eobp)
+         (> (char-after) 127) (> (char-before) 127)
+         (insert " ")))))
 
 (defun gnus-simplify-subject-fuzzy (subject)
   "Simplify a subject string fuzzily.
index e99e6aa..b0d1ffb 100644 (file)
@@ -164,16 +164,13 @@ then set this function to `message-encode-function'."
            (charsets-mime-charset-alist charsets-mime-charset-alist)
            message-locale-args)
        (message-locale-setup-mime-charset locale-list)
-       (if (catch 'mime-edit-error
-             (save-excursion
-               (mime-edit-pgp-enclose-buffer)
-               (mime-edit-translate-body)
-               ))
-           (error "Translation error!")
-         ))
+       (when (catch 'mime-edit-error
+               (save-excursion
+                 (mime-edit-pgp-enclose-buffer)
+                 (mime-edit-translate-body)))
+         (error "Translation error!")))
       (end-of-invisible)
-      (run-hooks 'mime-edit-exit-hook)
-      )))
+      (run-hooks 'mime-edit-exit-hook))))
 
 ;;;
 ;;; Detect locale.
@@ -290,13 +287,12 @@ then set this function to `message-encode-function'."
                                          default-mime-charset-for-write)))
                             charsets))
                   (intern (downcase charset))
-           (error "Canceled.")))))))
+           (throw 'message-sending-cancel t)))))))
 
 (defun message-mime-charset-recover-ask-y-or-n (default-charset charsets)
-  (or (y-or-n-p (format "MIME charset %s is selected. OK? "
+  (and (y-or-n-p (format "MIME charset %s is selected. OK? "
                        default-charset))
-      (error "Canceled."))
-  default-charset)
+       default-charset))
 
 (defun message-mime-charset-recover-ask-charset (default-charset charsets)
   (let ((alist (mapcar
index 4b816a6..ebab73d 100644 (file)
@@ -2141,57 +2141,62 @@ or error messages, and inform user.
 Otherwise any failure is reported in a message back to
 the user from the mailer."
   (interactive "P")
-  ;; Disabled test.
-  (when (or (buffer-modified-p)
-           (message-check-element 'unchanged)
-           (y-or-n-p "No changes in the buffer; really send? "))
-    ;; Make it possible to undo the coming changes.
-    (undo-boundary)
-    (let ((inhibit-read-only t))
-      (put-text-property (point-min) (point-max) 'read-only nil))
-    (run-hooks 'message-send-hook)
-    (message "Sending...")
-    (let ((message-encoding-buffer
-          (message-generate-new-buffer-clone-locals " message encoding"))
-         (message-edit-buffer (current-buffer))
-         (message-mime-mode mime-edit-mode-flag)
-         (alist message-send-method-alist)
-         (success t)
-         elem sent)
-      (save-excursion
-       (set-buffer message-encoding-buffer)
-       (erase-buffer)
-       (insert-buffer message-edit-buffer)
-       (funcall message-encode-function)
-       (message-fix-before-sending)
-       (while (and success
-                   (setq elem (pop alist)))
-         (when (and (or (not (funcall (cadr elem)))
-                        (and (or (not (memq (car elem)
-                                            message-sent-message-via))
-                                 (y-or-n-p
-                                  (format
-                                   "Already sent message via %s; resend? "
-                                   (car elem))))
-                             (setq success (funcall (caddr elem) arg)))))
-           (setq sent t))))
-      (prog1
-      (when (and success sent)
-       (message-do-fcc)
-       ;;(when (fboundp 'mail-hist-put-headers-into-history)
-       ;; (mail-hist-put-headers-into-history))
-       (run-hooks 'message-sent-hook)
-       (message "Sending...done")
-       ;; Mark the buffer as unmodified and delete auto-save.
-       (set-buffer-modified-p nil)
-       (delete-auto-save-file-if-necessary t)
-       (message-disassociate-draft)
-       ;; Delete other mail buffers and stuff.
-       (message-do-send-housekeeping)
-       (message-do-actions message-send-actions)
-       ;; Return success.
-       t)
-      (kill-buffer message-encoding-buffer)))))
+  (if (catch 'message-sending-cancel
+       ;; Disabled test.
+       (unless (or (buffer-modified-p)
+                   (message-check-element 'unchanged)
+                   (y-or-n-p "No changes in the buffer; really send? "))
+         (throw 'message-sending-cancel t))
+       ;; Make it possible to undo the coming changes.
+       (undo-boundary)
+       (let ((inhibit-read-only t))
+         (put-text-property (point-min) (point-max) 'read-only nil))
+       (run-hooks 'message-send-hook)
+       (message "Sending...")
+       (let ((message-encoding-buffer
+              (message-generate-new-buffer-clone-locals " message encoding"))
+             (message-edit-buffer (current-buffer))
+             (message-mime-mode mime-edit-mode-flag)
+             (alist message-send-method-alist)
+             (success t)
+             elem sent)
+         (unwind-protect
+             (if (save-excursion
+                   (set-buffer message-encoding-buffer)
+                   (erase-buffer)
+                   (insert-buffer message-edit-buffer)
+                   (funcall message-encode-function)
+                   (message-fix-before-sending)
+                   (while (and success
+                               (setq elem (pop alist)))
+                     (and (funcall (cadr elem))
+                          (and (or (not (memq (car elem)
+                                              message-sent-message-via))
+                                   (y-or-n-p
+                                    (format
+                                     "Already sent message via %s; resend? "
+                                     (car elem))))
+                               (setq success (funcall (caddr elem) arg)))
+                          (setq sent t)))
+                   (not (and success sent)))
+                 (throw 'message-sending-cancel t)
+               (message-do-fcc)
+               (run-hooks 'message-sent-hook)
+               (message "Sending...done")
+               ;; Mark the buffer as unmodified and delete auto-save.
+               (set-buffer-modified-p nil)
+               (delete-auto-save-file-if-necessary t)
+               (message-disassociate-draft)
+               ;; Delete other mail buffers and stuff.
+               (message-do-send-housekeeping)
+               (message-do-actions message-send-actions)
+               nil)
+           (kill-buffer message-encoding-buffer))))
+      (progn
+       (message "Canceled")
+       nil)
+    ;; Return success.
+    t))
 
 (defun message-send-via-mail (arg)
   "Send the current message via mail."
index 2267749..8232551 100644 (file)
@@ -801,7 +801,7 @@ find-file-hooks, etc.
        (enable-local-variables nil)
        (after-insert-file-functions nil)
        (find-file-hooks nil))
-    (apply 'find-file-noselect-raw-text-CRLF args)))
+    (apply 'find-file-noselect-as-raw-text-CRLF args)))
 
 (defun nnheader-auto-mode-alist ()
   "Return an `auto-mode-alist' with only the .gz (etc) thingies."
index 04478b0..6ae7287 100644 (file)
@@ -696,7 +696,9 @@ If this variable is `t', do not use password cache.")
                         (setq result 255))))
                  (let ((default-directory "/")
                        (inbox-info (nnmail-parse-spool-file-name inbox)))
-                   (setenv "MAILHOST" (nnmail-spool-mailhost inbox-info))
+                   (and popmail
+                        (setenv "MAILHOST"
+                                (nnmail-spool-mailhost inbox-info)))
                    (setq result
                          (apply
                           'call-process
@@ -705,10 +707,12 @@ If this variable is `t', do not use password cache.")
                             (expand-file-name
                              nnmail-movemail-program exec-directory)
                             nil errors nil 
-                            (concat "po:" (nnmail-spool-maildrop inbox-info))
+                            (concat (if popmail "po:" "")
+                                    (nnmail-spool-maildrop inbox-info))
                             tofile)
-                           (when nnmail-internal-password
-                             (list nnmail-internal-password)))))))
+                           (and popmail
+                                nnmail-internal-password
+                                (list nnmail-internal-password)))))))
                (push inbox nnmail-moved-inboxes)
                (if (and (not (buffer-modified-p errors))
                         (zerop result))
@@ -740,7 +744,7 @@ If this variable is `t', do not use password cache.")
                      (delete-region (point-min) (match-end 0)))
                    (unless (yes-or-no-p
                             (format "movemail: %s (%d return).  Continue? "
-                                    (buffer-string)))
+                                    (buffer-string) result))
                             (error "%s" (buffer-string)))
                    (setq tofile nil)))
                ))))