From 7bcb84d33b5e3f5a2957427e47b738465d4f9780 Mon Sep 17 00:00:00 2001 From: keiichi Date: Fri, 18 Jun 1999 06:28:59 +0000 Subject: [PATCH] Sync up with nana-gnus-6_13_2. --- Nana-TIPS.ja | 6 +++ lisp/gnus-sum.el | 19 +++------- lisp/mess-lcl.el | 22 +++++------ lisp/message.el | 107 ++++++++++++++++++++++++++++-------------------------- lisp/nnheader.el | 2 +- lisp/nnmail.el | 14 ++++--- 6 files changed, 87 insertions(+), 83 deletions(-) diff --git a/Nana-TIPS.ja b/Nana-TIPS.ja index 7dfd05d..673ef56 100644 --- a/Nana-TIPS.ja +++ b/Nana-TIPS.ja @@ -11,6 +11,12 @@ SEMI は 1.12.1 以上のもの (1.13 系列の最新のものを推奨します。 が必要です。 ==================================================================== +* Cancel sending message from hooks. + +`mesage-send-hook' に設定された関数内で、 +(throw 'message-sending-cancel t) +とすることによって、メッセージの送信を取りやめることができます。 + * Fuzzy matching gnus-simplify-buffer-fuzzy diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index d0dcc55..8d86fad 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -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. diff --git a/lisp/mess-lcl.el b/lisp/mess-lcl.el index e99e6aa..b0d1ffb 100644 --- a/lisp/mess-lcl.el +++ b/lisp/mess-lcl.el @@ -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 diff --git a/lisp/message.el b/lisp/message.el index 4b816a6..ebab73d 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -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." diff --git a/lisp/nnheader.el b/lisp/nnheader.el index 2267749..8232551 100644 --- a/lisp/nnheader.el +++ b/lisp/nnheader.el @@ -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." diff --git a/lisp/nnmail.el b/lisp/nnmail.el index 04478b0..6ae7287 100644 --- a/lisp/nnmail.el +++ b/lisp/nnmail.el @@ -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))) )))) -- 1.7.10.4