;;;
;;;  cmail-vars.el - cmail variables initialization
;;;
;;;  $Author: tmp $
;;;  created at: Mon Jul 12 10:30:57 JST 1993
;;;
;;;  Copyright (C) 1992-1996 Yukihiro Matsumoto.

;; This file is not part of GNU Emacs but obeys its copyright notice.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY.  No author or distributor
;; accepts responsibility to anyone for the consequences of using it
;; or for whether it serves any particular purpose or works at all,
;; unless he says so in writing.  Refer to the GNU Emacs General Public
;; License for full details.

;; Everyone is granted permission to copy, modify and redistribute
;; GNU Emacs, but only under the conditions described in the
;; GNU Emacs General Public License.   A copy of this license is
;; supposed to have been given to you along with GNU Emacs so you
;; can know your rights and responsibilities.  It should be in a
;; file named COPYING.  Among other things, the copyright notice
;; and this notice must be preserved on all copies.

(provide 'cmail-vars)
;(require 'rfc822)
(eval-when-compile (require 'pcustom)
		   (require 'static))

;;
;; ======= customize ショートカットコマンド =============================
(defun cmail-customize nil
  (interactive)
  (if (fboundp 'customize-group)
      (progn
	(customize-group 'cmail)
	(delete-other-windows))
    (error "Sorry, but the custom feature is not available on this system.")))

;;
;; ======= コンパチビリティの確保 =======================================

;; In case when a custom version that does not support :set feature is
;; loaded, to avoid a problem with compiling/running cmail, here goes
;; some workaround definitions. First, for those Emacs that do not
;; support keywords (symbols that begin with a colon), define them for
;; custom use.
(static-if (null (boundp ':cmail-custom-test-symbol))
    (mapcar
     '(lambda (keyword) (or (boundp keyword) (set-default keyword keyword)))
     '(:initialize :set :get :require :prefix :tag
		   :load :link :options :type :group)))

;; Now, test defcustom if it has the :set feature, and if it does not
;; behave as expected, override defcustom with defvar like tinycustom
;; does. Note that all of these should happen at compile time to limit
;; the scope in order to avoid changing run-time behavior of other
;; packages which assume actual custom (such as Gnus). If this module
;; is loaded or evaluated as a lisp source, then the change will be in
;; effect in a global manner, which may cause some trouble to those
;; packages. Please avoid loading or evaluating the source version of
;; this file unless necessary.
(static-if (let (test-sym)
	     (condition-case nil
		 (defcustom *cmail-custom-test-symbol t ""
		   :set '(lambda (sym val) (setq test-sym val)))
	       (error nil))
	     test-sym)
    (defmacro cmail-custom-add-init (init-function sym) nil)
  (eval-when-compile
    (defmacro defcustom (sym val doc &rest rest)
      "An emulated defcustom in cmail-vars.el, when byte-compile only."
      (` (defvar (, sym) (, val) (,doc)))))
  
  ;; For those customizable variables that supports the defcustom
  ;; :set feature (except for cmail-i18n-doc-language), when
  ;; 'tiny' version of defcustom is used, initialization must be
  ;; explicitly executed.  The following macro can be used to set
  ;; up the initializer for such variables, and cmail-custom-init,
  ;; which is called from the function cmail, will initialize the
  ;; instrumented variables.
  (defvar *cmail-custom-initializer nil)
  (defmacro cmail-custom-add-init (init-function sym)
    (` (progn
	 (setq *cmail-custom-initializer
	       (append *cmail-custom-initializer
		       (list (list (, init-function) (, sym))))))))
  
  (defun cmail-custom-init ()
    (mapcar
     (function
      (lambda (init)
	(if (boundp (elt init 1))
	    (funcall (elt init 0) (elt init 1) (eval (elt init 1))))))
     *cmail-custom-initializer)))

;;
;; ======= ドキュメントの複数言語のサポート =============================
(defvar cmail-doc-custgroup nil)
(put 'cmail-i18n-defgroup 'lisp-indent-function 2)
(defmacro cmail-i18n-defgroup (group something doc &rest rest)
  (` (prog1
	 (, (append (` (defgroup (, group) (, something)
			 (, (cdr (car doc))))) rest))
       (, (append (` (setq cmail-doc-custgroup
			   (cons
			    (quote (, (cons group doc)))
			    cmail-doc-custgroup))))))))

(defvar cmail-doc-custvars nil)
(put 'cmail-i18n-defcustom 'lisp-indent-function 2)
(defmacro cmail-i18n-defcustom (name value doc &rest rest)
  (` (prog1
	 (, (append (` (defcustom (, name) (, value)
			 (, (cdr (car doc))))) rest))
       (, (append (` (setq cmail-doc-custvars
			   (cons
			    (quote (, (cons name doc)))
			    cmail-doc-custvars))))))))

(defun cmail-i18n-set-doc-language (symbol language)
  (set symbol language)
  (cmail-i18n-swap-doc language))

(defun cmail-i18n-swap-doc (language)
  (cmail-i18n-swap-doc2 language 'variable-documentation cmail-doc-custvars)
  (cmail-i18n-swap-doc2 language 'group-documentation cmail-doc-custgroup))

(defun cmail-i18n-swap-doc2 (language doc-property doc-list)
  (while doc-list
    (setq doc (cdr (assq language (cdr (car doc-list)))))
    (if (stringp doc)
	(put (car (car doc-list)) doc-property doc))
    (setq doc-list (cdr doc-list))))

;;
;; ======= カスタマイズグループ設定 =====================================
(cmail-i18n-defgroup cmail nil
  ((ja_JP . "Emacs 用のメールリーダ")
   (en_US . "Yet another mail reader for Emacs"))
  :group 'mail)

(cmail-i18n-defgroup cmail-general nil
  ((ja_JP . "ユーザ情報、環境等の設定")
   (en_US . "Account, user info and environments."))
  :group 'cmail)

(cmail-i18n-defgroup cmail-directories nil
  ((ja_JP . "使用ディレクトリ、メールスプールの設定.")
   (en_US . "Directories, mail spools, POP account."))
  :group 'cmail-general)

(cmail-i18n-defgroup cmail-mime nil
  ((ja_JP . "MIME 関係の設定.")
   (en_US . "MIME related options."))
  :group 'cmail-general)

(cmail-i18n-defgroup cmail-other-features nil
  ((ja_JP . "他のパッケージ関係の設定.")
   (en_US . "Options for other packages."))
  :group 'cmail-general)

(cmail-i18n-defgroup cmail-startup nil
  ((ja_JP . "スタートアップの設定")
   (en_US . "Start up options."))
  :group 'cmail-general)

(cmail-i18n-defgroup cmail-display-style nil
  ((ja_JP . "文字色、表示スタイル等の設定.")
   (en_US . "Typeface, display styles options."))
  :group 'cmail-general)

(cmail-i18n-defgroup cmail-menu-style nil
  ((ja_JP . "メニューの設定")
   (en_US . "Menu customization."))
  :group 'cmail-general)

(cmail-i18n-defgroup cmail-printing nil
  ((ja_JP . "印刷の設定")
   (en_US . "Printing options"))
  :group 'cmail-general)

(cmail-i18n-defgroup cmail-archive nil
  ((ja_JP . "フォルダ操作/自動分類に関する設定.")
   (en_US . "Customize folder file manipulation and auto archiving."))
  :group 'cmail)

(cmail-i18n-defgroup cmail-summary nil
  ((ja_JP . "サマリモードに関する設定.")
   (en_US . "Customize cmail summary mode."))
  :group 'cmail)

(cmail-i18n-defgroup cmail-readmail nil
  ((ja_JP . "受信メールの表示に関する設定.")
   (en_US . "Customize cmail message viewer."))
  :group 'cmail)

(cmail-i18n-defgroup cmail-sendmail nil
  ((ja_JP . "送信メールの操作に関する設定.")
   (en_US . "Customize cmail mail composer."))
  
  :group 'cmail)

(cmail-i18n-defgroup cmail-folders nil
  ((ja_JP . "フォルダ一覧モードに関する設定.")
   (en_US . "Customize cmail folders list mode."))
  :group 'cmail)

(cmail-i18n-defgroup cmail-all-variables nil
  ((ja_JP . "全てのカスタマイズ変数のリスト.")
   (en_US . "List of all customizable variable in cmail."))
  :group 'cmail)

;;
;; ======= 初期設定 ==================================================
(cmail-i18n-defcustom cmail-folder-alist nil
  ((ja_JP . "\
*メイルを自動的にフォルダに分けるためのalist.

		(header (pattern . folder))

の並びになっている. 連想リストの先頭に近いほど優先順位が高くなっている.
以下はその連想リストの例である.

((\"From\" (\"foo\" . \"FOO\")
         (\"bar\" . \"BAR\"))
 (\"Cc\" (\"glorp\" . \"GLORP\"))
 (\"Subject\" (\"nerp\" . \"NERP\"))
 (\"Header_field\" (\"header_value\" . \"FOLDER_NAME\")))

フォルダ指定リストの代わりに関数を指定すると, その関数の返す値が,
文字列の時, 戻り値の示すフォルダに分類される. 関数が呼ばれる時には
current-folderにはメイルのヘッダが格納されている.")
   (en_US . "\
*An association list used for the automatic archiving.

Value shall be a list of lisp expressions with the following form.

		(header (pattern . folder))

An element is used as in the order it appears in the list. The
following is an example association list.

((\"From\" (\"foo\" . \"FOO\")
         (\"bar\" . \"BAR\"))
 (\"Cc\" (\"glorp\" . \"GLORP\"))
 (\"Subject\" (\"nerp\" . \"NERP\"))
 (\"Header_field\" (\"header_value\" . \"FOLDER_NAME\")))

Instead of a list of pattern/folder list, you may use a function which
returns a string as the destination folder. At the time the function
is called, it is coordinated such that the current buffer contains the
message header of the message being processed."))
  :type 'sexp
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-sort-header-alist nil
  ((ja_JP . "\
*フォルダ毎にサマリのソート方法を指定するための alist.

以下のどちらかの並びになっている. 連想リストの先頭に近いほど
優先順位が高くなっている.

		(key (folder …))
		(key (pattern (folder …)))

以下はその前者の連想リストの例である.

((\"S\" (\"foo\" \"bar\" \"hoge\" \"uja\"))
 (\"A\" (\"glorp\" \"nerp\"))
 (\"D\" (\"archive\"))
 (\"R\" (\"folder\" \"folder_name\" \"etc\")))

ここで, \"S\"もしくは\"s\"はサブジェクト順のサマリソートを表し,
\"R\"もしくは\"r\"は関連のあるサブジェクト順のサマリソートを,
\"A\"もしくは\"a\"は送り主の名前順のサマリソートを, \"D\"もしくは
\"d\"は日付順のサマリソートを, \"T\"もしくは\"t\"は時刻を含む日付順の
サマリソートをそれぞれ表す.

また, 以下に後者の連想リストの例を示す.

((\"N\" (\"X-MAIL-Count\" (\"foo\" \"bar\"))
      (\"X-Sequence\" (\"hoge\" \"uja\")))
 (\"H\" (\"Header-Field\" (\"glorp\" \"nerp\")))
 (\"F\" (func_name (\"folder_name\" \"etc\"))))

ここで, \"N\"もしくは\"n\"は数値に変換可能なフィールドを持つヘッダを
ソートに使用し, \"H\"もしくは\"h\"はそれ以外のフィールドを持つヘッダ
をソートに使用する. また, \"F\"もしくは\"f\"の場合は関数を指定して, 
その戻り値をソートに使用する.")

   (en_US . "\
*Association list to specify sort pedicate for folders.

Either the following two foramt. The element that appears first has
precedence.

		(key (folder …))
		(key (pattern (folder …)))

The following is an example of the former format.

((\"S\" (\"foo\" \"bar\" \"hoge\" \"uja\"))
 (\"A\" (\"glorp\" \"nerp\"))
 (\"D\" (\"archive\"))
 (\"R\" (\"folder\" \"folder_name\" \"etc\")))

Where \"S\" or \"s\" specifies sort by subject. \"R\" or \"r\" specifies
sort by related subject, \"A\" or \"a\" specifies sort by sender address,
\"D\" or \"d\" specifies sort by date, \"T\" or \"t\" specifies sort by
time.

Next, the following is an example of the latter format.

((\"N\" (\"X-MAIL-Count\" (\"foo\" \"bar\"))
      (\"X-Sequence\" (\"hoge\" \"uja\")))
 (\"H\" (\"Header-Field\" (\"glorp\" \"nerp\")))
 (\"F\" (func_name (\"folder_name\" \"etc\"))))

Where \"N\" or \"n\" specifies sort by value in the specified header
field if convertible to a number, \"H\" or \"h\" specifies sort by
other field than specified, and \"F\" or \"f\" specifies function
whose return value will be used to sort."))
  :type 'sexp
  :group 'cmail-all-variables
  :group 'cmail-summary)

(cmail-i18n-defcustom cmail-sort-header-default nil
  ((ja_JP . "\
*サマリのデフォルトのソート方法の指定

cmail-sort-header-alist の指定にマッチしないフォルダのみに適用される.
cmail-sort-header-alist の key として使用される
\"S\", \"R\", \"A\", \"D\", \"T\" (それぞれ小文字も可能)を指定すること
が可能.")
   (en_US . "\
*Default sort predicate charactor

Only applied to folders that do not match cmail-sort-header-alist.
Sort predicate charactors \"S\", \"R\", \"A\", \"D\", \"T\" (lower
letter is accepted) used in cmail-sort-header-alist may be used for
this variable as well."))
  :type '(choice (const nil)
		 (const :tag "Subject" "S")
		 (const :tag "Related Subject" "R")
		 (const :tag "Sender" "A")
		 (const :tag "Date" "D")
		 (const :tag "Time" "T"))
  :group 'cmail-all-variables
  :group 'cmail-summary)

(defvar cmail-default-headers '(("From")("To")("Cc")("Subject"))
  "cmail-mark-specified-mailsで補完するヘッダ名")

;; expire機能はfloatのない古いemacsではサポートされない．
(cmail-i18n-defcustom cmail-use-regexp-in-folder-alist nil
  ((ja_JP . "\
*cmail-folder-alist の中に elisp の正規表現を使用するかどうか.  

使用する場合、記述が間違っていると正規表現の展開エラーが出る
可能性がある.")

   (en_US . "\
*Whether to allow regular expression in cmail-folder-alist.

Note that if regular expression is used, a parsing error could occur
and automatic archiving might be aborted abnormally when the regular
expression syntax is incorrect."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-auto-expirable-folders nil
  ((ja_JP . "\
*既に読んだメイルをexpireするフォルダのリスト．")
   (en_US . "\
*list of folders to expire read messages."))
  :type '(repeat string)
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-expiry-days-alist nil
  ((ja_JP . "\
*フォルダ毎のexpiry days の指定.")
   (en_US . "\
*An assoc list specifies number of days to keep messages per folder."))
  :type '(choice (const nil)
		 (repeat (cons string integer)))
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-default-expiry-days 7
  ((ja_JP . "\
*cmail-expiry-days-alist で設定されていないフォルダの expiry-days．")
   (en_US . "\
*Days to keep msgs in folders unspecified by cmail-expiry-days-alist"))
  :type 'integer
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-archive-on-get nil 
  ((ja_JP . "\
*non-nilの時, 新着mailのget時にauto-archiveする.")
   (en_US . "\
*Whether to perform auto archive immediately after getting new messages."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-archive-on-quit t
  ((ja_JP . "\
*non-nilの時, quit時にauto-archiveする.")
   (en_US . "\
*Whether to perform auto archive just before quitting cmail."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-archive-on-visit t
  ((ja_JP . "\
*non-nilの時, visit時にauto-archiveする.")
   (en_US . "\
*Whether to perform auto archive just before visiting another folder."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-expunge-on-save t
  ((ja_JP . "\
*non-nilの時, save前にフォルダを整理する.

値が整数の場合, フォルダ内のmail数がその値以下の場合だけ整理する.")

   (en_US . "\
*Expunge messages before saving the visiting folder, if this is non-nil.

If this value is integer, expunge only when the folder contains less
number of messages than the number."))
  :type '(choice (const t) (const nil) integer)
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-default-from nil
  ((ja_JP . "\
自分自身のアドレス文字列.

non-nil の時その値を From に, cmail-always-cc-me が on の時はCC にもセッ
トする. また, cmail-self-addresses が明示的に指定されない場合, この値
が自分自身を判定する文字列として使用される. (user@FQDN) のフォーマット
でないと誤動作する可能性がある.")
   (en_US . "\
Address string for yourself.

When non-nil, the value is used in the FROM field, and added to CC
list if cmail-always-cc-me is on. In addition, if cmail-self-addresses is
not explicitly designated, this string will be used to determine if an
address is considered as a self-address. It should be in (user@FQDN)
format, or may cause unexpected behavior."))
  :type '(choice (const nil) string)
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-self-addresses 'auto
  ((ja_JP . "\
*自分自身とみなすアドレスにマッチする文字列/正規表現のリスト. 

'auto の時は自分自身のアドレス (cmail-default-from もしくは自動的に生
成されたもの) が使用される.

文字列もしくは正規表現のリスト. 文字列が \"regexp: \" で始まっている場
合正規表現であるとみなされる. パターンマッチはアドレス部の addr-spec 
部分で行われる. 名前等コメントはパターンマッチの対象にならないので注意.

例:
     foo@bar.org              ; foo@bar.org にマッチする
     regexp: foo@.*\\.bar\\.org ; bar.org 内のサブドメイン内のユーザ
                              ; foo にマッチする
")
   (en_US . "\
*A list of address strings that represents your self email address.

When 'auto, your address (derived from either cmail-default-from or
automatically generated) will be used.

The data type is string, and may contain a regular expression. A
string that starts with \"regexp: \" is processed as a regular
expression. The target string for the address pattern match is
restricted to only the addr-spec part. Comments such as quoted names
will be exclueded from the target string.

Examples:
     foo@bar.org              ; match for foo@bar.org
     regexp: foo@.*\\.bar\\.org ; match for user foo of a sub-domain
                              ; under bar.org domain
"))
  :type '(choice (const auto) (repeat string))
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-dont-cc-me-destinations nil
  ((ja_JP . "\
*メッセージ宛先がこのリストに含まれている場合は自分を CC につけない.

文字列もしくは正規表現のリスト. 文字列が \"regexp: \" で始まっている場
合正規表現であるとみなされる. パターンマッチはアドレス部の addr-spec 
部分で行われる. 名前等コメントはパターンマッチの対象にならないので注意.

例:
     foo@bar.org              ; foo@bar.org にマッチする
     regexp: foo@.*\\.bar\\.org ; bar.org 内のサブドメイン内のユーザ
                              ; foo にマッチする
")
   (en_US . "\
*Don't add myself to CC when destination is found in this list.

The data type is string, and may contain a regular expression. A
string that starts with \"regexp: \" is processed as a regular
expression. The target string for the address pattern match is
restricted to only the addr-spec part. Comments such as quoted names
will be exclueded from the target string.

Examples:
     foo@bar.org              ; match for foo@bar.org
     regexp: foo@.*\\.bar\\.org ; match for user foo of a sub-domain
                              ; under bar.org domain
"))
  :type '(repeat string)
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-always-cc-me '(when-follow-up)
  ((ja_JP . "\
*自分自身のアドレスを CC につける機能の制御変数．

値は t, nil またはオプションのリストでオプションは when-new-compose
when-reply, when-follow-up, when-used-as-agent が可能. t の時は全ての
メール作成時にCC自分付加機能を有効にする．新しいメールの作成時，返信メー
ル作成時フォローアップメール作成時に別々にCC自分付加機能を有効にする時
には対応するオプションをリストにしてこの変数にセットしておく．")
   (en_US . "\
*Option variable to control the function to add self address to CC.

The value can be either t, nil or a list of option atoms. The option
atoms include when-new-compose, when-reply, when-follow-up and
when-used-as-agent. When t, the CC-me function is enabled for all mail
composition types. To enable the CC-me function selectibly for each
differnt type of mail composition, list corresponding option atoms in
this variable."))
  :type '(choice (const t)
		 (repeat (choice (const when-new-compose)
				 (const when-reply)
				 (const when-follow-up)
				 (const when-used-as-agent))))
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-dont-cc-addresses 'self
  ((ja_JP . "\
follow-up の際，CC に含めないアドレスのリスト.

'self の時は自分自身のアドレス (cmail-default-from もしくは自動的に
生成されたもの) が使用される.

文字列もしくは正規表現のリスト. 文字列が \"regexp: \" で始まっている場
合正規表現であるとみなされる. パターンマッチはアドレス部の addr-spec 
部分で行われる. 名前等コメントはパターンマッチの対象にならないので注意.

例:
     foo@bar.org              ; foo@bar.org にマッチする
     regexp: foo@.*\\.bar\\.org ; bar.org 内のサブドメイン内のユーザ
                              ; foo にマッチする
")
   (en_US . "\
List of addresses to be excluded from the CC field when forwarding.

When 'self, your address (derived from either cmail-default-from or
automatically generated) will be used.

The data type is string, and may contain a regular expression. A
string that starts with \"regexp: \" is processed as a regular
expression. The target string for the address pattern match is
restricted to only the addr-spec part. Comments such as quoted names
will be exclueded from the target string.

Examples:
     foo@bar.org              ; match for foo@bar.org
     regexp: foo@.*\\.bar\\.org ; match for user foo of a sub-domain
                              ; under bar.org domain
"))
  :type '(choice (const self) (repeat string))
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-dont-reply-to-addresses 'self
  ((ja_JP . "\
*follow-up の際、TO に含めないアドレスのリスト.

'self の時は自分自身のアドレス (cmail-default-from もしくは自動的に
生成されたもの) が使用される.

文字列もしくは正規表現のリスト. 文字列が \"regexp: \" で始まっている場
合正規表現であるとみなされる. パターンマッチはアドレス部の addr-spec 
部分で行われる. 名前等コメントはパターンマッチの対象にならないので注意.

例:
     foo@bar.org              ; foo@bar.org にマッチする
     regexp: foo@.*\\.bar\\.org ; bar.org 内のサブドメイン内のユーザ
                              ; foo にマッチする
")
   (en_US . "\
*List of addresses to be excluded from To field when reply/follow-up.

When 'self, your address (derived from either cmail-default-from or
automatically generated) will be used.

The data type is string, and may contain a regular expression. A
string that starts with \"regexp: \" is processed as a regular
expression. The target string for the address pattern match is
restricted to only the addr-spec part. Comments such as quoted names
will be exclueded from the target string.

Examples:
     foo@bar.org              ; match for foo@bar.org
     regexp: foo@.*\\.bar\\.org ; match for user foo of a sub-domain
                              ; under bar.org domain
"))
  :type '(choice (const self) (repeat string))
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-select-from-alist nil
  ((ja_JP . "\
*From: アドレスを選択するための alist. 
新しいメールの作成時，返信メール作成時, フォローアップメール作成時に
参照される. From: アドレスと宛先の連想リストで,

		(from-address (to-pattern ...))

あるいは,

		(from-address (to-pattern ...) full-name)

の並びになっている. 連想リストの先頭に近いほど優先順位が高くなっている.
以下はその連想リストの例である.

((\"foo@bar.org\" (\"@foo.com$\" \"@bar.org$\") \"Foo Bar\")
 (\"usr@b.ne.jp\" (\".org$\" \".net$\" \".edu$\") \"cmail user\")
 (\"user@baz.jp\" (\".co.jp$\" \".ac.jp$\" \"to@a.gr.jp$\"))
 (\"foo@bar.com\" (\"DEFAULT\") \"Default from\"))

宛先の \"DEFAULT\" は, それより優先順位の高い連想リストに当てはまらない
宛先がすべてマッチする.

\"sendmail.el\" や \"feedmail.el\" で使用される変数 \"mail-from-style\"
の値により, From: アドレスの表示形式が決定される.

例:
     \"mail-from-style\" 未定義    From: Foo Bar <foo@bar.org>
     'angles                     From: Foo Bar <foo@bar.org>
     'parens                     From: foo@bar.org (Foo Bar)
     nil                         From: foo@bar.org

\"cmail-default-from\" は, この定義より優先的に使用される.
")
   (en_US . "\
*An association list used for selecting From: address
when composing new mail, reply mail or follow-up mail.

Value shall be a list of lisp expressions with the following form:

		(from-address (to-pattern ...))

or

		(from-address (to-pattern ...) full-name)

An element is used as in the order it appears in the list. The
following is an example association list.

((\"foo@bar.org\" (\"@foo.com$\" \"@bar.org$\") \"Foo Bar\")
 (\"usr@b.ne.jp\" (\".org$\" \".net$\" \".edu$\") \"cmail user\")
 (\"user@baz.jp\" (\".co.jp$\" \".ac.jp$\" \"to@a.gr.jp$\"))
 (\"foo@bar.com\" (\"DEFAULT\") \"Default from\"))

The value \"DEFAULT\" is a special To: address pattern that will match
all addresses.

The style of From: address will be decided by valiable
\"mail-from-style\" used in \"sendmail.el\" or \"feedmail.el\".

Examples:
     \"mail-from-style\" undefined    From: Foo Bar <foo@bar.org>
     'angles                        From: Foo Bar <foo@bar.org>
     'parens                        From: foo@bar.org (Foo Bar)
     nil                            From: foo@bar.org

Variable \"cmail-default-from\" takes precedence of this variable
definition.
"))
  :type 'sexp
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-mail-insert-x-mailer t
  ((ja_JP . "\
Non-nil の時，送るメイルにX-Mailerを付加する.")
   (en_US . "\
Non-nil means attach X-Mailer field to every out-going message."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-mail-query-cc nil
  ((ja_JP . "\
Non-nil の時メール作成バッファを呼び出す時に CC を尋ねる.")
   (en_US . "\
Non-nil means to prompt for CC address when invoking the draft mode."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-path "~/Mail/"
  ((ja_JP . "\
*フォルダを保持するディレクトリ. 最後は必ずスラッシュ/で終わる.")
   (en_US . "\
*Directory to store all folders. String must end with '/' (slash)."))
  :type '(directory)
  :group 'cmail-all-variables
  :group 'cmail-directories)

(cmail-i18n-defcustom cmail-compressed-folders nil
  ((ja_JP . "\
*値が'jam-zcatである時, フォルダ補完リストで.gz|.Zが取り除かれる.

圧縮フォルダのアクセスにはjam-zcatまたはjka-comprが必要.")
   (en_US . "\
*When 'jam-zcat, suffix .gz|.Z will be hidden from the folder names.

To use compressed folders, either jam-zcat or jka-compr is required."))
  :type '(choice (const nil) (const jam-zcat))
  :group 'cmail-all-variables
  :group 'cmail-archive)

(defvar *cmail-crash-box "~/cmail.crash" "クラッシュファイル.")

(cmail-i18n-defcustom cmail-folder-modes 384
  ((ja_JP . "\
フォルダのパーミッション(デフォルトモード 0600 octal)")
   (en_US . "\
File permission mode for folders. (Default 0600 octal)"))
  :type 'integer
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-save-to cmail-path
  ((ja_JP . "\
*変換したメイルやフォルダをセーブする先のディレクトリ.

最後は必ずスラッシュ/で終わる.")
   (en_US . "\
*Directory where converted messages and/or folders are saved.

The directory name must end with '/' (slash)"))
  :type 'string
  :group 'cmail-all-variables
  :group 'cmail-directories)

(cmail-i18n-defcustom cmail-work-dir cmail-path
  ((ja_JP . "\
*cmail-pipeを実行するディレクトリ.")
   (en_US . "\
*Directory where a shell command is executed by cmail-pipe"))
  :type 'string
  :group 'cmail-all-variables
  :group 'cmail-directories)

(cmail-i18n-defcustom cmail-addresses "~/.addresses"
  ((ja_JP . "\
*ユーザの補完用アドレスファイル.

書式は,

	E-mail-address	Comment

の, 羅列である. Commentは参照しない.")
   (en_US . "\
*Address file name for the address completion feature.

Format shall be repeat of the following line:

        E-mail-address  Comment

Comment is ignored."))
  :type 'string
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-ok-if-backup-exists "DELETE"
  ((ja_JP . "\
*\"OK\"の場合, cmailを立ち上げる時にバックアップがあっても消去しない.

\"DELETE\"の場合は, 自動的に消去する. nilの場合は消去の確認を行なう.")
   (en_US . "\
*If \"OK\", cmail will not delete backup folder files when starting up.

If \"DELETE\", cmail automatically deletes backup folder files.
If nil, cmail prompts for confirmation before deleting the files."))
  :type 'string
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-query-delete nil
  ((ja_JP . "\
*non-nilのとき, メイルを削除する際に一つ一つ確認を行なう.")
   (en_US . "\
*Non-nil means prompt for confirmation for each message deletion."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-query-save-folder nil
  ((ja_JP . "\
*non-nilのとき, フォルダをセーブする際に一つ一つ確認を行なう.")
   (en_US . "\
*Non-nil means prompt for confirmation for each folder saving."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-check-virtual-folder-on-clean t
  ((ja_JP . "\
*non-nilの時, virtual-folderの削除の時, メイルがあれば確認をとる.")
   (en_US . "\
*Non-nil means prompt user before deleting non-empty virtual folder."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-print-proc (lambda ()
			      (shell-command-on-region 
			       (point-min) (point-max) cmail-print-command t))
  ((ja_JP . "\
*印刷用関数. cmail-printで使用する.")
   (en_US . "\
*Function to be used for printing. Used by cmail-print."))
  :type '(choice function (const nil))
  :group 'cmail-all-variables
  :group 'cmail-printing)

(cmail-i18n-defcustom cmail-print-command "expand|fold -80|pr -w80 -l66 -h 'cmail-printings'|expand|jc -e|jtops -vg|lpr -P$PRINTER"
  ((ja_JP . "\
*印刷コマンド. cmail-print-procで使用する.")
   (en_US . "\
*Shell command for printing. Used by cmail-print-proc."))
  :type 'string
  :group 'cmail-all-variables
  :group 'cmail-printing)

(cmail-i18n-defcustom cmail-highlight-mode window-system
  ((ja_JP . "\
*non-nilの時, メッセージのハイライト機能を使用する.")
   (en_US . "\
*Non-nil means use highlight in message display."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(cmail-i18n-defcustom cmail-highlight-mouse nil
  ((ja_JP . "\
*マウスカーソルがサマリ行やフォルダ名の位置にきたときに付加するface.")
   (en_US . "\
*face to add when mouse cursor moved over summary line/folder name."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(cmail-i18n-defcustom cmail-cite-regexp
  "^\\(In article\\|In message\\|[ \t]*\\w*[]>}|]\\).*$"
  ((ja_JP . "\
*ハイライト機能使用時における引用部分識別のための正規表現.")
   (en_US . "\
*Regular expression to identify message part for highlight."))
  :type 'regexp
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(defvar cmail-highlight-attribute-alist
  '((cmail-header-from-face          "blue"          nil       nil nil)
    (cmail-header-subject-face       "tomato"        nil       nil nil)
    (cmail-header-date-face          "DodgerBlue"    nil       nil nil)
    (cmail-header-to-cc-face         "black"         nil       nil nil)
    (cmail-header-name-face          "green4"        nil       t   nil)
    (cmail-header-content-face       "grey50"        nil       nil t  )
    (cmail-header-separator-face     "black"         "tan"     nil nil)
    (cmail-cite-face                 "SteelBlue"     nil       nil nil)
    (cmail-summary-mode-seen-face    "grey50"        nil       nil nil)
    (cmail-summary-mode-hold-face    "ForestGreen"   nil       nil nil)
    (cmail-summary-mode-bookmark-face "ForestGreen"  nil       nil nil)
    (cmail-summary-mode-moreflags-face "DodgerBlue"  nil       nil nil)
    (cmail-summary-mode-reply-face   "DodgerBlue"    nil       nil nil)
    (cmail-summary-mode-unread-face  "blue"          nil       nil nil)
    (cmail-summary-mode-marked-face  "black"         nil       nil nil)
    (cmail-summary-mode-edited-face  "DarkOrchid"    nil       nil nil)
    (cmail-summary-mode-delete-face  "firebrick"     nil       nil nil)
    (cmail-summary-mode-current-face "black"         "skyblue" t   nil)
    (cmail-folders-mode-dir-face     "DarkSlateBlue" nil       nil nil))
  "*face名, 表面色, 背景色, boldやitalicを使用するかどうかのface alist.

デフォルト値は以下のとおり.

        FACE 名                   表面色          背景色       BOLD ITALIC
((cmail-header-from-face          \"blue\"          nil          nil  nil)
 (cmail-header-subject-face       \"tomato\"        nil          nil  nil)
 (cmail-header-date-face          \"DodgerBlue\"    nil          nil  nil)
 (cmail-header-to-cc-face         \"black\"         nil          nil  nil)
 (cmail-header-name-face          \"green4\"        nil          t    nil)
 (cmail-header-content-face       \"grey50\"        nil          nil  t  )
 (cmail-header-separator-face     \"black\"         \"tan\"        nil  nil)
 (cmail-cite-face                 \"SteelBlue\"     nil          nil  nil)
 (cmail-summary-mode-seen-face    \"grey50\"        nil          nil  nil)
 (cmail-summary-mode-hold-face    \"ForestGreen\"   nil          nil  nil)
 (cmail-summary-mode-bookmark-face \"ForestGreen\"   nil       nil nil)
 (cmail-summary-mode-moreflags-face \"DodgerBlue\"   nil       nil nil)
 (cmail-summary-mode-reply-face   \"DodgerBlue\"    nil          nil  nil)
 (cmail-summary-mode-unread-face  \"blue\"          nil          nil  nil)
 (cmail-summary-mode-marked-face  \"black\"         nil          nil  nil)
 (cmail-summary-mode-edited-face  \"DarkOrchid\"    nil          nil  nil)
 (cmail-summary-mode-delete-face  \"firebrick\"     nil          nil  nil)
 (cmail-summary-mode-current-face \"black\"         \"skyblue\"    t    nil)
 (cmail-folders-mode-dir-face     \"DarkSlateBlue\" nil          nil  nil))

もし, 背景色が暗い配色である場合, デフォルト値の代りに以下の値を
試すと良いかも知れない.

        FACE 名                   表面色           背景色       BOLD ITALIC
((cmail-header-from-face          \"SpringGreen\"    nil          nil  nil)
 (cmail-header-subject-face       \"tomato\"         nil          nil  nil)
 (cmail-header-date-face          \"LightSteelBlue\" nil          nil  nil)
 (cmail-header-to-cc-face         \"white\"          nil          nil  nil)
 (cmail-header-name-face          \"SeaGreen3\"      nil          t    nil)
 (cmail-header-content-face       \"grey80\"         nil          nil  t  )
 (cmail-header-separator-face     \"white\"          \"tan\"        nil  nil)
 (cmail-cite-face                 \"pink\"           nil          nil  nil)
 (cmail-summary-mode-seen-face    \"grey80\"         nil          nil  nil)
 (cmail-summary-mode-hold-face    \"pink\"           nil          nil  nil)
 (cmail-summary-mode-bookmark-face \"LightGreen\"   nil       nil nil)
 (cmail-summary-mode-moreflags-face \"LightSteelBlue\"   nil       nil nil)
 (cmail-summary-mode-reply-face   \"LightSteelBlue\" nil          nil  nil)
 (cmail-summary-mode-unread-face  \"yellow\"         nil          nil  nil)
 (cmail-summary-mode-marked-face  \"skyblue\"        nil          nil  nil)
 (cmail-summary-mode-edited-face  \"green\"          nil          nil  nil)
 (cmail-summary-mode-delete-face  \"white\"          nil          nil  nil)
 (cmail-summary-mode-current-face \"green\"          \"DimGrey\"    t    nil)
 (cmail-folders-mode-dir-face     \"cyan\"           nil          nil  nil))"
)

(defvar cmail-inbox-folder "INBOX"
  "*基本的フォルダ.")

(cmail-i18n-defcustom cmail-query-limit-except-inbox-folder nil
  ((ja_JP . "\
*表示する上限のメール数をINBOXフォルダ表示時に尋ねるかどうか.

Non-nilのとき, cmail-inbox-folder に移動する際、cmail-large-folder
の設定値以上のメイルがあっても limit を尋ねない.")
   (en_US . "\
*Non-nil means do not prompt for upper limit when displaying INBOX.

Usually if a folder contains more messages than number specified by
cmail-large-folder, when the folder is visited, cmail prompts for upper
limit of messages to disaply. The INBOX folder is handled differently
if this value is non-nil, it displays all messages without querying the
uppler limit."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-summary)

(defvar cmail-current-folder cmail-inbox-folder
  "使用中フォルダ.")

(cmail-i18n-defcustom cmail-spool-directory rmail-spool-directory
  ((ja_JP . "\
*メイルのスプールディレクトリ.")
   (en_US . "\
*Mail spool directory to be used to construct default spool file name." ))
  :type 'string
  :group 'cmail-all-variables
  :group 'cmail-directories)

(cmail-i18n-defcustom cmail-mail-spools nil
  ((ja_JP . "\
*メイルのスプールファイル(またはPOPサーバ).

POP サーバ情報は次のフォーマットです.

(\"po:POPアカウント名\" \"メイルホスト名\" \"オプション\" \"パスワード\")")
   (en_US . "\
*List of mail spool file names, and/or POP account information.

POP account information is the following format:

(\"po:account\" \"PPP-host\" \"movemail-options\" \"password\")"))
  :type '(choice (const nil)
		 string
		 (repeat (choice string
				 sexp)))
  :group 'cmail-all-variables
  :group 'cmail-directories)

;;; cmail-spool-directory->cmail-mail-spools移行用のコード
;;; 将来削除される(はず)
(and (null cmail-mail-spools)
     (listp cmail-spool-directory)
     (setq cmail-mail-spools cmail-spool-directory)
     (setq cmail-spool-directory nil))
(and (null cmail-mail-spools)
     (stringp cmail-spool-directory)
     (string-match "^po:" cmail-spool-directory)
     (setq cmail-mail-spools (list cmail-spool-directory))
     (setq cmail-spool-directory nil))

(cmail-i18n-defcustom cmail-mbox-format 'mboxo
  ((ja_JP . "\
*メイルのスプールファイルのフォーマット。mboxo または mboxcl2.

mboxo:   \\nFrom が\\n>From になる. \\n>From は \\n>From のまま。
mboxrd:  \\nFrom が\\n>From になる. \\n>From も \\n>>From になる。
mboxcl:  mboxo と同じだが Content-Length: がつく。
mboxcl2: \\nFrom は\\nFrom のまま. Content-Length: がつく。

cmail では mboxrd, mboxcl は mboxo で扱う。")
   (en_US . "\
*Mail spool file format. Either mboxo or mboxcl2.

mboxo:   '\\nFrom ' is quoted to '\\n>From ', '\\n>From ' is not quoted
         to '\\n>From '.
mboxrd:  '\\nFrom ' is quoted to '\\n>From '.
         '\\n>From ' is also quoted to '\\n>>From '.
mboxcl:  the same as mboxo, but in addition Content-Length: is added.
mboxcl2: '\\nFrom ' is not quoted, Content-Length: is added.

cmail handles mboxrd, mboxcl as if it is mboxo."))
  :type '(choice (const :tag "Original BSD format (mboxo)" mboxo)
		 (const :tag "Content-Length w/o From_ (mboxcl2)" mboxcl2))
  :group 'cmail-all-variables
  :group 'cmail-directories)

(defvar cmail-cursor-fast t
  "*サマリでのカーソル移動のスピード. non-nilの場合は素早いカーソル移動
の関数をバインドする.")

(defvar cmail-broken-cursor nil
  "*フォルダを開いた時，カーソルの位置がずれるバグに当たった時にはこの値をtにする.")

(cmail-i18n-defcustom cmail-large-folder 50
  ((ja_JP . "\
*大きなフォルダであると見なす数.

フォルダ内のメールの数がこの値より大きい時には表示数の確認が行なわれる.")
   (en_US . "\
*Number of messages a folder is considered a 'large folder'.

If the number of messages in a folder exceeds this number, when visiting
the large folder, cmail will prompt for upper limit to display."))
  :type 'integer
  :group 'cmail-all-variables
  :group 'cmail-summary)
  
(defvar cmail-incoming-mails-folder ".BACKUP"
  "* cmailを起動してから，受け取ったメイルのコピーを格納するフォルダ名．

nilの時はコピーしない．cmail終了時に自動的に削除される．%で始まる名前に
するとcmail起動時に自動的に削除される(cmail-ok-if-backup-existsが設定
されている時)ので避けた方が良い(気がする)")

(cmail-i18n-defcustom cmail-backup-version nil
  ((ja_JP . "\
*フォルダをセーブする時に保存するバージョンの数.

nilの場合は1世代のバックアップを作成する. (詳しくは save-buffer と
version-control の説明を参照.) 0にすればバックアップを行なわない.")
   (en_US . "\
*The number of backup file versions to preserve when saving folders.

If this is nil, only one backup file is created. (Please refer to
save-buffer and version-control documentaion for file version concept.)
If the value is 0, no backup file will be taken."))
  :type '(choice integer (const nil))
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-ignored-headers
  "^From \\|^X-cmail\\|^Received:\\|^Return-Path:\\|^Return-Receipt-To:\\|^Message-ID:\\|^Errors-To:\\|^References:\\|^Sender:\\|^Lines:\\|Status:\\|Replied:"
  ((ja_JP . "\
*表示しないヘッダを示す正規表現.")
   (en_US . "\
*Regular expression that matches message headers not to display."))
  :type 'regexp
  :group 'cmail-all-variables
  :group 'cmail-readmail)

(cmail-i18n-defcustom cmail-always-shown-headers "^$"
  ((ja_JP . "\
*常に表示されるヘッダを示す正規表現.")
   (en_US . "\
*Regular expression that matches message headers to always display"))
  :type 'regexp
  :group 'cmail-all-variables
  :group 'cmail-readmail)

(defvar *cmail-show-all-headers nil
  "Non-nil の場合, ヘッダを全て表示する.")

(defvar *cmail-have-all-headers nil)

(cmail-i18n-defcustom cmail-reply-heading-format
  "\nIn message \"%S\"\n    on %D, %n <%a> writes:\n"
  ((ja_JP . "\
*reply 時の引用部の先頭につくヘッダのフォーマットまたは関数.

nil の場合は表示を行なわない. フォーマットに関する記述は変数
cmail-summarize-format を参照のこと.

S       : サブジェクト
s       : サブジェクト(\"Re: \"が付いていないもの)
m       : メッセージID
d       : 日付
D       : 日付(例 92/11/01)
n       : 名前
l       : ログイン名(例 hayasima)
a       : アドレス(例 hayasima@opal.esi.yamanashi.ac.jp)

この変数の値が文字列でなく関数であった場合にはその関数が呼び出される.
外部パッケージ (super-cite 等)を使用する場合は使用されない.")
   (en_US . "\
*Format string or function that returns string for citation header.

When nil, no header is attached. Please refer to cmail-summarize-format
for more description regarding the format string.

S       : Subject
s       : Subject (After \"Re: \" is removed)
m       : Message ID
d       : Date
D       : Date (example 92/11/01)
n       : name
l       : login name (example hayasima)
a       : address (example hayasima@opal.esi.yamanashi.ac.jp)

If this variable is a function instead of a string, the function will
be called. This variable would not be used if other add-on package for
citation such as super-cite is used."))
  :type '(choice string function)
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-reply-long-date-format nil
  ((ja_JP . "\
*cmail-reply-heading-formatに指定する%Dの年のフォーマットとして
4桁長のフォーマットを用いる場合にtをセットする. デフォルトは2桁
の短かいフォーマット.")
   (en_US . "\
*When non-nil, use 4-digits year presentation for the format string %D
in cmail-reply-heading-format, it sets to t.  Default is the short
paddle format of 2 digits.
"))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-summary-long-date-format nil
  ((ja_JP . "\
*cmail-summarize-formatに指定する%d の年のフォーマットとして4桁
長のフォーマットを用いる場合にtをセットする. デフォルトは2桁の
短かいフォーマット.")
   (en_US . "\
*When non-nil, use 4-digits year presentation for the format string %d
in cmail-summarize-format.  Default is the short paddle format of 2
digits.
"))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-summary)

(cmail-i18n-defcustom cmail-replyaddress-without-quoted-name t
  ((ja_JP . "\
*返信する時に(名前などを除いた)アドレスのみをコピーするか.

non-nilの時、reply時にTo:フィールドにはアドレスだけを含め、名前などは
削除する.  nilの時は元メールにある名前などの情報を残すが、sendmail.el
の仕様に従えば、これは正しくない動作であり、アドレスによっては不具合を
生ずる.")
   (en_US . "\
*Use fully qualified email addresses only when replying a message

When non-nil, only the fully qualified email adderesses are copied
into To: or CC: field from the original message upon cmail-reply
command. Extra informational parts like name strings will be removed.
If this is nil, the extra information will be included, which may or
may not cause a problem in processing the reply message because the
lisp library cmail uses to send it to the network does not expect such
extra information string in the address fields."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-unify-multi-re t
  ((ja_JP . "\
*サブジェクトの複数の Re をひとつにまとめるか")
   (en_US . "\
*Whether to unify multiple Re in the Subject field."))
  :type '(choice (const :tag "Unify" t) (const :tag "As is" nil))
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

;; --- Copied from rmail.el ---
;; Some mailers use "Re(2):" or "Re^2:" or "Re: Re:" or "Re[2]:".
;; This pattern should catch all the common variants.
(cmail-i18n-defcustom cmail-re-regexp "\\`\\(Re\\(([0-9]+)\\|\\[[0-9]+\\]\\|\\^[0-9]+\\)?: *\\)+"
  ((ja_JP . "\
*Re: をつける前に削除する文字列にマッチする正規表現.")
   (en_US . "\
*Regular expression that matches subject string to be removed."))
  :type 'regexp
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-remove-re nil
  ((ja_JP . "\
*Non-nil の時, サブジェクトに Re: を付けない. Re: があったら削る.")
   (en_US . "\
*Non-nil means do not attach Re: to subject. Remove if present."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(defvar cmail-current-point-mark t
  "*Non-nilの時, 表示中のメイルのインデックスを指すマークをつける.")

(cmail-i18n-defcustom cmail-mark-delete-show-next nil
  ((ja_JP . "\
*non-nilの時, Dマークをつけた時次メールが未読であればそれを表示する.")
   (en_US . "\
*Non-nil means that after deletion display the next message if unread."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-summary)

(cmail-i18n-defcustom cmail-display-thread t
  ((ja_JP . "\
*スレッド表示をするかどうか.")
   (en_US . "\
*Whether or not thread display is used."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-summary)

(cmail-i18n-defcustom cmail-thread-indent 2
  ((ja_JP . "\
*スレッド表示の際のインデント幅.")
   (en_US . "\
*Indent width in number of white space when displaying thread trees."))
  :type 'integer
  :group 'cmail-all-variables
  :group 'cmail-summary)

(cmail-i18n-defcustom cmail-thread-folder-regexp nil
  ((ja_JP . "\
*スレッド表示の対象となるフォルダの正規表現.

nil の場合は cmail-display-thread の設定にすべてのフォルダが従う.

ex.
  (setq cmail-display-thread t)
  (setq cmail-thread-folder-regexp \"^.*ml$\\\\|^ml/.*$\")

この場合、最後が ml で終るフォルダ名と階層フォルダ ml の下の
すべてのフォルダが thread 表示の対象となる.")
   (en_US . "\
*Regular expression that matches the folder names to thread.

If this is nil, threading is performed according to cmail-display-thread.

ex.
  (setq cmail-display-thread t)
  (setq cmail-thread-folder-regexp \"^.*ml$\\\\|^ml/.*$\")

In this case, all folders that has ml at the tail, or all folders under
directory ml/ would be threaded."))
  :type '(choice (const nil) regexp)
  :group 'cmail-all-variables
  :group 'cmail-summary)


(cmail-i18n-defcustom cmail-thread-ignored-folder-regexp nil
  ((ja_JP . "\
*スレッド表示の対象外となるフォルダの正規表現.

cmail-thread-folder-regexp の設定に優先する.
cmail-thread-folder-regexp が nil の場合、
cmail-thread-ignored-folder-regexp での設定値に
match したフォルダ以外が thread 表示の対象フォルダになる.

ex.
  (setq cmail-display-thread t)
  (setq cmail-thread-folder-regexp nil)
  (setq cmail-thread-ignored-folder-regexp \"^INBOX$\\\\|^WORK$\")

この場合、INBOX と WORK 以外のすべてのフォルダが thread 表示の対象となる.")
   (en_US . "\
*Regular expression that matches the folder names to NOT thread.

This has precedence to cmail-thread-folder-regexp. If
cmail-thread-folder-regexp is nil, all other folders than the folders
that matches this regular expression will be threaded.

ex.
  (setq cmail-display-thread t)
  (setq cmail-thread-folder-regexp nil)
  (setq cmail-thread-ignored-folder-regexp \"^INBOX$\\\\|^WORK$\")

In this case, all folders other than INBOX and WORK would be threaded."))
  :type '(choice (const nil) regexp)
  :group 'cmail-all-variables
  :group 'cmail-summary)

(cmail-i18n-defcustom cmail-thread-ignore-limit t
  ((ja_JP . "\
*スレッド表示の際にメッセージ数の上限設定を無視するか.")
   (en_US . "\
*Whether or not to ignore limit number of messages when threading."))
  :type '(choice (const :tag "Ignore" t) (const :tag "Don't Ignore" nil))
  :group 'cmail-all-variables
  :group 'cmail-summary)

(defvar cmail-thread-prepare-data-on-archive nil
  "auto-archive時にthreadデータを予め作成しておくかどうか.")

(cmail-i18n-defcustom cmail-window-size '(1 . 5)
  ((ja_JP . "\
*サマリバッファの行数とメール表示バッファの行数の割合.

メール表示バッファの行数をnilとするとサマリバッファはその行数を確保する.")
   (en_US . "\
*Vertical window size ratio between summary and message view buffer.

If message view buffer size factor is nil, the summary buffer size factor
will be the actual size of the summary buffer window."))
  :type '(cons integer integer)
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(cmail-i18n-defcustom cmail-window-horizontal-size '(1 . 3)
  ((ja_JP . "\
*フォルダ一覧バッファの列数とサマリバッファの列数の割合.

フォルダ一覧バッファの列数をnilとするとサマリバッファはその列数を確保する.")
   (en_US . "\
*Horizontal window size ratio between folders list and summary buffer.

If the folders list buffer size factor is nil, the summary buffer size
factor will be the actual size of the summary buffer window."))

  :type '(cons integer integer)
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(cmail-i18n-defcustom cmail-use-full-window t
  ((ja_JP . "\
*Non-nilの場合, cmailが全画面を使う.")
   (en_US . "\
*Cmail will use the entire frame if this variable is non-nil."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(cmail-i18n-defcustom cmail-summarize-format nil
  ((ja_JP . "\
*サマリモードでのサマリのフォーマットを指定する文字列.

nil の場合は, 標準の表示フォーマットを採用する(表示速度が速くなる).
標準フォーマットの形式は\"%d [%-17n] %I%j\n\"である.

p	: ページ番号
s	: ステイタス記号(Active はスペースで表示)
S	: ステイタス記号
n	: 名前
a	: アドレス
j	: サブジェクト
l	: メイルの行数(古いフォーマットの場合は0)
I	: thread表示のインデント

%に続いて数値を書いておくとその桁数内に強制的に文字列を収める.
即ち, アドレスが\"hayasima\"で, 名前が\"Macot HAYASHI\"の場合,
\"<%:-10a> (%:10n)\"は,
	\"<  hayasima> (Macot HAYA)\"
になる.

この変数の値が文字列でなく関数である時にはその関数を呼び出す.")
   (en_US . "\
*Format string for summary line in summary mode.

When nil, the standard format will be used, in which case display speed
is relatively faster. The standard format is \"%d [%-17n] %I%j\n\".

p	: Page number
s	: Message status (Active will be a space)
S	: Message status
n	: Sender name
a	: Sender address
j	: Subject
l	: Number of lines in message (0 in the old format)
I	: thread indent

The number immediately after % specifies a fixed string width. For
example, the sender address is \"hayasima\" and the sender name is
\"Macot HAYASHI\", using a format string \"<%:-10a> (%:10n)\" would
result in \"<  hayasima> (Macot HAYA)\"."))
  :type '(choice (const nil) string)
  :group 'cmail-all-variables
  :group 'cmail-summary)

(cmail-i18n-defcustom cmail-summarize-format-alist nil
  ((ja_JP . "\
*フォルダ毎にサマリのフォーマットを指定する.

     '((folder . format) ...)

という形式で指定する．")
   (en_US . "\
*Designate summary format per folder.

A list in form of:

     '((folder . format) ...)

is used to designate format per folder."))
  :type 'alist
  :group 'cmail-all-variables
  :group 'cmail-summary)

(cmail-i18n-defcustom cmail-use-X-Nsubject t
  ((ja_JP . "\
*X-Nsubjectフィールドをサブジェクトと見なす(Subjectより優先する).")
   (en_US . "\
*Use X-Nsubject field as the actual subject. (Precedes to subject)"))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-summary)

(cmail-i18n-defcustom cmail-forwarded-mail-border-cons
  '("------- Start of forwarded message -------\n" .
    "------- End of forwarded message -------\n")
  ((ja_JP . "\
*メールをフォワードする時に挿入する境界線.")
   (en_US . "\
*Boundary strings to be inserted when forwarding a message."))
  :type '(cons string string)
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-rfc934-forwarding t
  ((ja_JP . "\
*RFC-934に従い, 行頭の\"--\"を\"- -\"に変換する.

RFC-934 は複数のメールを別のメールに添付し復元するための方法を定義
している. MIME が使用できる環境では MIME による転送がより適当.")
   (en_US . "\
*Convert \"--\" at the beginning of line to \"- -\" per RFC-934.

RFC-934 specifies a rule to encapsulate a message within another
message.  When MIME is supported, it is more appropriate to use MIME
for message encapsulation."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-mime-forwarding t
  ((ja_JP . "\
*MIME 形式でフォワードを行う.

non-nil かつ cmail-use-mime が non-nil の時のみ有効.")
   (en_US . "\
*Forward using MIME facility.

Effective only if cmail-use-mime is non-nil."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-mime
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-make-References-header t
  ((ja_JP . "\
*non-nil の場合, ヘッダReferencesを使用する.")
   (en_US . "\
*Non-nil means use References: header."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-complete-header-regexp "^\\(To\\|From\\|Cc\\|Bcc\\|Reply-To\\|Return-Receipt-To\\):"
  ((ja_JP . "\
*アドレス補完を行なうフィールドを指定する正規表現.")
   (en_US . "\
*Regexp that matches header fields where address completion is done."))
  :type 'regexp
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-use-visiting-parent-dir-as-quit nil
  ((ja_JP . "\
*フォルダ一覧サブディレクトリで quit したときの挙動.")
   (en_US . "\
*Behavior when quit from a subdirectory in folders mode."))
  :type '(choice (const :tag "Return To Upper Directory" t)
		 (const :tag "Quit Folders Mode" nil))
  :group 'cmail-all-variables
  :group 'cmail-folders)

(cmail-i18n-defcustom cmail-always-display-folders (if cmail-use-full-window 'auto nil)
  ((ja_JP . "\
*フォルダ一覧モードを常時表示するかどうか.")
   (en_US . "\
*Whether or not folders list mode is always displayed."))
  :type '(choice (const :tag "Always display" t)
		 (const :tag "Based on window size" auto)
		 (const :tag "Don't display" nil))
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(cmail-i18n-defcustom cmail-always-display-folders-threshold 100
  ((ja_JP . "\
*フォルダ一覧の常時表示を行うかどうかのウィンドウ幅のしきい値.

cmail-always-display-foldersに'auto (based on window size)を指定
した場合にのみ有効。")
   (en_US . "\
*Threshold size of frame to display folders list buffer.

Effective only when cmail-always-display-folders is set to 'auto
(based on window size)."))
  :type 'integer
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(cmail-i18n-defcustom cmail-use-folders-mode-first t
  ((ja_JP . "\
*フォルダ一覧モードから起動するかどうか.")
   (en_US . "\
*Start up from folders list mode."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-startup)

(cmail-i18n-defcustom cmail-folders-unfold-dirs '()
  ((ja_JP . "\
*展開するディレクトリのリスト (終端に`/'が必要).

例: (setq cmail-folders-unfold-dirs (\"DIR1/\" \"DIR1/DIR2/\" \"DIR3/\"))")
   (en_US . "\
*List of dirs in which folder names are expanded in folders mode.

ex: (setq cmail-folders-unfold-dirs (\"DIR1/\" \"DIR1/DIR2/\" \"DIR3/\"))"))
  :type '(repeat string)
  :group 'cmail-all-variables
  :group 'cmail-folders)

(cmail-i18n-defcustom cmail-folders-list-top (list cmail-inbox-folder)
  ((ja_JP . "\
*一覧の先頭に持ってくるフォルダのリスト.")
   (en_US . "\
*List of folders placed at the top of folders mode buffer."))
  :type '(repeat string)
  :group 'cmail-all-variables
  :group 'cmail-folders)


(cmail-i18n-defcustom cmail-folders-list-bottom '()
  ((ja_JP . "\
*一覧の終端に持ってくるフォルダのリスト.")
   (en_US . "\
*List of folders placed at the bottom of folders mode buffer."))
  :type '(repeat string)
  :group 'cmail-all-variables
  :group 'cmail-folders)

(cmail-i18n-defcustom cmail-folders-display-all-folders t
  ((ja_JP . "\
*nilの時未読メールのないフォルダを表示しない")
   (en_US . "\
*Always display all folders regardless unread messages in folders mode.

If this variable is nil, only folders that contain unread messages
will be disaplayed in the folders mode buffer."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-folders)

(cmail-i18n-defcustom cmail-folders-display-unread-mails nil
  ((ja_JP . "\
*Non-nilの時, フォルダのメール数として未読メール数を表示する.")
   (en_US . "\
*Non-nil means display number of unread msgs instead of total."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-folders)

(cmail-i18n-defcustom cmail-folders-nickname-display nil
  ((ja_JP . "\
*Non-nilの時, .cmail-folder-nicknamesファイルの内容からフォルダの愛称を得てそれで置換える.

.cmail-folder-nicknamesのフォーマットはタブまたは空白で区切られた愛称とフォルダ名.")
   (en_US . "\
*Non-nil means display replace folder names by nicknames from .cmail-folder-nicknames file.

The format of .cmail-folder-nicknames file is nicknames and real names separated by tab/space."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-folders)

(cmail-i18n-defcustom cmail-use-mime nil
  ((ja_JP . "\
*MIME を扱うかどうか.

別途 MIME パッケージのインストールが必要.")
   (en_US . "\
*Use MIME option.

A compatible MIME package must be installed to turn on this option."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-mime
  :group 'cmail-envriron)

(cmail-i18n-defcustom cmail-mime-decode nil
  ((ja_JP . "\
*MIME メールをデコードするかどうか.")
   (en_US . "\
*Whether to decode MIME message."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-mime
  :group 'cmail-envriron)

(cmail-i18n-defcustom cmail-mime-encode nil
  ((ja_JP . "\
*MIME メールをエンコードするかどうか.")
   (en_US . "\
*Whether to encode MIME message."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-mime
  :group 'cmail-envriron)

(defvar cmail-content-filter-function
  'cmail-default-content-filter "for cmail-mime")

(if (null cmail-use-mime)
    nil
  (setq cmail-mime-decode t)
  (setq cmail-mime-encode t))

(cmail-i18n-defcustom cmail-delete-file-after-conversion nil
  ((ja_JP . "\
*変換前のmboxまたはRMAIL形式のファイルを削除する.")
   (en_US . "\
*Delete mbox or RMAIL files after conversion."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-use-mailcrypt nil
  ((ja_JP . "\
*PGPメールを扱うかどうか.

別途 PGP パッケージのインストールが必要.")
   (en_US . "\
*Use PGP feature.

A compatible PGP package must be installed to turn on this option."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-other-features
  :group 'cmail-envriron)

(cmail-i18n-defcustom cmail-use-send-mail-archive nil
  ((ja_JP . "\
*送信したメイルのログを指定したフォルダに残すかどうか.")
   (en_US . "\
*Whether to store sent messages in a specified 'archive' folder."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(autoload 'cmail-archive "cmail-archive" nil t)

(cmail-i18n-defcustom cmail-mail-callback t
  ((ja_JP . "\
*サマリのリプライマーク(R)をどのタイミングでつけるか.

t で送出時、nil でコマンドを実行した時.")
   (en_US . "\
*When message status is changed to replied (R) in summary mode.

It will be done when message is sent if this variable is set to t, or
when reply command is invoked in summary mode."))
  :type '(choice (const :tag "When sent" t) (const :tag "When invoked" nil))
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-rename-sent-mail-buffer nil
  ((ja_JP . "\
*non-nilのとき, 送信済みメールバッファのバッファ名を変更する.")
   (en_US . "\
*Non-nil means the mail buffer is renamed after sending message."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-sendmail)

(cmail-i18n-defcustom cmail-max-crash-box-size nil
  ((ja_JP . "\
整数値のとき, クラッシュボックスのサイズが指定値を超えると警告を出す.")
   (en_US . "\
If integer, cmail warns when crash box size exceeds this value."))
  :type '(choice integer (const :tag "Disabled" nil))
  :group 'cmail-all-variables
  :group 'cmail-archive)

(cmail-i18n-defcustom cmail-i18n-message t
  ((ja_JP . "\
*メッセージの言語を自動的に切り替えるかどうか. load 時のみ有効.

Emacs 20.3 以降または XEmacs で current-language-environment
に従って切替える. nil の場合は常に英語のメッセージになる. 
現在は current-language-environment が \"Japanese\" のときは日本語に、
それ以外のときは英語になる.

変更は一旦 Emacs を終了し再ロードを行う事により有効になります.")
   (en_US . "\
*Non-nil means use user preferred language for messages if possible.

When non-nil, based on the Emacs variant, version and variable
current-language-environment content, use the user preferred language
for messages displayed in the echo area. When nil, cmail always use
messages in English. At this point, if current-language-environment
is set to \"Japanese\", cmail uses Japanese, otherwise uses English.

Change will take effect when Emacs is restarted.
"))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(cmail-i18n-defcustom cmail-i18n-doc-language 'ja_JP
  ((ja_JP . "\
*オプション変数ドキュメントの言語の指定.

サポートされている言語: ja_JP, en_US")
   (en_US . "\
*Documentation language selection.

Currently supported languages are: ja_JP, en_US."))
  :type '(choice (const :tag "US English" en_US)
		 (const :tag "Japanese" ja_JP))
  :set 'cmail-i18n-set-doc-language
  :group 'cmail-all-variables
  :group 'cmail-display-style)

(cmail-i18n-defcustom cmail-sum-pop-up-menu-2
  '(("Mark" . cmail-mark)
    ("Mark Delete" . cmail-mark-delete)
    ("Mark Hold" . cmail-mark-hold)
    ("Unmark" . cmail-unmark)
    ""
    ("Reply" . cmail-reply)
    ("Follow-up" . cmail-follow-up)
    ("Forward" . cmail-forward))
  ((ja_JP . "\
*サマリで通常2番目のマウスボタン(ダブルクリック)のポップアップメニュー.

現在カーソルのあるメッセージがメニュータイトルに表示される.")
   (en_US . "\
*Pop-up menu which is usually assigned to 3rd mouse button.

Menu title will show the current message."))
  :type '(repeat (choice (cons string function) string))
  :group 'cmail-all-variables
  :group 'cmail-menu-style)

(cmail-i18n-defcustom cmail-sum-pop-up-menu-1
  `(,@(if running-xemacs
	  '(["Get New Message" cmail-summary-get-newmail t]
	    ["Folders List" cmail-folders t]
	    ["Expand Window" cmail-sum-mouse-expand t]
	    ["Archive" cmail-auto-archive t]
	    ["Expunge" cmail-execute-index t]
	    ["Save All" cmail-save-all-folders t]
	    "---"
	    ["Quit" cmail-summary-quit t])
	'(("Get New Message" . cmail-summary-get-newmail)
	  ("Folders List" . cmail-folders)
	  ("Expand Window" . cmail-sum-mouse-expand)
	  ("Archive" . cmail-auto-archive)
	  ("Expunge" . cmail-execute-index)
	  ("Save All" . cmail-save-all-folders)
	  ""
	  ("Quit" . cmail-summary-quit))))
  ((ja_JP . "\
*サマリで通常3番目のマウスボタンのポップアップメニュー.

現在のフォルダー名がメニュータイトルに表示される.")
   (en_US . "\
*Pop-up menu which is usually assigned to 3rd mouse button.

Menu title will show the current folder name."))
  :type '(repeat (choice (cons string function) string))
  :group 'cmail-all-variables
  :group 'cmail-menu-style)

(cmail-i18n-defcustom cmail-option-path-list
		      (list (concat
			     (file-name-directory (locate-library "cmail"))
			     "options/"))
  ((ja_JP . "\
*オプション機能用のファイルを置くディクトリ。")
   (en_US . "\
*A direcoty for files providing optional features."))
  :type '(repeat directory)
  :group 'cmail-all-variables
  :group 'cmail-directories)

(cmail-i18n-defcustom cmail-auth-file "~/.cmail-auth"
  ((ja_JP . "\
*POPなどのパスワードを保存するファイル名。

cmail-use-auth-file が non nil の時に有効になる。")
   (en_US . "\
*Name of file to store password for mail retrieval protocol such as POP.

Used when cmail-use-auth-file is non nil."))
  :type 'directory
  :group 'cmail-all-variables
  :group 'cmail-directories)

(cmail-i18n-defcustom cmail-use-auth-file nil
  ((ja_JP . "\
*Non nil の時パスワードを cmail-auth-file で指定のファイルに保存する。

ベースシステムがファイルの許可モードをサポートしていないとファイルは
作成されません。")
   (en_US . "\
*Non nil means store passwords in a file specified by cmail-auth-file.

The system must support file permission mode to create the auth file."))
  :type 'boolean
  :group 'cmail-all-variables
  :group 'cmail-directories)


;; ==== 作業用変数(及び定数) ====

(defvar *cmail-pagelist nil "フォルダ内の各頁を指すマーカのリスト.")
(defvar *cmail-backuped nil "フォルダのバックアップが作成されたか.")

(defvar *cmail-summary-limit nil
  "*サマリの表示記事数. 0またはnilの場合は当該記事全てをサマライズする.
整数の場合はその記事数だけサマライズする.")

(defconst cmail-summary-regexp
  "^\\([0-9]+\\) \\(.\\) \\([0-9/]+\\) \\(.*\\) <\\([^<>]+\\)> \\([0-9]+\\) ?\\[\\(\\(R[Ee]: \\)*\\(.*\\)\\)\\]$"
  "サマリを解析する時の行の正規表現.
\"PAGE STATUS DATE NAME MAIL-ADDRESS LINES BEGINNING-OF-SUBJECT BOS SUBJECT\"の順.")

(defconst cmail-sort-key-alist '(("DATE" ."\\3")
				 ("NAME" ."\\4")
				 ("ADDRESS" ."\\5")
				 ("SUBJECT" ."\\7")
				 ("SUBJECT(relative)" ."\\9"))
  "サマリをソートする時に使用するキーの連想リスト.")

(defvar *cmail-movemail-command "movemail" "*movemailのコマンド.")

;; modified by himi to handle pop password
(defvar *cmail-pop-password nil "POP Password-nilであることを強く推奨")

(defvar *cmail-save-to-dir nil "セーブ先のディレクトリを保持する.")

(defvar *cmail-save-to-name nil "セーブ先のファイル名を保持する.")

(defconst *cmail-border "\^_\^L"
  "フォルダのページ境界文字.")

(defconst *cmail-decoded-border "^_^L"
  "borderのデコードされたもの.")

(defconst *cmail-borderline (concat *cmail-border "\n")
  "フォルダのページ境界文字. 改行を含む.")

(defconst *cmail-re-bdr (concat "^" *cmail-border)
  "ページ境界文字の正規表現.")

(defconst *cmail-re-bln (concat *cmail-re-bdr "\n")
  "ページ境界文字の正規表現で, 改行を含む.")

(defconst *cmail-bln (concat "\n" *cmail-borderline)
  "ページ境界検索用, 改行を含む.")

(defconst *cmail-new-arrivals-buffer " *cmail-new-arrivals*"
  "新しいメイル(群)を貯めるバッファ(作業用).")

(defconst *cmail-arrived-mail-buffer " *cmail-arrived-mail*"
  "新しいメイルを収めるバッファ(作業用).")

(defconst *cmail-folder-buffer-prefix " *cmail-folder-"
  "フォルダの内容を収めるバッファ(作業用)のプレフィックス.")

(defconst *cmail-header-buffer-prefix " *cmail-header-"
  "フォルダのヘッダの内容を収めるバッファ(作業用)のプレフィックス.")

(defconst *cmail-summary-buffer "**cmail-summary**" "サマリ表示用バッファ.")

(defconst *cmail-mail-buffer "*cmail-mail*" "メイル表示用バッファ.")

(defconst *cmail-index-buffer " *cmail-index*"
  "インデックスを構築するためのバッファ.")

(defconst *cmail-complete-address-buffer " *cmail-address*"
  "アドレス補完用バッファ.")

(defconst *cmail-reply-mail-buffer " *cmail-reply*"
  "リプライメイルの内容を格納するバッファ.")

(defvar *cmail-last-opened-folder nil "最後にopenしたフォルダ.")
(defvar *cmail-current-page 0 "現在表示中のメイルのページ数(作業用).")
(defvar *cmail-current-folder "" "現在表示中のメイルのフォルダ(作業用).")
(defvar *cmail-opened-folders-list nil "使用したフォルダのリスト.")

(defconst *cmail-backup-prefix "%"
  "削除されたフォルダのバックアップファイルのプレフィックス.")

(defconst *cmail-unknown-field-value "(nil)"
  "省略などによって値のないヘッダフィールドの値.")

(defvar *cmail-reply-info nil "reply時のヘッダの文字列.")
(defvar *cmail-match-data nil "match-dataを保持する.")

(defvar *cmail-file-coding-system '*noconv*)
(defvar *cmail-primary-coding-system '*junet*)

(defvar *cmail-reorder-buffer " *cmail-reorder" "並べ換え用作業バッファ")

(defvar *cmail-folders-cache-alist nil
  "フォルダ情報キャッシュ. エントリの内容は以下の通り:

・バッファに保持されたフォルダ
    (FOLDERNAME DEPTH nil NUM UNUM . FLAG)
・ファイル上のフォルダ
    (FOLDERNAME DEPTH (SIZE MTIME1 MTIME2) NUM UNUM . FLAG)
・フォルダでないファイル
    (NOTFOLDERNAME DEPTH (SIZE MTIME1 MTIME2) nil nil . FLAG)
・ディレクトリ
    (DIRNAME DEPTH 'directory FOLDERNUM UNREADNUM . FLAG)")

;; cmail folder バッファローカル変数
(defvar *cmail-folder-name nil)
(defvar *cmail-volatile-folder-p nil)

;; IMAP4 用の hooks
(defvar cmail-content-supply-function nil "hook for imap4")
(defvar cmail-message-copy-function nil "hook for imap4")
(defvar cmail-message-delete-function nil "hook for imap4")
(defvar cmail-message-mark-function nil "hook for imap4")
(defvar cmail-message-status-function nil "hook for imap4")
(defvar cmail-message-expunge-function nil "hook for imap4")
(defvar cmail-mailbox-open-function nil "hook for imap4")
(defvar cmail-mailbox-delete-function nil "hook for imap4")
(defvar cmail-mailbox-rename-function nil "hook for imap4")
(defvar cmail-mailbox-copy-function nil "hook for imap4")
(defvar cmail-mailbox-search-function nil "hook for imap4")
(defvar cmail-folders-update-function nil "hook for imap4")
(defvar cmail-folders-search-function nil "hook for imap4")
(defvar cmail-summary-message-fetch-function nil "hook for imap4")
(defvar cmail-virtual-folder-check-function nil "hook for imap4")

;; cmail-show-content を実行する理由をセットする変数. forward 時
;; に imap4 から全読み込みするかを判断させるために導入
(defvar *cmail-show-content-reason nil)

;; mail-setup-hook 内での mime のデコードの制御をするための変数
(defvar *cmail-mime-mail-setup-decode-header-p nil)

;;
;; ======= 最後にドキュメントを入れ換え =================================
;(cmail-i18n-swap-doc cmail-i18n-doc-language)
;-> cmail.el の最後へ
;; ======================================================================
