From: kaoru Date: Tue, 2 Jan 2001 13:44:01 +0000 (+0000) Subject: * wl-draft.el (wl-draft-insert-from-field): Use (length "From: ") X-Git-Tag: wl-2_4_1pre~14 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=7f0cad72bacf1fdba63671c9255edff2eb2a220a;p=elisp%2Fwanderlust.git * wl-draft.el (wl-draft-insert-from-field): Use (length "From: ") instead of magic-number 6. Use `not' instead of `null' for symbol `nil' check (not empty list). (wl-draft-insert-x-face-field): Fixed paren style. * wl-draft.el (wl-draft-insert-x-face-field-here): Use `when' for one-branch conditional statement, instead of `and' and `if'. (wl-draft-forward): Likewise. (wl-draft-add-references): Likewise. (wl-draft-yank-from-mail-reply-buffer): Likewise. * wl-draft.el (wl-draft-delete-myself-from-cc): Refactoring nested conditional steatment. Use `cond' instead of `if'. (wl-draft-confirm): Likewise. --- diff --git a/wl/wl-draft.el b/wl/wl-draft.el index 481bfa9..d6126ac 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -132,7 +132,7 @@ (fullname (user-full-name))) (cond ((eq mail-from-style 'angles) (insert "From: " fullname) - (let ((fullname-start (+ (point-min) 6)) + (let ((fullname-start (+ (point-min) (length "From: "))) (fullname-end (point-marker))) (goto-char fullname-start) ;; Look for a character that cannot appear unquoted @@ -168,11 +168,11 @@ (replace-match "\\1(\\3)" t) (goto-char fullname-start)))) (insert ")\n")) - ((null mail-from-style) + ((not mail-from-style) (insert "From: " login "\n"))))) (defun wl-draft-insert-x-face-field () - "Insert x-face header." + "Insert X-Face header." (interactive) (if (not (file-exists-p wl-x-face-file)) (error "File %s does not exist" wl-x-face-file) @@ -180,21 +180,21 @@ (search-forward mail-header-separator nil t) (beginning-of-line) (wl-draft-insert-x-face-field-here) - (run-hooks 'wl-draft-insert-x-face-field-hook) ; highlight it if you want. - )) + (run-hooks 'wl-draft-insert-x-face-field-hook))) ; highlight it if you want. (defun wl-draft-insert-x-face-field-here () - "Insert x-face field at point." + "Insert X-Face field at point." (let ((x-face-string (elmo-get-file-string wl-x-face-file))) - (if (string-match "^[ \t]*" x-face-string) - (setq x-face-string (substring x-face-string (match-end 0)))) + (when (string-match "^[ \t]*" x-face-string) + (setq x-face-string (substring x-face-string (match-end 0)))) (insert "X-Face: " x-face-string)) - (if (not (= (preceding-char) ?\n)) - (insert ?\n)) - (and (fboundp 'x-face-insert-version-header) ; x-face.el... - (boundp 'x-face-add-x-face-version-header) - x-face-add-x-face-version-header - (x-face-insert-version-header))) + (when (not (= (preceding-char) ?\n)) ; for chomped (choped) x-face-string + (insert ?\n)) + ;; Insert X-Face-Version: field + (when (and (fboundp 'x-face-insert-version-header) + (boundp 'x-face-add-x-face-version-header) + x-face-add-x-face-version-header) + (x-face-insert-version-header))) (defun wl-draft-setup () (let ((field wl-draft-fields) @@ -225,16 +225,12 @@ (defun wl-draft-delete-myself-from-cc (to cc) (let ((myself (or wl-user-mail-address-list (list (wl-address-header-extract-address wl-from))))) - (if wl-draft-always-delete-myself - (elmo-list-delete myself cc) - (if (elmo-list-member myself cc) - (if (elmo-list-member (append to cc) - (mapcar 'downcase wl-subscribed-mailing-list)) - ;; member list is contained in recipients. - (elmo-list-delete myself cc) - cc - ) - cc)))) + (cond (wl-draft-always-delete-myself ; always-delete option + (elmo-list-delete myself cc)) + ((elmo-list-member (append to cc) ; subscribed mailing-list + (mapcar 'downcase wl-subscribed-mailing-list)) + (elmo-list-delete myself cc)) + (t cc)))) (defun wl-draft-forward (original-subject summary-buf) (let (references) @@ -246,8 +242,8 @@ references (mapconcat 'identity references " ") references (wl-draft-parse-msg-id-list-string references) references (wl-delete-duplicates references) - references (if references - (mapconcat 'identity references "\n\t")))) + references (when references + (mapconcat 'identity references "\n\t")))) (wl-draft "" (concat "Forward: " original-subject) nil nil references nil nil nil nil nil nil summary-buf)) (goto-char (point-max)) @@ -423,9 +419,9 @@ (setq ref-list (cons (substring ref (match-beginning 0) (setq st (match-end 0))) ref-list))) - (if (and ref-list - (member mes-id ref-list)) - (setq mes-id nil))) + (when (and ref-list + (member mes-id ref-list)) + (setq mes-id nil))) (when mes-id (save-excursion (when (mail-position-on-field "References") @@ -444,9 +440,9 @@ (insert (save-excursion (set-buffer mail-reply-buffer) - (if decode-it - (decode-mime-charset-region (point-min) (point-max) - wl-mime-charset)) + (when decode-it + (decode-mime-charset-region (point-min) (point-max) + wl-mime-charset)) (buffer-substring-no-properties (point-min) (point-max)))) (when ignored-fields @@ -461,19 +457,20 @@ (t (and wl-draft-cite-func (funcall wl-draft-cite-func)))) ; default cite (run-hooks 'wl-draft-cited-hook) - (and wl-draft-add-references - (if (wl-draft-add-references) - (wl-highlight-headers 'for-draft))) - (if wl-highlight-body-too - (wl-highlight-body-region beg (point-max))))) + (when (and wl-draft-add-references + (wl-draft-add-references)) + (wl-highlight-headers 'for-draft)) ; highlight when added References: + (when wl-highlight-body-too + (wl-highlight-body-region beg (point-max))))) (defun wl-draft-confirm () "Confirm send message." (interactive) (y-or-n-p (format "Send current draft as %s? " - (if (wl-message-mail-p) - (if (wl-message-news-p) "Mail and News" "Mail") - "News")))) + (cond ((and (wl-message-mail-p) (wl-message-news-p)) + "Mail and News") + ((wl-message-mail-p) "Mail") + ((wl-message-news-p) "News"))))) (defun wl-message-news-p () "If exist valid Newsgroups field, return non-nil."