From: teranisi Date: Thu, 2 Sep 2004 15:36:30 +0000 (+0000) Subject: * wl-vars.el (wl-draft-reply-hook): Changed default value. X-Git-Tag: wl-2_11_31~22 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=e146f4a429fe19c8b4710d8e0ed41c5353147de8;p=elisp%2Fwanderlust.git * wl-vars.el (wl-draft-reply-hook): Changed default value. (wl-draft-kill-pre-hook): Set default value as nil. (wl-summary-reply-hook): Ditto. (wl-draft-kill-flags): Abolish. * wl-draft.el (wl-draft-parent-flag): New buffer local variable. (wl-draft-parent-variables): Renamed from wl-draft-reply-saved-variables and added wl-draft-parent-flag. (wl-draft-forward): Call wl-draft-config-info-operation with 'save argument; Add wl-draft-parent-variables to wl-draft-config-variables. (wl-draft-reply): Likewise. (wl-draft-kill-flags): Abolish. (wl-draft-send): Call wl-draft-set-flag-on-parent. (wl-draft-set-flag-on-parent): New function. (wl-draft-setup-parent-flag): Ditto. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index 797651d..b72628b 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,22 @@ +2004-09-03 Yuuichi Teranishi + + * wl-vars.el (wl-draft-reply-hook): Changed default value. + (wl-draft-kill-pre-hook): Set default value as nil. + (wl-summary-reply-hook): Ditto. + (wl-draft-kill-flags): Abolish. + + * wl-draft.el (wl-draft-parent-flag): New buffer local variable. + (wl-draft-parent-variables): Renamed from + wl-draft-reply-saved-variables and added wl-draft-parent-flag. + (wl-draft-forward): Call wl-draft-config-info-operation with 'save + argument; Add wl-draft-parent-variables to + wl-draft-config-variables. + (wl-draft-reply): Likewise. + (wl-draft-kill-flags): Abolish. + (wl-draft-send): Call wl-draft-set-flag-on-parent. + (wl-draft-set-flag-on-parent): New function. + (wl-draft-setup-parent-flag): Ditto. + 2004-09-02 Tetsurou Okazaki * wl-draft.el (wl-draft-kill-flags): Avoid error when diff --git a/wl/wl-draft.el b/wl/wl-draft.el index 771f6a4..878d589 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -92,10 +92,12 @@ e.g. (\"From\" . \"user@domain2\"))))") (defvar wl-draft-parent-number nil) +(defvar wl-draft-parent-flag nil) -(defconst wl-draft-reply-saved-variables +(defconst wl-draft-parent-variables '(wl-draft-parent-folder - wl-draft-parent-number)) + wl-draft-parent-number + wl-draft-parent-flag)) (defvar wl-draft-config-sub-func-alist '((body . wl-draft-config-sub-body) @@ -123,6 +125,7 @@ e.g. (make-variable-buffer-local 'wl-draft-reply-buffer) (make-variable-buffer-local 'wl-draft-parent-folder) (make-variable-buffer-local 'wl-draft-parent-number) +(make-variable-buffer-local 'wl-draft-parent-flag) (defvar wl-draft-folder-internal nil "Internal variable for caching `opened' draft folder.") @@ -294,9 +297,13 @@ e.g. (cons 'References references)) nil nil nil nil parent-folder)) (setq wl-draft-parent-number number) + (wl-draft-config-info-operation wl-draft-buffer-message-number 'save) (goto-char (point-max)) (wl-draft-insert-message) (mail-position-on-field "To") + (setq wl-draft-config-variables + (append wl-draft-parent-variables + wl-draft-config-variables))) (run-hooks 'wl-draft-forward-hook)) (defun wl-draft-self-reply-p () @@ -460,9 +467,10 @@ Reply to author if WITH-ARG is non-nil." (cons 'Mail-Followup-To mail-followup-to)) nil nil nil nil parent-folder) (setq wl-draft-parent-number number) + (wl-draft-config-info-operation wl-draft-buffer-message-number 'save) (setq wl-draft-reply-buffer buf) (setq wl-draft-config-variables - (append wl-draft-reply-saved-variables + (append wl-draft-parent-variables wl-draft-config-variables))) (run-hooks 'wl-draft-reply-hook)) @@ -765,25 +773,6 @@ Reply to author if WITH-ARG is non-nil." (set-buffer-modified-p nil) ; force kill (kill-buffer editing-buffer)))) -(defun wl-draft-kill-flags () - "Remove flags on parent message when current draft is killed." - (let ((buffer (wl-summary-get-buffer wl-draft-parent-folder)) - (number wl-draft-parent-number) - folder) - (if buffer - (with-current-buffer buffer - (dolist (flag wl-draft-kill-flags) - (wl-summary-unset-persistent-mark flag number))) - ;; Parent buffer does not exist. - (when (setq folder (and wl-draft-parent-folder - (string< "" wl-draft-parent-folder) - (wl-folder-get-elmo-folder - wl-draft-parent-folder))) - (elmo-folder-open folder 'load-msgdb) - (dolist (flag wl-draft-kill-flags) - (elmo-folder-unset-flag folder (list wl-draft-parent-number) flag)) - (elmo-folder-close folder))))) - (defun wl-draft-kill (&optional force-kill) "Kill current draft buffer and quit editing." (interactive "P") @@ -1378,7 +1367,12 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed" (message "%sdone" (or wl-draft-verbose-msg mes-string - "Sending...")))) + "Sending..."))) + (with-current-buffer sending-buffer + (when (and wl-draft-parent-flag + wl-draft-parent-number + wl-draft-parent-folder + (wl-draft-set-flag-on-parent wl-draft-parent-flag)))) ;; kill sending buffer, anyway. (and (buffer-live-p sending-buffer) (kill-buffer sending-buffer)))))) @@ -2637,6 +2631,29 @@ been implemented yet. Partial support for SWITCH-FUNCTION now supported." wl-user-agent-headers-and-body-alist 'ignore-case))))) t)) +(defun wl-draft-set-flag-on-parent (flag) + "Set FLAG on parent message." + (let ((buffer (wl-summary-get-buffer wl-draft-parent-folder)) + (number wl-draft-parent-number) + folder) + (if buffer + (with-current-buffer buffer + (wl-summary-set-persistent-mark flag number)) + ;; Parent buffer does not exist. + (when (setq folder (and wl-draft-parent-folder + (wl-folder-get-elmo-folder + wl-draft-parent-folder))) + (elmo-folder-open folder 'load-msgdb) + (elmo-folder-set-flag folder (list wl-draft-parent-number) flag) + (elmo-folder-close folder))))) + +(defun wl-draft-setup-parent-flag (flag) + "Setup a FLAG for parent message." + (when (and (> (length wl-draft-parent-folder) 0) + wl-draft-parent-number) + (setq wl-draft-parent-flag flag) + (wl-draft-config-info-operation wl-draft-buffer-message-number 'save))) + (require 'product) (product-provide (provide 'wl-draft) (require 'wl-version)) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 6f117bc..ddbeb91 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -754,7 +754,8 @@ reasons of system internal to accord facilities for the Emacs variants.") (defvar wl-hook nil "A hook called when Wanderlust is invoked.") -(defvar wl-draft-reply-hook nil +(defvar wl-draft-reply-hook + '((lambda () (wl-draft-setup-parent-flag 'answered))) "A hook called when replied. This hook runs on the draft buffer.") @@ -762,11 +763,10 @@ This hook runs on the draft buffer.") "A hook called when forwarded. This hook runs on the draft buffer.") -(defvar wl-draft-kill-pre-hook '(wl-draft-kill-flags) +(defvar wl-draft-kill-pre-hook nil "A hook called just before the draft buffer is killed.") -(defvar wl-summary-reply-hook - '((lambda () (wl-summary-set-persistent-mark 'answered))) +(defvar wl-summary-reply-hook nil "A hook called when `wl-summary-reply' is called. This hook runs on the summary buffer.") @@ -1781,11 +1781,6 @@ message buffer." :group 'wl-pref :group 'wl-draft) -(defcustom wl-draft-kill-flags '(answered) - "Remove specified flags on parent message when current draft is killed." - :type '(repeat (symbol :tag "flag")) - :group 'wl-draft) - (defcustom wl-subject-re-prefix-regexp "^[ \t]*\\([Rr][Ee][:>][ \t]*\\)*[ \t]*" "*Regexp matching \"Re: \" in the subject line." :type 'regexp