pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

(devel/flim) Add missing patches, and correction on buildlink3.mk



Module Name:	pkgsrc-wip
Committed By:	Makoto Fujiwara <makoto%if.t.u-tokyo.ac.jp@localhost>
Pushed By:	mef
Date:		Thu Aug 31 19:01:58 2023 +0900
Changeset:	eff9dfb0ae11c561470638050005545b1af6d1f0

Modified Files:
	flim/buildlink3.mk
Added Files:
	flim/patches/patch-ChangeLog
	flim/patches/patch-FLIM-CFG
	flim/patches/patch-FLIM-ELS
	flim/patches/patch-FLIM-MK
	flim/patches/patch-README.en
	flim/patches/patch-README.ja
	flim/patches/patch-eword-decode.el
	flim/patches/patch-eword-encode.el
	flim/patches/patch-flim-pkg.el
	flim/patches/patch-ftp.in
	flim/patches/patch-hmac-md5.el
	flim/patches/patch-hmac-sha1.el
	flim/patches/patch-luna.el
	flim/patches/patch-lunit.el
	flim/patches/patch-md5.el
	flim/patches/patch-mel-g.el
	flim/patches/patch-mel-q-ccl.el
	flim/patches/patch-mel-q.el
	flim/patches/patch-mel-u.el
	flim/patches/patch-mel.el
	flim/patches/patch-mime-conf.el
	flim/patches/patch-mime-def.el
	flim/patches/patch-mime-parse.el-00
	flim/patches/patch-mime.el
	flim/patches/patch-mmbuffer.el
	flim/patches/patch-mmcooked.el
	flim/patches/patch-mmexternal.el
	flim/patches/patch-mmgeneric.el
	flim/patches/patch-qmtp.el
	flim/patches/patch-sasl-cram.el
	flim/patches/patch-sasl-digest.el
	flim/patches/patch-sasl-scram.el
	flim/patches/patch-sasl-xoauth2.el
	flim/patches/patch-sasl.el
	flim/patches/patch-sha1.el
	flim/patches/patch-smtp.el
	flim/patches/patch-std11.el
	flim/patches/patch-tests_test-rfc2231.el

Log Message:
(devel/flim) Add missing patches, and correction on buildlink3.mk

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=eff9dfb0ae11c561470638050005545b1af6d1f0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 flim/buildlink3.mk                       |    2 +-
 flim/patches/patch-ChangeLog             | 1018 +++++++++++++++++++++++++++
 flim/patches/patch-FLIM-CFG              |   14 +
 flim/patches/patch-FLIM-ELS              |   50 ++
 flim/patches/patch-FLIM-MK               |   25 +
 flim/patches/patch-README.en             |   38 ++
 flim/patches/patch-README.ja             |  244 +++++++
 flim/patches/patch-eword-decode.el       |  620 +++++++++++++++++
 flim/patches/patch-eword-encode.el       |  691 +++++++++++++++++++
 flim/patches/patch-flim-pkg.el           |   10 +
 flim/patches/patch-ftp.in                |   22 +
 flim/patches/patch-hmac-md5.el           |   42 ++
 flim/patches/patch-hmac-sha1.el          |   35 +
 flim/patches/patch-luna.el               |  124 ++++
 flim/patches/patch-lunit.el              |   78 +++
 flim/patches/patch-md5.el                |   44 ++
 flim/patches/patch-mel-g.el              |   12 +
 flim/patches/patch-mel-q-ccl.el          |  266 ++++++++
 flim/patches/patch-mel-q.el              |  169 +++++
 flim/patches/patch-mel-u.el              |   12 +
 flim/patches/patch-mel.el                |  320 +++++++++
 flim/patches/patch-mime-conf.el          |  248 +++++++
 flim/patches/patch-mime-def.el           |  147 ++++
 flim/patches/patch-mime-parse.el-00      |   28 +
 flim/patches/patch-mime.el               |  134 ++++
 flim/patches/patch-mmbuffer.el           |  187 +++++
 flim/patches/patch-mmcooked.el           |   76 +++
 flim/patches/patch-mmexternal.el         |   12 +
 flim/patches/patch-mmgeneric.el          |  105 +++
 flim/patches/patch-qmtp.el               |   30 +
 flim/patches/patch-sasl-cram.el          |   20 +
 flim/patches/patch-sasl-digest.el        |   20 +
 flim/patches/patch-sasl-scram.el         |   21 +
 flim/patches/patch-sasl-xoauth2.el       |  255 +++++++
 flim/patches/patch-sasl.el               |   94 +++
 flim/patches/patch-sha1.el               |   40 ++
 flim/patches/patch-smtp.el               |  381 +++++++++++
 flim/patches/patch-std11.el              | 1095 ++++++++++++++++++++++++++++++
 flim/patches/patch-tests_test-rfc2231.el |   31 +
 39 files changed, 6759 insertions(+), 1 deletion(-)

diffs:
diff --git a/flim/buildlink3.mk b/flim/buildlink3.mk
index 2649177e77..ffe202a1d1 100644
--- a/flim/buildlink3.mk
+++ b/flim/buildlink3.mk
@@ -7,7 +7,7 @@ BUILDLINK_TREE+=	flim
 FLIM_BUILDLINK3_MK:=
 
 BUILDLINK_API_DEPENDS.flim+=	${EMACS_PKGNAME_PREFIX}flim>=1.14
-BUILDLINK_PKGSRCDIR.flim?=	../../local-mef/flim-git
+BUILDLINK_PKGSRCDIR.flim?=	../../wip/flim
 
 BUILDLINK_CONTENTS_FILTER.flim=	${EGREP} '.*\.el$$|.*\.elc$$'
 
diff --git a/flim/patches/patch-ChangeLog b/flim/patches/patch-ChangeLog
new file mode 100644
index 0000000000..248d5daf89
--- /dev/null
+++ b/flim/patches/patch-ChangeLog
@@ -0,0 +1,1018 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./ChangeLog	2007-11-28 18:13:25.000000000 +0900
++++ ././ChangeLog	2020-09-05 16:02:47.286943577 +0900
+@@ -1,6 +1,821 @@
++2020-08-24  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-def.el: Change product name to 'FLIM-LB'.
++
++2020-08-19  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Change non-ASCII text files's coding-system to UTF-8
++
++	* ChangeLog:  Likewise.
++
++	* README.ja: Likewise.
++
++	* mime-ja.texi: Likewize.  Assume LuaTex for typesetting.
++
++	* mime-en.texi: Likewise.  Assume LuaTex for typesetting, because
++	this file is partially written in Japanese.
++
++2020-08-05  Naoya Yamashita  <conao3%gmail.com@localhost>
++
++	Fix closing parens position (cosmetic change only).
++	Cf. https://github.com/wanderlust/flim/pull/11
++
++2020-08-03  Naoya Yamashita  <conao3%gmail.com@localhost>
++
++	Use ?\s instead of ?(whitespace).
++	Cf. https://github.com/wanderlust/flim/pull/10
++
++	* eword-decode.el (eword-decode-encoded-words): Likewise.
++
++	* eword-encode.el (eword-encode-rword-list, ew-encode-rword-1)
++	(tm-eword::string-to-ruled-words): Likewise.
++
++	* mel-q-ccl.el (mel-ccl-decode-quoted-printable-generic)
++	(mel-ccl-encode-quoted-printable-generic, mel-ccl-decode-q):
++	Likewise.
++
++	* mel-q.el (quoted-printable-internal-encode-region): Likewise.
++
++	* mel.el (Q-encoded-text-length): Likewise.
++
++	* mime-conf.el (mime-mailcap-look-at-schar): Likewise
++
++	* smtp.el (smtp-deduce-address-list): Likewise.
++
++	* std11.el (std11-space-char-list): Likewise.
++
++2020-06-26  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* std11.el (std11-addr-to-string): Fix typo.
++	Cf. https://github.com/wanderlust/wanderlust/issues/175
++
++2020-06-14  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Minor refactorings.
++
++	* eword-decode.el (eword-decode-encoded-words)
++	(eword-analyze-comment, eword-decode-token): Reduce use of concat
++	function.
++
++	* sasl.el (sasl-unique-id-number-base36): Replace char-to-string
++	by list for concat function's arguments.
++
++	* smtp.el (smtp-send-data): Minor refactoring.
++
++	* std11.el (std11-header-string, std11-header-string-except)
++	(std11-fill-msg-id-list-string): Reduce use of concat function.
++	(std11-parse-group, std11-addr-to-string): Minor refactorings.
++
++2020-06-05  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* FLIM-MK: Assume Emacs 24 or later.
++
++2020-06-03  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Use following-char and preceding-char instead of char-after and
++	char-before for the current point.
++
++	* mel-q.el (quoted-printable-internal-encode-region)
++	(quoted-printable-internal-decode-region): Likewise.
++
++	* mime-conf.el (mime-mailcap-skip-comment)
++	(mime-mailcap-look-at-type-field, mime-mailcap-look-at-schar)
++	(mime-mailcap-look-at-qchar): Likewise.
++
++	* mime-parse.el (mime-decode-parameter-encode-segment)
++	(mime-divide-extended-parameter, mime-encode-extended-parameter)
++	(mime-divide-regular-parameter, mime-encode-regular-parameter):
++	Likewise.
++
++2020-06-02  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Strip use of function wrapping lambda.
++
++	* eword-encode.el
++	(eword-encode-Content-Disposition-field-body-broken-mime)
++	(eword-encode-Content-Type-field-body-broken-mime)
++	(eword-encode-Content-Disposition-field-body)
++	(eword-encode-Content-Type-field-body): Likewise.
++
++	* mel-q.el (q-encoding-decode-string, q-encoding-encode-string):
++	Likewise.
++
++	* std11.el (std11-full-name-string, std11-addr-to-string):
++	Likewise.
++
++2020-05-30  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-decode.el (eword-decode-encoded-words): Fix cl
++	dependencies.
++
++	* eword-encode.el: Adjust dependencies.
++
++	* mel-q.el: Adjust dependencies.
++	(quoted-printable-internal-decode-region): Use string-to-list
++	instead of string-to-char-list.
++
++	* mel.el: Adjust dependencies.
++
++	* mime-parse.el: Adjust dependencies.
++
++	* std11.el: Adjust dependencies.
++
++2020-05-23  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Use lexical binding.
++
++	* eword-decode.el: Likewise.
++
++	* eword-encode.el: Likewise.
++
++	* hmac-md5.el: Likewise.
++
++	* hmac-sha1.el: Likewise.
++
++	* luna.el: Likewise.
++
++	* lunit.el: Likewise.
++
++	* md5.el: Likewise.
++
++	* mel-g.el: Likewise.
++
++	* mel-q-ccl.el: Likewise.
++
++	* mel-q.el: Likewise.
++
++	* mel-u.el: Likewise.
++
++	* mel.el: Likewise.
++
++	* mime-conf.el: Likewise.
++
++	* mime-def.el: Likewise.
++
++	* mime-parse.el: Likewise.
++
++	* mime.el: Likewise.
++
++	* mmbuffer.el: Likewise.
++
++	* mmcooked.el: Likewise.
++
++	* mmexternal.el: Likewise.
++
++	* mmgeneric.el: Likewise.
++
++	* qmtp.el: Likewise.
++
++	* sasl-cram.el: Likewise.
++
++	* sasl-digest.el: Likewise.
++
++	* sasl-scram.el: Likewise.
++
++	* sasl-xoauth2.el: Likewise.
++
++	* sasl.el: Likewise.
++
++	* sha1.el: Likewise.
++
++	* smtp.el: Likewise.
++
++	* std11.el: Likewise.
++
++2020-05-23  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Support additional SASL mechanism libraries.
++
++	* sasl.el (sasl-additional-mechanism-alist): New variable.
++	(sasl-mechanism-alist): Include entries for additional libraries.
++	(sasl-mechanisms): Calculate from sasl-mechanism-alist.
++
++2020-05-23  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Rmove some files which are inluded in Emacs.
++
++	* hmac-def.el: Removed.
++
++	* hex-utils.el: Removed.
++
++	* sasl-ntlm.el: Removed.
++
++	* FLIM-ELS (flim-modules, hmac-modules): Remove removed files.
++
++2020-05-23  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Suppress byte-compiler's warnings.
++
++	* eword-decode.el (eword-decode-header): Add obsolete date.
++
++	* eword-encode.el: Fix dependency.
++	(eword-encode-header, eword-in-subject-p)
++	(eword-encode-field-body): Add obsolete date.
++
++	* mime-def.el: Remove dependecy on static.el.
++	(eval-when-compile): Assume Emacs24 or later.
++	(mime-message-structure): Add obsolete date.
++
++	* mime-parse.el: Fix dependency.
++	(mime-parse-parameters-from-list): Add obsolete date.
++
++	* qmtp.el (qmtp-via-qmtp): Add obsolete date.
++
++	* smtp.el (smtp-via-smtp): Add obsolete date.
++
++	* std11.el (std11-parse-in-reply-to): Add obsolete date.
++
++2020-05-23  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Drop old platforms support, dependency on cl.el.  Now supported
++	Emacsen are version 24 and later.
++
++	* FLIM-ELS: Assume Emacs version 24 or later.
++
++	* eword-encode.el: Likewise.
++
++	* md5.el: Likewise.
++
++	* mel-q-ccl.el: Likewise.
++
++	* mel-q.el: Likewise.
++
++	* mel.el: Likewise.
++
++	* sha1.el: Likewise.
++
++	* eword-decode.el: Use cl-lib instead of cl.
++
++	* md5-dl.el: Removed.
++
++	* md5-el.el: Removed.
++
++	* mel-b-ccl.el: Removed.
++
++	* mel-b-dl.el: Removed.
++
++	* mel-b-el.el: Removed.
++
++	* sha1-el.el: Removed.
++
++	* sha1-dl.el: Removed.
++
++	* md4.el: Removed.  Included in Emacs.
++
++	* ntlm.el: Removed.  Included in Emacs.
++
++	* smtpmail.el: Removed.  Included in Emacs.
++
++2020-03-03  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* sasl-xoauth2.el (sasl-xoauth2-response): Fix typo in variable name.
++
++2020-02-28  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* sasl.el (sasl-mechanism-alist, sasl-mechanisms): Add OAUTHBEARER
++	as alias for XOAUTH2.
++
++2019-05-26  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-decode.el (eword-decode-token): Escape characters which
++	cause warning from byte compiler.
++
++2018-03-29  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Fix EHLO command is sent twice after STARTTLS command when
++	built-in GnuTLS library is used.
++
++	* smtp.el (smtp-open-gnutls-starttls-stream): Abolished.
++	(smtp-open-connection): Do not use smtp-open-gnutls-starttls-stream.
++	(smtp-primitive-starttls): Use gnutls-negotiate when built-in
++	GnuTLS is used for STARTTLS connection.
++
++2018-01-18  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	XOAUTH2 authentication support is introduced (experimental).
++
++	* FLIM-ELS: Install sasl-xoauth2.el when oauth2.el is installed.
++
++	* sasl.el (sasl-mechanisms, sasl-mechanism-alist): Add entry for
++	XOAUTH2.
++
++	* sasl-xoauth2.el: New file.
++
++2016-12-06  Piotr Trojanek  <piotr.trojanek%gmail.com@localhost>
++
++	* luna.el (luna-class-find-member)
++	(luna-class-find-or-make-member): do not modify input argument.
++
++2016-11-30  Piotr Trojanek  <piotr.trojanek%gmail.com@localhost>
++
++	* luna.el (luna-define-class-function): simplify iteration with
++	dolist.
++
++2016-10-30  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* std11.el (std11-full-name-string): Refactored.
++
++2016-10-30  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-decode.el (eword-decode-structured-field-body)
++	(eword-decode-and-unfold-structured-field-body)
++	(eword-decode-and-fold-structured-field-body): Decrease number of
++	times for calling concat function.
++
++	* std11.el (std11-wrap-as-quoted-pairs, std11-strip-quoted-pair)
++	(std11-comment-value-to-string): Likewise.
++
++2016-10-30  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* smtp.el (smtp-send-buffer, smtp-send-buffer-by-myself): Call
++	kill-buffer with nil.  Only Emacs 23 and later support omitting an
++	argument for kill-buffer.  Reported By Tatsuya Kinoshita
++	<tats%vega.ocn.ne.jp@localhost>.  Cf. [wl:14662]
++
++2016-08-31  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-decode.el (eword-analyze-encoded-word): Fix the check for
++	non-atom special chars to permit space chars.
++
++2016-08-14  Erik Hetzner  <egh%e6h.org@localhost>
++
++	* mime-en.texi: Add dir entry
++
++	* mime-ja.texi: Likewise
++
++2016-08-13  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-decode.el (eword-analyze-encoded-word): Quote decoded word
++	when it contains non-atom special chars and not quoted.
++	Cf. https://github.com/wanderlust/wanderlust/issues/126
++
++2016-03-12  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel.el (mel-prompt-for-encoding): New function.
++	(mime-encode-region, mime-decode-region)
++	(mime-insert-encoded-file, mime-write-decoded-region): Use it.
++
++2015-12-13  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* smtp.el (smtp-send-buffer, smtp-send-buffer-by-myself): Kill
++	trace buffer after sending when smtp-debug is nil and network
++	stream is disconnected.  Suggested by Herbert J. Skuhra
++	<herbert%oslo.ath.cx@localhost>
++
++2015-07-30  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* smtp.el (smtp-primitive-auth): Fix the case that server returns
++	human readable string for AUTH command.
++
++2015-05-23  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* smtp.el (smtp-make-fqdn): Show more informative message for
++	invalid FQDN.
++	Cf. https://github.com/wanderlust/wanderlust/issues/96
++
++2015-05-02  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-encode.el: Require poem.el for non-mule.
++
++2015-04-30  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-parse.el (mime-default-ccl-lexical-analyzer)
++	(mime-ccl-lexical-analyzer): Fix for CCL unusable environments.
++
++	* std11.el (std11-default-ccl-lexical-analyzer)
++	(std11-ccl-lexical-analyzer): Likeswise.
++
++2015-04-27  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-parse.el (mime-default-ccl-lexical-analyzer): Fix wrong
++	program is build on XEmacs.
++
++	Cf. https://github.com/wanderlust/flim/commit/488a4d70fb4ae57bdd30dc75c2d75579894e28a2
++
++	* std11.el (std11-default-ccl-lexical-analyzer): Likewise.
++
++2015-03-10  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-parse.el (mime-default-ccl-lexical-analyzer): Fix the case
++	input is terminated with space characters or non-closing comment.
++
++2014-12-21  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* std11.el (std11-ignored-token-p): Simplified.
++
++2014-12-16  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	CCL base lexical analyzers are available.  They are much faster.
++	If you modify `std11-lexical-analyzer' or `mime-lexical-analyzer',
++	you also need to modify `std11-ccl-lexical-analyzer' or
++	`mime-ccl-lexical-analyzer', respectively.
++
++	* mime-parse.el (mime-default-ccl-lexical-analyzer): New CCL program.
++	(mime-ccl-lexical-analyzer): New customizable variable.
++	(mime-lexical-analyze): Use CCL based lexical analyzer if
++	mime-ccl-lexical-analyzer is non-nil.
++
++	* std11.el (std11-default-ccl-lexical-analyzer): New CCL program.
++	(std11-ccl-lexical-analyzer): New customizable variable.
++	(std11-lexical-analyze): Use CCL based lexical analyzer if
++	std11-ccl-lexical-analyzer is non-nil.
++
++2014-11-09  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-en.texi (7bit): Fix typo.
++
++	* mime-ja.texi: Fix missing cross-references.
++
++2014-11-09  Erik Hetzner <egh%e6h.org@localhost>
++
++	* flim-pkg.el: New file.
++
++2014-11-09  Erik Hetzner <egh%e6h.org@localhost>
++
++	* mime-en.texi: Fix headers and missing cross-references.
++
++	* mime-ja.texi: Fix headers.
++
++	* mime-en.sgml: Removed.
++
++	* mime-ja.sgml: Removed.
++
++2014-09-15  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-conf.el (mime-format-mailcap-command): Minor refactoring.
++
++2014-09-13  Erik Hetzner <egh%e6h.org@localhost>
++
++	* mime-conf.el (mime-format-mailcap-command): Add quotes for
++	quoted file name to unquote.
++	Cf. https://github.com/wanderlust/flim/pull/3
++
++2014-08-31  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-parse.el (mime-decode-parameter-value)
++	(mime-decode-parameters): Use string-to-number instead of
++	string-to-int.
++
++2014-08-31  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-encode.el (eword-encode-char-type): Defined as macro.
++
++2014-08-31  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* lunit.el (lunit-generate-template): Use `with-current-buffer'
++	rather than save-excursion+set-buffer.
++
++	* mmbuffer.el (initialize-instance, mime-write-entity)
++	(mime-entity-body, mime-write-entity-body, mime-entity-content)
++	(mime-write-entity-content, mime-entity-fetch-field): Likewise.
++
++	* mmcooked.el (write-entity-content, write-entity)
++	(write-entity-body): Likewise.
++
++	* mmgeneric.el (mime-insert-header-from-buffer): Likewise.
++
++	* qmtp.el (qmtp-send-buffer): Likewise.
++
++	* smtp.el (smtp-package-buffer-internal-size, smtp-send-buffer)
++	(smtp-send-buffer-by-myself, smtp-primitive-data)
++	(smtp-process-filter, smtp-send-command)
++	(smtp-deduce-address-list): Likewise.
++
++2014-06-20  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Un-encoded garbage handling is available when built-in base64
++	decoder is used.
++
++	* mel.el (mel-b-builtin-garbage-strategy): New customizable
++	variable.
++	(mel-b-builtin-encoded-line-regexp): New variable.
++	(mel-b-builtin-decode-string, mel-b-builtin-decode-region): New
++	functions.
++	(mime-decode-string, mime-decode-region)
++	(mime-write-decoded-region): (mel-b-builtin) Use them.
++
++2014-05-31  Juliusz Chroboczek  <jch%pps.univ-paris-diderot.fr@localhost>
++
++	* mel.el (mime-insert-encoded-file): Avoid going through an
++	intermediary string, work inline.
++	(mime-write-decoded-region): likewise.
++
++2014-04-23  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* FLIM-ELS: Check whether secure-hash function is defined.
++	Cf. https://github.com/ikazuhiro/flim/commit/85bbe382c4812fd041207aa727acba8ece2e7a39#commitcomment-6082738
++
++	* hmac-md5.el: Likewise.
++
++	* hmac-sha1.el: Likewise.
++
++	* sha1.el (TOP, sha1-dl-module): Likewise.
++
++2014-04-15  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* FLIM-ELS: Install sha1-el.el when dynamic-link is available and
++	built-in sha1 library is not available.
++
++2014-04-05  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* std11.el (std11-narrow-to-header)
++	(std11-field-bodies): Minor refactoring.
++
++2014-03-30  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* sasl-cram.el: Require hex-util.el.
++
++	* sasl-digest.el: Require hex-util.el.
++
++	* hmac-md5.el: Do not require hex-util.el.  Define autoload for
++	decode-hex-string only when needed.
++	(md5-binary): Use built-in functionality if available.
++
++	* hmac-sha1.el: Linkewise.
++	(sha1-binary): Use built-in functionality if available.
++
++2014-03-29  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* FLIM-ELS: Do not install sha1-el.el when built-in SHA1 library
++	is available.
++
++	* sha1.el: Do not require sha1-el.el in the above case.
++	(sha1-dl-module): set to nil in the above case.
++
++2014-02-22  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel-q-ccl.el (quoted-printable-ccl-insert-encoded-file): Call
++	insert-file-contents-literally directly.
++
++2013-07-05  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-encode.el: Fix the previous change for really checking.
++
++2013-07-04  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-encode.el: Check whether the mule-vesion variable is defined.
++
++2013-06-26  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mailcap.el: Removed to resolve compatibility problem when run in
++	expanded place.
++
++2013-03-23  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Many encoder/decoder functions now always encode/decode regardless
++	buffer's multibyteness.
++	* mime-def.el (mime-charset-decode-string)
++	(mime-charset-encode-string): New functions.
++
++	* mime-parse.el (mime-decode-parameter-value)
++	(mime-encode-extended-parameter): Use them.
++
++	* eword-decode.el (eword-decode-unstructured-field-body)
++	(eword-decode-and-unfold-unstructured-field-body)
++	(eword-decode-unfolded-unstructured-field-body)
++	(eword-decode-encoded-words, eword-analyze-quoted-string)
++	(eword-analyze-comment, eword-analyze-atom): Use
++	mime-charset-decode-string instead of decode-mime-charset-string.
++
++	* eword-encode.el (tm-eword::encoded-word-length)
++	(tm-eword::encoded-word-length): Use mime-charset-encode-string
++	instead of encode-mime-charset-string.
++
++2012-08-14  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* std11.el (std11-unfold-strip-leading-tab): New variable.
++	(std11-unfold-string): Use it.  Workaround for incorrect folding.
++
++2012-08-10  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel-q-ccl.el (q-encoding-ccl-decode-string): Remove duplicate
++	definition for Emacs 23.1.
++
++2012-07-29  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-encode.el (ew-find-string-rule): Define own function for
++	Emacs23 which has APEL with detect-mime-charset-string for it.
++	(ew-find-charset-rule): Define only when needed.
++
++2012-07-29  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-encode.el (ew-find-string-rule): New function.
++	(eword-encode-phrase-to-rword-list): Use it.
++
++2012-07-29  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-encode.el (tm-eword::string-to-ruled-words): Define own
++	function for Emacs23 which has APEL with
++	detect-mime-charset-string for it.
++	(eword-encode-char-type, eword-encode-divide-into-charset-words)
++	(eword-encode-charset-words-to-words): Define only when needed.
++
++2012-07-29  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* eword-encode.el (tm-eword::string-to-ruled-words): New function.
++	(eword-encode-split-string, eword-encode-phrase-to-rword-list):
++	Use it.
++
++2012-04-28  MORIOKA Tomohiko  <tomo.git%chise.org@localhost>
++
++	* README.ja, README.en (Bug reports): Use "Emacs-MIME" instead of
++	"EMACS-MIME".
++
++2001-02-27  Martin Buchholz  <martin%xemacs.org@localhost>
++
++	* mime-en.sgml: Typo fix.
++
++2012-04-28  MORIOKA Tomohiko  <tomo%zinbun.kyoto-u.ac.jp@localhost>
++
++	* README.ja, README.en (Bug reports): Modify for
++	emacs-mime-{en|ja}@lists.chise.org.
++
++2012-04-20  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-parse.el (mime-parse-message): Use mime-read-Content-Type
++	instead of mime-parse-Content-Type.
++
++2012-04-07  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* smtp.el (smtp-open-connection): Raise error when open connection
++	function failed.
++
++2012-03-20  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Support built-in GnuTLS for STARTTLS connection.
++	* smtp.el (smtp-use-gnutls): New cutomizable variable.
++	(smtp-open-gnutls-starttls-stream): New function.
++	(smtp-submit-package): Respect smtp-use-gnutls's value.
++	(smtp-send-buffer, smtp-send-buffer-by-myself): Do not
++	decide smtp-open-connection-function's value here.
++	(smtp-open-connection): Decide which open-connection-function is
++	called here.  Respect smtp-use-gnutls's value.
++
++2011-06-27  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel-q.el (quoted-printable-num-to-raw-byte-char): Enclose with
++	eval-and-compile().
++
++2011-06-24  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-parse.el (mime-encode-parameters-broken-mime): New function.
++
++	* eword-encode.el (eword-encode-Content-Type-field-body-broken-mime)
++	(eword-encode-Content-Disposition-field-body-broken-mime): New
++	functions.  If you want to use them, modify
++	`mime-header-encode-method-alist'.
++
++2011-06-19  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Revert the change of 2004-02-17.
++	* smtp.el (smtp-starttls-program, smtp-starttls-extra-args):
++	Abolished.
++	(smtp-send-buffer): Likewise.
++
++2011-06-09  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime.el (mime-entity-filename): When a result is got from entity
++	header, decode it.
++
++2011-06-07  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	Merged from rfc2231-encoder branch.
++	* eword-encode.el (eword-encode-Content-Type-field-body)
++	(eword-encode-Content-Disposition-field-body): New functions.
++
++	* mime-def.el (mime-attribute-char-regexp): Update for RFC2231.
++	(mime-non-attribute-char-regexp): New constant.
++
++	* mime-parse.el (mime-divide-extended-parameter)
++	(mime-encode-extended-parameter, mime-divide-regular-parameter)
++	(mime-encode-regular-parameter, mime-encode-parameters): New
++	functions.
++
++2011-05-16  David Maus  <dmaus%ictsoc.de@localhost>
++
++	* md4.el (md4-make-step): Use new style backqoutes. Slipped
++	through 2010-11-14.
++
++2010-11-14  HAMANO Kiyoto  <khiker.mail%gmail.com@localhost>
++
++	* sha1-el.el (sha1-F0, sha1-F1, sha1-F2, sha1-F3, sha1-S1)
++	(sha1-S5, sha1-S30, sha1-OP, sha1-add-to-H): Use new style
++	backquotes.
++
++	* md5-el.el: Dto.
++
++	* md4.el (md4-make-step): Dto.
++
++	* hmac-def.el (define-hmac-function): Dto.
++
++	* hex-util.el (hex-char-to-num, hex-char-to-char): Dto.
++
++	* eword-encode.el (make-ew-rword, ew-rword-text)
++	(ew-rword-charset, ew-rword-encoding, ew-rword-type): Dto.
++
++2010-11-13  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mime-parse.el (mime-uri-parse-cid): Respect
++	mime-field-parser-alist's value.
++
++2010-08-05  Tetsurou Okazaki  <okazaki%be.to@localhost>
++
++	* smtp.el (smtp-submit-package): Handle the case that
++	`smtp-find-connection' returns nil in unwind forms.
++
++2010-06-21  Katsumi Yamaoka  <yamaoka%jpl.org@localhost>
++
++	* FLIM-CFG: Add emu subdirectory to load-path when LISPDIR is
++	specified.  Suggested by Kazuhiro NISHIYAMA <zn%mbf.nifty.com@localhost>.
++
++2010-03-10  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel-q-ccl.el (quoted-printable-ccl-decode-string)
++	(q-encoding-ccl-decode-string): Use ccl-execute-on-string() when
++	encoder for CCL coding system is broken.
++	(quoted-printable-ccl-decode-region)
++	(quoted-printable-ccl-write-decoded-region): Use
++	quoted-printable-ccl-decode-string in the above environment.
++	(TOP): Check facility for them.  Another check for decoder for ccl
++	coding system is added.
++
++	* mel-q.el (quoted-printable-num-to-raw-byte-char): New inline
++	function.
++	(quoted-printable-internal-decode-region)
++	(q-encoding-decode-string): Use it.
++
++2010-02-20  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel-q-ccl.el (quoted-printable-ccl-encode-string)
++	(quoted-printable-ccl-insert-encoded-file)
++	(q-encoding-ccl-encode-string): Change branches to facility based.
++	(TOP): Check facility for them.
++
++2010-02-18  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel-q-ccl.el (quoted-printable-ccl-encode-string)
++	(quoted-printable-ccl-insert-encoded-file)
++	(q-encoding-ccl-encode-string): Make new vector instead of use of
++	the one that is hard-coded in the program.
++
++2010-02-14  Tetsurou Okazaki  <okazaki%be.to@localhost>
++
++	* smtp.el (smtp-primitive-mailfrom): Fixed two spaces may be used
++	as a separator before "BODY=8BITMIME".
++
++2010-02-09  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel-q-ccl.el (quoted-printable-ccl-encode-string)
++	(quoted-printable-ccl-insert-encoded-file)
++	(q-encoding-ccl-encode-string): Use ccl-execute-on-string() on
++	Emacs 23.1.
++	(quoted-printable-ccl-encode-region): Use
++	quoted-printable-ccl-encode-string() on Emacs 23.1.
++
++2010-01-25  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel-q-ccl.el (mel-ccl-encode-quoted-printable-generic): Output
++	invalid character as is.
++
++2010-01-24  Kazuhiro Ito  <kzhr%d1.dion.ne.jp@localhost>
++
++	* mel.el (8bit-write-decoded-region): Use no-conversion coding
++	system for writing.
++
++	* mel-q.el (quoted-printable-quote-char)
++	(quoted-printable-internal-encode-region): Support Emacs 23
++	raw-byte characters in multibyte string.
++
++	* mel-q-ccl.el (mel-ccl-decode-q)
++	(mel-ccl-encode-q-generic)
++	(mel-ccl-encode-quoted-printable-generic): Ditto.
++	(quoted-printable-ccl-write-decoded-region): Use LF eol coding
++	system explicitly.
++
++2008-11-25  Katsumi Yamaoka  <yamaoka%jpl.org@localhost>
++
++	* eword-decode.el (eword-decode-string, eword-decode-region):
++	Mention language info in doc string.
++
++2008-11-25  Katsumi Yamaoka  <yamaoka%jpl.org@localhost>
++
++	* eword-decode.el (eword-decode-string, eword-decode-region)
++	(eword-analyze-encoded-word): Express the language portion of an
++	encoded word as a symbol.
++
++	* tests/test-rfc2231.el (test-rfc2231-encoded-word-1)
++	(test-rfc2231-encoded-word-2, test-rfc2231-encoded-word-3): Use
++	eword-decode-string instead of eword-decode-encoded-word.
++
++2008-09-20  Yoichi NAKAYAMA  <yoichi%geiin.org@localhost>
++
++	* mel-q-ccl.el (mel-ccl-256-to-16-table): Accept (illegal) lower
++	case representation for decoding.
++
++
+ 2007-11-28  MORIOKA Tomohiko  <tomo%kanji.zinbun.kyoto-u.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.14.9 (Goj-D�eleased.-A
++	* FLIM: Version 1.14.9 (Gojō) released.
+ 
+ 2006-12-20  MORIOKA Tomohiko  <tomo%kanji.zinbun.kyoto-u.ac.jp@localhost>
+ 
+@@ -86,7 +901,7 @@
+ 
+ 2005-12-25  MORIOKA Tomohiko  <tomo%kanji.zinbun.kyoto-u.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.14.8 (Shij-D�eleased.-A
++	* FLIM: Version 1.14.8 (Shijō) released.
+ 
+ 2005-12-25  MORIOKA Tomohiko  <tomo%kanji.zinbun.kyoto-u.ac.jp@localhost>
+ 
+@@ -111,7 +926,7 @@
+ 
+ 2004-10-01  MORIOKA Tomohiko  <tomo%mousai.as.wakwak.ne.jp@localhost>
+ 
+-	* FLIM: Version 1.14.7 (Sanj-D�eleased.-A
++	* FLIM: Version 1.14.7 (Sanjō) released.
+ 
+ 2004-10-01  MORIOKA Tomohiko  <tomo%kanji.zinbun.kyoto-u.ac.jp@localhost>
+ 
+@@ -399,7 +1214,7 @@
+ 
+ 2002-06-03  MORIOKA Tomohiko  <tomo%kanji.zinbun.kyoto-u.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.14.4 (Kashiharajing-D�-mae) released.-A
++	* FLIM: Version 1.14.4 (Kashiharajingū-mae) released.
+ 
+ 2002-01-16  Hiroya Murata     <lapis-lazuli%pop06.odn.ne.jp@localhost>
+ 
+@@ -450,7 +1265,7 @@
+ 
+ 2001-06-01  MORIOKA Tomohiko  <tomo%kanji.zinbun.kyoto-u.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.14.3 (Unebigory-D�) released.-A
++	* FLIM: Version 1.14.3 (Unebigoryōmae) released.
+ 
+ 2001-06-01  Katsumi Yamaoka   <yamaoka%jpl.org@localhost>
+ 
+@@ -1512,7 +2327,7 @@
+ 
+ 2000-07-12  MORIOKA Tomohiko  <tomo%kanji.zinbun.kyoto-u.ac.jp@localhost>
+ 
+-	* FLIM-Chao: Version 1.14.1 (Rokujiz-D�eleased.-A
++	* FLIM-Chao: Version 1.14.1 (Rokujizō) released.
+ 
+ 2000-07-10  MORIOKA Tomohiko  <tomo%kanji.zinbun.kyoto-u.ac.jp@localhost>
+ 
+@@ -2130,7 +2945,7 @@
+ 
+ 1999-05-31  MORIOKA Tomohiko  <tomo%m17n.org@localhost>
+ 
+-	* FLIM: Version 1.12.7 (Y-D�zaki) released.-A
++	* FLIM: Version 1.12.7 (Yūzaki) released.
+ 
+ 1999-05-31  MORIOKA Tomohiko  <tomo%m17n.org@localhost>
+ 
+@@ -2305,7 +3120,7 @@
+ 
+ 1999-05-11  MORIOKA Tomohiko  <tomo%m17n.org@localhost>
+ 
+-	* FLIM: Version 1.12.6 (Family-K-D�ae) released.-A
++	* FLIM: Version 1.12.6 (Family-Kōenmae) released.
+ 
+ 1999-04-27  Shuhei KOBAYASHI  <shuhei%aqua.ocn.ne.jp@localhost>
+ 
+@@ -2422,7 +3237,7 @@
+ 
+ 1999-01-23  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.12.3 (Kintetsu-K-D�ama) released.-A
++	* FLIM: Version 1.12.3 (Kintetsu-Kōriyama) released.
+ 
+ 1999-01-23  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+@@ -2465,7 +3280,7 @@
+ 
+ 1999-01-21  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.12.2 (Kuj-D�eleased.-A
++	* FLIM: Version 1.12.2 (Kujō) released.
+ 
+ 1999-01-16  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+@@ -2651,7 +3466,7 @@
+ 
+ 1998-12-02  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.12.1 (Nishinoky-D�eleased.-A
++	* FLIM: Version 1.12.1 (Nishinokyō) released.
+ 
+ 1998-11-30  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+@@ -2869,7 +3684,7 @@
+ 
+ 1998-10-26  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.11.2 (Heij-D�as released.-A
++	* FLIM: Version 1.11.2 (Heijō) was released.
+ 
+ 	* NEWS (Abolish variable `mime-temp-directory'): New subsection.
+ 
+@@ -3149,7 +3964,7 @@
+ 
+ 1998-10-12  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.10.4 (Shin-H-D�o) was released.-A
++	* FLIM: Version 1.10.4 (Shin-Hōsono) was released.
+ 
+ 1998-10-12  Katsumi Yamaoka   <yamaoka%jpl.org@localhost>
+ 
+@@ -3334,7 +4149,7 @@
+ 
+ 1998-09-29  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.10.0 (K-D� was released.-A
++	* FLIM: Version 1.10.0 (Kōdo) was released.
+ 
+ 	* README.en (What's FLIM): Add mel-ccl.el.
+ 
+@@ -3621,7 +4436,7 @@
+ 
+ 1998-08-31  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.9.1 (Tonosh-D�as released.-A
++	* FLIM: Version 1.9.1 (Tonoshō) was released.
+ 
+ 	* mime-en.sgml (mm-backend): Translate a little.
+ 
+@@ -3764,7 +4579,7 @@
+ 
+ 1998-07-07  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM-Chao: Version 1.8.0 (Shij-D�as released.-A
++	* FLIM-Chao: Version 1.8.0 (Shijō) was released.
+ 
+ 1998-07-07  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+@@ -3876,7 +4691,7 @@
+ 
+ 1998-07-01  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.8.0 (-D�ubo) was released.-A
++	* FLIM: Version 1.8.0 (Ōkubo) was released.
+ 
+ 	* README.en: Delete `How to use'.
+ 
+@@ -4001,7 +4816,7 @@
+ 
+ 1998-06-28  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM-Chao: Version 1.7.0 (Goj-D�as released.-A
++	* FLIM-Chao: Version 1.7.0 (Gojō) was released.
+ 
+ 1998-06-26  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+@@ -4260,7 +5075,7 @@
+ 
+ 1998-06-19  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.4.1 (Momoyama-Gory-D�) was released.-A
++	* FLIM: Version 1.4.1 (Momoyama-Goryōmae) was released.
+ 
+ 1998-06-18  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+@@ -4380,7 +5195,7 @@
+ 
+ 1998-05-06  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.2.0 (J-D�j�as released.-A
++	* FLIM: Version 1.2.0 (Jūjō) was released.
+ 
+ 	* README.en (What's FLIM): Delete description about
+  	std11-parse.el; add description about mailcap.el.
+@@ -4431,7 +5246,7 @@
+ 
+ 1998-05-05  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.1.0 (T-D� was released.-A
++	* FLIM: Version 1.1.0 (Tōji) was released.
+ 
+ 1998-05-04  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+@@ -4467,7 +5282,7 @@
+ 
+ 1998-04-17  MORIOKA Tomohiko  <morioka%jaist.ac.jp@localhost>
+ 
+-	* FLIM: Version 1.0.1 (Ky-D� was released.-A
++	* FLIM: Version 1.0.1 (Kyōto) was released.
+ 
+ 	* mime-def.el (mime-spadework-module-version-string): New
+  	constant.
diff --git a/flim/patches/patch-FLIM-CFG b/flim/patches/patch-FLIM-CFG
new file mode 100644
index 0000000000..544a3fb7c1
--- /dev/null
+++ b/flim/patches/patch-FLIM-CFG
@@ -0,0 +1,14 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./FLIM-CFG	2006-12-21 02:40:42.000000000 +0900
++++ ././FLIM-CFG	2018-07-29 22:48:22.272294473 +0900
+@@ -13,6 +13,7 @@
+     (progn
+       (add-to-list 'default-load-path LISPDIR)
+       (add-to-list 'load-path LISPDIR)
++      (add-to-list 'load-path (expand-file-name "emu" LISPDIR))
+       (add-to-list 'load-path (expand-file-name "apel" LISPDIR))))
+ 
+ (if (boundp 'VERSION_SPECIFIC_LISPDIR)
diff --git a/flim/patches/patch-FLIM-ELS b/flim/patches/patch-FLIM-ELS
new file mode 100644
index 0000000000..9a0730d317
--- /dev/null
+++ b/flim/patches/patch-FLIM-ELS
@@ -0,0 +1,50 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./FLIM-ELS	2003-11-13 09:31:39.000000000 +0900
++++ ././FLIM-ELS	2020-09-05 16:02:39.898246465 +0900
+@@ -12,37 +12,19 @@
+ 		     mmbuffer mmcooked mmexternal
+ 		     mime-conf
+ 		     sasl sasl-cram sasl-digest
+-		     md4 ntlm sasl-ntlm sasl-scram
++		     sasl-scram
+ 		     smtp qmtp))
+ 
+ (setq flim-version-specific-modules nil)
+ 
+-(setq hmac-modules '(hex-util
+-		     hmac-def md5 sha1
+-		     hmac-md5 hmac-sha1))
+-
+-(if (and (fboundp 'base64-encode-string)
+-	 (subrp (symbol-function 'base64-encode-string)))
+-    nil
+-  (if (fboundp 'dynamic-link)
+-      (setq flim-modules (cons 'mel-b-dl flim-modules))))
+-(setq flim-modules (cons 'mel-b-el flim-modules))
++(setq hmac-modules '(md5 sha1 hmac-md5 hmac-sha1))
+ 
+ (require 'pccl)
+ (unless-broken ccl-usable
+-  (setq flim-modules (cons 'mel-b-ccl (cons 'mel-q-ccl flim-modules))))
+-
+-(if (and (fboundp 'md5)
+-	 (subrp (symbol-function 'md5)))
+-    nil
+-  (if (fboundp 'dynamic-link)
+-      (setq hmac-modules (cons 'md5-dl hmac-modules))
+-    (setq hmac-modules (cons 'md5-el hmac-modules))))
+-
+-(if (fboundp 'dynamic-link)
+-    (setq hmac-modules (cons 'sha1-dl hmac-modules))
+-  (setq hmac-modules (cons 'sha1-el hmac-modules)))
++  (setq flim-modules (cons 'mel-q-ccl flim-modules)))
+ 
+-(setq flim-modules (nconc hmac-modules flim-modules))
++(require 'path-util)
++(when (module-installed-p 'oauth2)
++  (setq flim-modules (append flim-modules '(sasl-xoauth2))))
+ 
+ ;;; FLIM-ELS ends here
diff --git a/flim/patches/patch-FLIM-MK b/flim/patches/patch-FLIM-MK
new file mode 100644
index 0000000000..afd6dbb9b0
--- /dev/null
+++ b/flim/patches/patch-FLIM-MK
@@ -0,0 +1,25 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./FLIM-MK	2006-12-12 17:21:00.000000000 +0900
++++ ././FLIM-MK	2020-09-05 16:02:39.898626305 +0900
+@@ -69,15 +69,9 @@
+ (defun compile-flim-package ()
+   (config-flim-package)
+ 
+-  (if (fboundp 'batch-update-directory-autoloads)
+-      ;; XEmacs 21.5.19 and newer.
+-      (progn
+-	(add-to-list 'command-line-args-left ".")
+-	(add-to-list 'command-line-args-left "flim")
+-	(batch-update-directory-autoloads))
+-    (setq autoload-package-name "flim")
+-    (add-to-list 'command-line-args-left ".")
+-    (batch-update-directory))
++  (setq autoload-package-name "flim")
++  (add-to-list 'command-line-args-left ".")
++  (batch-update-directory)
+ 
+   (add-to-list 'command-line-args-left ".")
+   (Custom-make-dependencies)
diff --git a/flim/patches/patch-README.en b/flim/patches/patch-README.en
new file mode 100644
index 0000000000..b81d9b98c3
--- /dev/null
+++ b/flim/patches/patch-README.en
@@ -0,0 +1,38 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./README.en	2006-12-21 02:44:48.000000000 +0900
++++ ././README.en	2018-07-29 22:48:22.273146888 +0900
+@@ -33,8 +33,6 @@
+       eword-decode.el --- encoded-word decoder
+       eword-encode.el --- encoded-word encoder
+ 
+-    mailcap.el	--- mailcap parser and utility
+-
+   This library should work on:
+ 
+ 	Emacs 20.4 and up
+@@ -136,14 +134,15 @@
+ ===========
+ 
+   If you write bug-reports and/or suggestions for improvement, please
+-  send them to the EMACS-MIME Mailing List:
++  send them to the Emacs-MIME Mailing Lists:
+ 
+-	emacs-mime-en%m17n.org@localhost	(English)
+-	emacs-mime-ja%m17n.org@localhost	(Japanese)
++	emacs-mime-en%lists.chise.org@localhost	(English)
++	emacs-mime-ja%lists.chise.org@localhost	(Japanese)
+ 
+-  Via the EMACS-MIME ML, you can report FLIM bugs, obtain the latest
++  Via the Emacs-MIME ML, you can report FLIM bugs, obtain the latest
+   release of FLIM, and discuss future enhancements to FLIM.  To join
+-  the EMACS-MIME ML, send an empty e-mail to
++  the Emacs-MIME ML, please see the descriptions of the following
++  pages:
+ 
+-	emacs-mime-en-ctl%m17n.org@localhost	(English)
+-	emacs-mime-ja-ctl%m17n.org@localhost	(Japanese)
++      http://lists.chise.org/mailman/listinfo/emacs-mime-en (English)
++      http://lists.chise.org/mailman/listinfo/emacs-mime-ja (Japanese)
diff --git a/flim/patches/patch-README.ja b/flim/patches/patch-README.ja
new file mode 100644
index 0000000000..04707bb097
--- /dev/null
+++ b/flim/patches/patch-README.ja
@@ -0,0 +1,244 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./README.ja	2006-12-21 03:06:14.000000000 +0900
++++ ././README.ja	2020-09-05 16:02:39.898751689 +0900
+@@ -1,159 +1,156 @@
+-[FLIM $B$N(B README ($BF|K\8lHG(B)]
++[FLIM の README (日本語版)]
+ 
+-FLIM $B$H$O!)(B
++FLIM とは?
+ ===========
+ 
+-  FLIM $B$O(B Internet message $B$K4X$9$kMM!9$JI=8=7A<0$dId9f2=$K4X$9$k4pAC(B
+-  $BE*$J5!G=$rDs6!$9$k$?$a$NHFMQItIJ$G$9!#(BFLIM $B$O0J2<$N%b%8%e!<%k$+$i9=(B
+-  $B@.$5$l$F$$$^$9(B:
++  FLIM は Internet message に関する様々な表現形式や符号化に関する基礎
++  的な機能を提供するための汎用部品です。FLIM は以下のモジュールから構
++  成されています:
+ 
+-    std11.el	--- STD 11 (RFC 822) $B7A<0$K4p$E$/2r@O=hM}Ey(B
++    std11.el	--- STD 11 (RFC 822) 形式に基づく解析処理等
+ 
+-    mime.el	--- MIME-entity $B$K4X$9$k=t5!G=$NDs6!(B
++    mime.el	--- MIME-entity に関する諸機能の提供
+ 
+-      mime-def.el --- MIME $B7A<0$K4X$9$kDj5A(B
++      mime-def.el --- MIME 形式に関する定義
+ 
+-      mime-parse.el --- MIME $B2r@O4o(B
++      mime-parse.el --- MIME 解析器
+ 
+-      mel.el --- MIME $BId9f4o(B/$BI|9f4o(B
+-	mel-b-dl.el --- base64 (B-encoding) $BId9f4o(B/$BI|9f4o(B
+-			(dynamic loading $B5!G=IU$-(B Emacs 20 $BMQ(B)
++      mel.el --- MIME 符号器/復号器
++	mel-b-dl.el --- base64 (B-encoding) 符号器/復号器
++			(dynamic loading 機能付き Emacs 20 用)
+ 	mel-b-ccl.el --- base64 (B-encoding) encoder/decoder (using CCL)
+-	mel-b-el.el --- base64 (B-encoding) $BId9f4o(B/$BI|9f4o(B
+-			($BB>$N(B emacsen $BMQ(B)
++	mel-b-el.el --- base64 (B-encoding) 符号器/復号器
++			(他の emacsen 用)
+ 	mel-q-ccl.el --- quoted-printable and Q-encoding
+ 			 encoder/decoder (using CCL)
+-	mel-q.el    --- quoted-printable $B$H(B Q-encoding
+-		    	$BId9f4o(B/$BI|9f4o(B
+-	mel-u.el    --- uuencode $B$N$?$a$NHs8x<0(B backend
+-	mel-g.el    --- gzip64 $B$N$?$a$NHs8x<0(B backend
++	mel-q.el    --- quoted-printable と Q-encoding
++		    	符号器/復号器
++	mel-u.el    --- uuencode のための非公式 backend
++	mel-g.el    --- gzip64 のための非公式 backend
+ 
+-      eword-decode.el --- encoded-word $BI|9f4o(B
+-      eword-encode.el --- encoded-word $BId9f4o(B
++      eword-decode.el --- encoded-word 復号器
++      eword-encode.el --- encoded-word 符号器
+ 
+-    mailcap.el	--- mailcap $B$N2r@O=hM}Ey(B
++  以下の環境で動作します:
+ 
+-  $B0J2<$N4D6-$GF0:n$7$^$9!'(B
++	Emacs 20.4 以降
++	XEmacs 21.1 以降
+ 
+-	Emacs 20.4 $B0J9_(B
+-	XEmacs 21.1 $B0J9_(B
+ 
+-
+-$BF3F~(B (Installation)
++導入 (Installation)
+ ===================
+ 
+-(0) $BF3F~(B (install) $B$9$kA0$K!"(BAPEL (10.7 $B0J9_(B) $B$rF3F~$7$F$/$@$5$$!#(BAPEL
+-    $B$O0J2<$N$H$3$m$G<hF@$G$-$^$9(B:
++(0) 導入 (install) する前に、APEL (10.7 以降) を導入してください。APEL
++    は以下のところで取得できます:
+ 
+ 	ftp://ftp.m17n.org/pub/mule/apel/
+ 
+-(1-a) $BE83+$7$?>l=j$X$NF3F~(B
++(1-a) 展開した場所への導入
+ 
+-  $BE83+$7$?>l=j$H$O0[$J$k>l=j$KF3F~$7$?$/$J$$$J$i!"(B
++  展開した場所とは異なる場所に導入したくないなら、
+ 
+ 	% make
+ 
+-  $B$@$1$r<B9T$7$F$/$@$5$$!#(B
++  だけを実行してください。
+ 
+-  emacs $B$N%3%^%s%IL>$r;XDj$9$k$3$H$,$G$-$^$9!#Nc$($P!"(B
++  emacs のコマンド名を指定することができます。例えば、
+ 
+ 	% make EMACS=xemacs
+ 
+-  `EMACS=...' $B$,>JN,$5$l$k$H!"(BEmacs=emacs $B$,;H$o$l$^$9!#(B
++  `EMACS=...' が省略されると、Emacs=emacs が使われます。
+ 
+ (b) make install
+ 
+-  $BE83+$7$?>l=j$H$O0[$J$k>l=j$KF3F~$7$?$$$J$i!"(B
++  展開した場所とは異なる場所に導入したいなら、
+ 
+ 	% make install
+ 
+-  $B$r<B9T$7$F$/$@$5$$!#(B
++  を実行してください。
+ 
+-  emacs $B$N%3%^%s%IL>$r;XDj$9$k$3$H$,$G$-$^$9!#Nc$($P!"(B
++  emacs のコマンド名を指定することができます。例えば、
+ 
+ 	% make install EMACS=xemacs
+ 
+-  `EMACS=...' $B$,>JN,$5$l$k$H!"(BEmacs=emacs $B$,;H$o$l$^$9!#(B
++  `EMACS=...' が省略されると、Emacs=emacs が使われます。
+ 
+-  Emacs Lisp $B%W%m%0%i%`$N$?$a$N%G%#%l%/%H%j!<LZ$N@\F,<-(B (prefix) $B$r;X(B
+-  $BDj$9$k$3$H$,$G$-$^$9!#Nc$($P!"(B
++  Emacs Lisp プログラムのためのディレクトリー木の接頭辞 (prefix) を指
++  定することができます。例えば、
+ 
+ 	% make install PREFIX=~/
+ 
+-  `PREFIX=...' $B$,>JN,$5$l$k$H!";XDj$5$l$?(B emacs $B%3%^%s%I$N%G%#%l%/%H%j!<(B
+-  $BLZ$N@\F,<-$,;HMQ$5$l$^$9(B ($B$*$=$i$/(B /usr/local $B$G$9(B)$B!#(B
++  `PREFIX=...' が省略されると、指定された emacs コマンドのディレクトリー
++  木の接頭辞が使用されます (おそらく /usr/local です)。
+ 
+-  $BNc$($P!"(BPREFIX=/usr/local $B$H(B Emacs 20.7 $B$,;XDj$5$l$l$P!"0J2<$N%G%#%l(B
+-  $B%/%H%j!<LZ$,:n@.$5$l$^$9!#(B
++  例えば、PREFIX=/usr/local と Emacs 20.7 が指定されれば、以下のディレ
++  クトリー木が作成されます。
+ 
+ 	/usr/local/share/emacs/site-lisp/flim/	--- FLIM
+ 	/usr/local/share/emacs/20.7/site-lisp/flim/	--- FLIM
+ 
+-  Emacs Lisp $B%W%m%0%i%`$N$?$a$N(B lisp $B%G%#%l%/%H%j!<$r;XDj$9$k$3$H$,$G(B
+-  $B$-$^$9!#Nc$($P!"(B:
++  Emacs Lisp プログラムのための lisp ディレクトリーを指定することがで
++  きます。例えば、:
+ 
+     % make install LISPDIR=~/share/emacs/elisp
+ 
+-  `LISPDIR=...' $B$,>JN,$5$l$k$H!";XDj$5$l$?(B emacs $B$N%3%^%s%I$N(B
+-  site-lisp $B%G%#%l%/%H%j!<$,;H$o$l$^$9(B ($B$*$=$i$/(B
+-  /usr/local/share/emacs/site-lisp $B$+(B /usr/local/lib/xemacs/site-lisp)
+-  $B$G$9!#(B
+-
+-  emu $B%b%8%e!<%k(B (APEL $B%Q%C%1!<%8$KF~$C$F$$$^$9(B) $B$,I8=`$G$J$$%G%#%l%/(B
+-  $B%H%j!<$KF3F~$5$l$F$$$k>l9g$O!"$=$l$i$N$"$k>l=j$r;XDj$9$kI,MW(B
+-  $B$,$"$j$^$9!#Nc$($P!'(B
++  `LISPDIR=...' が省略されると、指定された emacs のコマンドの
++  site-lisp ディレクトリーが使われます (おそらく
++  /usr/local/share/emacs/site-lisp か /usr/local/lib/xemacs/site-lisp)
++  です。
++
++  emu モジュール (APEL パッケージに入っています) が標準でないディレク
++  トリーに導入されている場合は、それらのある場所を指定する必要
++  があります。例えば:
+ 
+     % make install VERSION_SPECIFIC_LISPDIR=~/elisp
+ 
+-  $B$I$N%U%!%$%k$,(B emu $B%b%8%e!<%k$+(B APEL $B%b%8%e!<%k$N0lIt$J$N$+!"$=$l$i(B
+-  $B$,$I$3$KF3F~$5$l$k$+$rCN$j$?$$$H$-$O!"<!$N$h$&$J%3%^%s%I$rF~(B
+-  $BNO$9$k$3$H$,$G$-$^$9!#(B
++  どのファイルが emu モジュールか APEL モジュールの一部なのか、それら
++  がどこに導入されるかを知りたいときは、次のようなコマンドを入
++  力することができます。
+ 
+     % make what-where LISPDIR=~/elisp VERSION_SPECIFIC_LISPDIR=~/elisp
+ 
+-  $B$^$?!"(BFLIM-CFG $B%U%!%$%k$rJT=8$9$k$3$H$GB>$NA*Br2DG=$J@_Dj$r;XDj$9$k(B
+-  $B$3$H$,$G$-$^$9!#$=$N>\:Y$K4X$7$F$O(B FLIM-CFG $B%U%!%$%k$NCm<a(B (comment) 
+-  $B$rFI$s$G$/$@$5$$!#(B
++  また、FLIM-CFG ファイルを編集することで他の選択可能な設定を指定する
++  ことができます。その詳細に関しては FLIM-CFG ファイルの注釈 (comment) 
++  を読んでください。
+ 
+-(1-c) XEmacs $B$N%Q%C%1!<%8$H$7$FF3F~$9$k(B
++(1-c) XEmacs のパッケージとして導入する
+ 
+-  XEmacs $B$N%Q%C%1!<%8!&%G%#%l%/%H%j!<$KF3F~$9$k>l9g$O!"(B
++  XEmacs のパッケージ・ディレクトリーに導入する場合は、
+ 
+ 	% make install-package
+ 
+-  $B$r<B9T$7$F$/$@$5$$!#(B
++  を実行してください。
+ 
+-  XEmacs $B$N%3%^%s%IL>$r;XDj$9$k$3$H$,$G$-$^$9!#Nc!'(B
++  XEmacs のコマンド名を指定することができます。例:
+ 
+ 	% make install-package XEMACS=xemacs-21
+ 
+-  `XEMACS=...' $B$,>JN,$5$l$k$H!"(BXEMACS=xemacs $B$,;HMQ$5$l$^$9!#(B
++  `XEMACS=...' が省略されると、XEMACS=xemacs が使用されます。
+ 
+-  $B%Q%C%1!<%8!&%G%#%l%/%H%j!<$r;XDj$9$k$3$H$,$G$-$^$9!#Nc!'(B
++  パッケージ・ディレクトリーを指定することができます。例:
+ 
+ 	% make install PACKAGEDIR=~/.xemacs
+ 
+-  `PACKAGEDIR=...' $B$,>JN,$5$l$k$H!"B8:_$9$k%Q%C%1!<%8!&%G%#%l%/%H%j!<(B
+-  $B$N:G=i$N$b$N$,;H$o$l$^$9!#(B
++  `PACKAGEDIR=...' が省略されると、存在するパッケージ・ディレクトリー
++  の最初のものが使われます。
+ 
+-  $B!NCm0U!O(BXEmacs $B$N%Q%C%1!<%8!&%7%9%F%`$O(B XEmacs 21.0 $B$+$=$l0J9_$,I,MW(B
+-	  $B$G$9!#(B
++  [注意]XEmacs のパッケージ・システムは XEmacs 21.0 かそれ以降が必要
++	  です。
+ 
+ 
+-$B%P%0Js9p(B
++バグ報告
+ ========
+ 
+-  $B%P%0Js9p$d2~A1$NDs0F$r=q$$$?$H$-$O!"@'Hs(B EMACS-MIME $B%a!<%j%s%0%j%9%H(B
+-  $B$KAw$C$F$/$@$5$$(B:
+-
+-	emacs-mime-en%m17n.org@localhost	($B1Q8l(B)
+-	emacs-mime-ja%m17n.org@localhost	($BF|K\8l(B)
++  バグ報告や改善の提案を書いたときは、是非 Emacs-MIME メーリングリスト
++  に送ってください:
+ 
+-  EMACS-MIME ML $B$rDL$7$F!"(BFLIM $B$N%P%0$rJs9p$7$?$j!"(BFLIM $B$N:G?7$N%j%j!<(B
+-  $B%9$r<hF@$7$?$j!"(BFLIM $B$N>-Mh$N3HD%$N5DO@$r$7$?$j$9$k$3$H$,$G$-$^$9!#(B
+-  EMACS-MIME ML $B$K;22C$9$k$K$O!"6u$NEE;R%a!<%k$r(B
++	emacs-mime-ja%lists.chise.org@localhost	(日本語)
++	emacs-mime-en%lists.chise.org@localhost	(英語)
+ 
+-	emacs-mime-en-ctl%m17n.org@localhost	($B1Q8l(B)
+-	emacs-mime-ja-ctl%m17n.org@localhost	($BF|K\8l(B)
++  Emacs-MIME ML を通して、FLIM のバグを報告したり、FLIM の最新のリリー
++  スを取得したり、FLIM の将来の拡張の議論をしたりすることができます。
++  Emacs-MIME ML に参加したい方は、以下の頁の記述を見て購読手続きを行っ
++  てください:
+ 
+-  $B$KAw$C$F$/$@$5$$!#(B
++      http://lists.chise.org/mailman/listinfo/emacs-mime-ja (日本語)
++      http://lists.chise.org/mailman/listinfo/emacs-mime-en (英語)
diff --git a/flim/patches/patch-eword-decode.el b/flim/patches/patch-eword-decode.el
new file mode 100644
index 0000000000..2f317ac09b
--- /dev/null
+++ b/flim/patches/patch-eword-decode.el
@@ -0,0 +1,620 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./eword-decode.el	2005-12-25 19:45:52.000000000 +0900
++++ ././eword-decode.el	2020-09-05 16:02:39.898948422 +0900
+@@ -1,4 +1,4 @@
+-;;; eword-decode.el --- RFC 2047 based encoded-word decoder for GNU Emacs
++;;; eword-decode.el --- RFC 2047 based encoded-word decoder for GNU Emacs  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004,
+ ;;   2005 Free Software Foundation, Inc.
+@@ -36,8 +36,7 @@
+ (require 'mime-def)
+ (require 'mel)
+ (require 'std11)
+-
+-(eval-when-compile (require 'cl))	; list*, pop
++(require 'cl-lib)
+ 
+ 
+ ;;; @ Variables
+@@ -70,8 +69,7 @@
+ 	      "\\("
+ 	      eword-encoded-text-regexp	; 4
+ 	      "\\)"
+-	      (regexp-quote "?="))))
+-  )
++	      (regexp-quote "?=")))))
+ 
+ 
+ ;;; @ for string
+@@ -87,7 +85,10 @@
+ 
+ If MUST-UNFOLD is non-nil, it unfolds and eliminates line-breaks even
+ if there are in decoded encoded-words (generated by bad manner MUA
+-such as a version of Net$cape)."
++such as a version of Net$cape).
++
++The language informations specified in the encoded words, if any, are
++put to the decoded text as the `mime-language' text property."
+   (setq string (std11-unfold-string string))
+   (let ((regexp (concat "[\n\t ]*\\(" eword-encoded-word-regexp "\\)"))
+ 	(next 0)
+@@ -98,7 +99,11 @@
+       (while match
+ 	(setq next (match-end 0))
+ 	(push (list (match-string 2 string) ;; charset
+-		    (match-string 3 string) ;; language
++		    (when (match-beginning 3) ;; language
++		      (intern
++		       (downcase
++			(substring string
++				   (1+ (match-beginning 3)) (match-end 3)))))
+ 		    (match-string 4 string) ;; encoding
+ 		    (match-string 5 string) ;; encoded-text
+ 		    (match-string 1 string)) ;; encoded-word
+@@ -112,23 +117,19 @@
+ 	    next (+ start (length words)))))
+   string)
+ 
+-(defun eword-decode-structured-field-body (string
+-					   &optional start-column max-column
+-					   start)
++(defun eword-decode-structured-field-body
++    (string &optional _start-column _max-column start)
+   (let ((tokens (eword-lexical-analyze string start 'must-unfold))
+-	(result "")
++	result
+ 	token)
+     (while tokens
+       (setq token (car tokens))
+-      (setq result (concat result (eword-decode-token token)))
++      (setq result (cons (eword-decode-token token) result))
+       (setq tokens (cdr tokens)))
+-    result))
++    (apply 'concat (nreverse result))))
+ 
+-(defun eword-decode-and-unfold-structured-field-body (string
+-						      &optional
+-						      start-column
+-						      max-column
+-						      start)
++(defun eword-decode-and-unfold-structured-field-body
++    (string &optional _start-column _max-column start)
+   "Decode and unfold STRING as structured field body.
+ It decodes non us-ascii characters in FULL-NAME encoded as
+ encoded-words or invalid \"raw\" string.  \"Raw\" non us-ascii
+@@ -137,17 +138,17 @@
+ If an encoded-word is broken or your emacs implementation can not
+ decode the charset included in it, it is not decoded."
+   (let ((tokens (eword-lexical-analyze string start 'must-unfold))
+-	(result ""))
++	result)
+     (while tokens
+       (let* ((token (car tokens))
+ 	     (type (car token)))
+ 	(setq tokens (cdr tokens))
+ 	(setq result
+-	      (if (eq type 'spaces)
+-		  (concat result " ")
+-		(concat result (eword-decode-token token))
+-		))))
+-    result))
++	      (cons (if (eq type 'spaces)
++			" "
++		      (eword-decode-token token))
++		    result))))
++    (apply 'concat (nreverse result))))
+ 
+ (defun eword-decode-and-fold-structured-field-body (string
+ 						    start-column
+@@ -160,7 +161,7 @@
+ 	(setq max-column fill-column))
+     (let ((c start-column)
+ 	  (tokens (eword-lexical-analyze string start 'must-unfold))
+-	  (result "")
++	  result
+ 	  token)
+       (while (and (setq token (car tokens))
+ 		  (setq tokens (cdr tokens)))
+@@ -171,38 +172,34 @@
+ 		     (next-len (string-width next-str))
+ 		     (next-c (+ c next-len 1)))
+ 		(if (< next-c max-column)
+-		    (setq result (concat result " " next-str)
++		    (setq result (cons next-str (cons " " result))
+ 			  c next-c)
+-		  (setq result (concat result "\n " next-str)
++		  (setq result (cons next-str (cons "\n " result))
+ 			c (1+ next-len)))
+-		(setq tokens (cdr tokens))
+-		)
++		(setq tokens (cdr tokens)))
+ 	    (let* ((str (eword-decode-token token)))
+-	      (setq result (concat result str)
+-		    c (+ c (string-width str)))
+-	      ))))
+-      (if token
+-	  (concat result (eword-decode-token token))
+-	result))))
++	      (setq result (cons str result)
++		    c (+ c (string-width str)))))))
++      (apply 'concat (nreverse
++		      (cons (when token (eword-decode-token token))
++			    result))))))
+ 
+-(defun eword-decode-unstructured-field-body (string &optional start-column
+-						    max-column)
++(defun eword-decode-unstructured-field-body
++    (string &optional _start-column _max-column)
+   (eword-decode-string
+-   (decode-mime-charset-string string default-mime-charset)))
++   (mime-charset-decode-string string default-mime-charset)))
+ 
+-(defun eword-decode-and-unfold-unstructured-field-body (string
+-							&optional start-column
+-							max-column)
++(defun eword-decode-and-unfold-unstructured-field-body
++    (string &optional _start-column _max-column)
+   (eword-decode-string
+-   (decode-mime-charset-string (std11-unfold-string string)
++   (mime-charset-decode-string (std11-unfold-string string)
+ 			       default-mime-charset)
+    'must-unfold))
+ 
+-(defun eword-decode-unfolded-unstructured-field-body (string
+-						      &optional start-column
+-						      max-column)
++(defun eword-decode-unfolded-unstructured-field-body
++    (string &optional _start-column _max-column)
+   (eword-decode-string
+-   (decode-mime-charset-string string default-mime-charset)
++   (mime-charset-decode-string string default-mime-charset)
+    'must-unfold))
+ 
+ 
+@@ -216,7 +213,10 @@
+ 
+ If MUST-UNFOLD is non-nil, it unfolds and eliminates line-breaks even
+ if there are in decoded encoded-words (generated by bad manner MUA
+-such as a version of Net$cape)."
++such as a version of Net$cape).
++
++The language informations specified in the encoded words, if any, are
++put to the decoded text as the `mime-language' text property."
+   (interactive "*r")
+   (save-excursion
+     (save-restriction
+@@ -232,7 +232,11 @@
+ 	  (while match
+ 	    (goto-char (setq end (match-end 0)))
+ 	    (push (list (match-string 2) ;; charset
+-			(match-string 3) ;; language
++			(when (match-beginning 3) ;; language
++			  (intern
++			   (downcase
++			    (buffer-substring (1+ (match-beginning 3))
++					      (match-end 3)))))
+ 			(match-string 4) ;; encoding
+ 			(match-string 5) ;; encoded-text
+ 			(match-string 1)) ;; encoded-word
+@@ -253,11 +257,8 @@
+           (save-restriction
+             (narrow-to-region (goto-char beg) end)
+             (while (re-search-forward "\n\\([ \t]\\)" nil t)
+-              (replace-match (match-string 1))
+-              )
+-	    (goto-char (point-max))
+-	    ))
+-      )))
++              (replace-match (match-string 1)))
++	    (goto-char (point-max)))))))
+ 
+ 
+ ;;; @ for message header
+@@ -286,16 +287,13 @@
+ 		  (setcdr cell (put-alist field function (cdr cell)))
+ 		(setq mime-field-decoder-alist
+ 		      (cons (cons mode (list (cons field function)))
+-			    mime-field-decoder-alist))
+-		))
+-	    (apply (function mime-set-field-decoder) field specs)
+-	    )
++			    mime-field-decoder-alist))))
++	    (apply (function mime-set-field-decoder) field specs))
+ 	(mime-set-field-decoder field
+ 				'plain function
+ 				'wide function
+ 				'summary function
+-				'nov function)
+-	))))
++				'nov function)))))
+ 
+ ;;;###autoload
+ (defmacro mime-find-field-presentation-method (name)
+@@ -303,20 +301,17 @@
+ NAME must be `plain', `wide', `summary' or `nov'."
+   (cond ((eq name nil)
+ 	 `(or (assq 'summary mime-field-decoder-cache)
+-	      '(summary))
+-	 )
++	      '(summary)))
+ 	((and (consp name)
+ 	      (car name)
+ 	      (consp (cdr name))
+ 	      (symbolp (car (cdr name)))
+ 	      (null (cdr (cdr name))))
+ 	 `(or (assq ,name mime-field-decoder-cache)
+-	      (cons ,name nil))
+-	 )
++	      (cons ,name nil)))
+ 	(t
+ 	 `(or (assq (or ,name 'summary) mime-field-decoder-cache)
+-	      (cons (or ,name 'summary) nil))
+-	 )))
++	      (cons (or ,name 'summary) nil)))))
+ 
+ (defun mime-find-field-decoder-internal (field &optional mode)
+   "Return function to decode field-body of FIELD in MODE.
+@@ -326,8 +321,7 @@
+ 	       (funcall mime-update-field-decoder-cache
+ 			field (car mode))
+ 	     (setcdr mode
+-		     (cdr (assq (car mode) mime-field-decoder-cache)))
+-	     ))))
++		     (cdr (assq (car mode) mime-field-decoder-cache)))))))
+ 
+ ;;;###autoload
+ (defun mime-find-field-decoder (field &optional mode)
+@@ -342,21 +336,18 @@
+ 	    (cdr p)
+ 	  (cdr (funcall mime-update-field-decoder-cache
+ 			field (or mode 'summary)))))
+-    (inline (mime-find-field-decoder-internal field mode))
+-    ))
++    (inline (mime-find-field-decoder-internal field mode))))
+ 
+ ;;;###autoload
+ (defun mime-update-field-decoder-cache (field mode &optional function)
+   "Update field decoder cache `mime-field-decoder-cache'."
+   (cond ((eq function 'identity)
+-	 (setq function nil)
+-	 )
++	 (setq function nil))
+ 	((null function)
+ 	 (let ((decoder-alist
+ 		(cdr (assq (or mode 'summary) mime-field-decoder-alist))))
+ 	   (setq function (cdr (or (assq field decoder-alist)
+-				   (assq t decoder-alist)))))
+-	 ))
++				   (assq t decoder-alist)))))))
+   (let ((cell (assq mode mime-field-decoder-cache))
+         ret)
+     (if cell
+@@ -407,8 +398,7 @@
+      'plain	#'eword-decode-structured-field-body
+      'wide	#'eword-decode-and-fold-structured-field-body
+      'summary	#'eword-decode-and-unfold-structured-field-body
+-     'nov	#'eword-decode-and-unfold-structured-field-body)
+-    ))
++     'nov	#'eword-decode-and-unfold-structured-field-body)))
+ 
+ ;; unstructured fields (default)
+ (mime-set-field-decoder
+@@ -442,8 +432,7 @@
+       ;; Don't decode
+       (if (eq mode 'summary)
+ 	  (std11-unfold-string field-body)
+-	field-body)
+-      )))
++	field-body))))
+ 
+ ;;;###autoload
+ (defun mime-decode-header-in-region (start end
+@@ -480,11 +469,8 @@
+ 		  (let ((body (buffer-substring p end))
+ 			(default-mime-charset default-charset))
+ 		    (delete-region p end)
+-		    (insert (funcall field-decoder body (1+ len)))
+-		    ))
+-		))
+-	  (eword-decode-region (point-min) (point-max) t)
+-	  )))))
++		    (insert (funcall field-decoder body (1+ len)))))))
++	  (eword-decode-region (point-min) (point-max) t))))))
+ 
+ ;;;###autoload
+ (defun mime-decode-header-in-buffer (&optional code-conversion separator)
+@@ -503,12 +489,12 @@
+ 	  (concat "^\\(" (regexp-quote (or separator "")) "\\)?$")
+ 	  nil t)
+ 	 (match-beginning 0)
+-       (point-max)
+-       ))
++       (point-max)))
+    code-conversion))
+ 
+ (defalias 'eword-decode-header 'mime-decode-header-in-buffer)
+-(make-obsolete 'eword-decode-header 'mime-decode-header-in-buffer)
++(make-obsolete 'eword-decode-header
++	       'mime-decode-header-in-buffer "28 Oct 1998")
+ 
+ 
+ ;;; @ encoded-words decoder
+@@ -554,39 +540,38 @@
+ 		  nil)))
+ 	  (if (and eword-decode-allow-incomplete-encoded-text
+ 		   rest
+-		   (caaar rest)
+-		   (string-equal (downcase charset) (downcase (caaar rest)))
+-		   (equal language (cdaar rest)))
++		   (cl-caaar rest)
++		   (string-equal (downcase charset) (downcase (cl-caaar rest)))
++		   (equal language (cl-cdaar rest)))
+ 	      ;; Concatenate text of which the charset is the same.
+ 	      (setcdr (car rest) (concat (cdar rest) text))
+ 	    (push (cons (cons charset language) text) rest))
+ 	;; Don't decode encoded-word.
+ 	(push (cons (cons nil language) (nth 4 word)) rest)))
+     (while rest
+-      (setq word (or (and (setq charset (caaar rest))
++      (setq word (or (and (setq charset (cl-caaar rest))
+ 			  (condition-case err
+-			      (decode-mime-charset-string (cdar rest) charset)
++			      (mime-charset-decode-string (cdar rest) charset)
+ 			    (error
+ 			     (message "%s" (error-message-string err))
+ 			     nil)))
+-		     (concat (when (cdr rest) " ")
+-			     (cdar rest)
+-			     (when (and words
+-					(not (eq (string-to-char words) ? )))
+-			       " "))))
++		     (concat
++		      (when (cdr rest) " ")
++		      (cdar rest)
++		      (when (and words
++				 (not (eq (string-to-char (car words)) ?\s)))
++			" "))))
+       (when must-unfold
+ 	(setq word (mapconcat (lambda (chr)
+-				(cond ((eq chr ?\n) "")
+-				      ((eq chr ?\r) "")
++				(cond ((memq chr '(?\n ?\r)) nil)
+ 				      ((eq chr ?\t) " ")
+-				      (t (char-to-string chr))))
+-			      (std11-unfold-string word)
+-			      "")))
+-      (when (setq language (cdaar rest))
++				      (t (list chr))))
++			      (std11-unfold-string word) nil)))
++      (when (setq language (cl-cdaar rest))
+ 	(put-text-property 0 (length word) 'mime-language language word))
+-      (setq words (concat word words)
+-	    rest (cdr rest)))
+-    words))
++      (when (> (length word) 0) (setq words (cons word words)))
++      (setq rest (cdr rest)))
++    (apply 'concat words)))
+ 
+ ;;; @ lexical analyze
+ ;;;
+@@ -618,11 +603,11 @@
+ returns nil, next function is used.  Otherwise the return value will
+ be the result.")
+ 
+-(defun eword-analyze-quoted-string (string start &optional must-unfold)
++(defun eword-analyze-quoted-string (string start &optional _must-unfold)
+   (let ((p (std11-check-enclosure string ?\" ?\" nil start))
+ 	ret)
+     (when p
+-      (setq ret (decode-mime-charset-string
++      (setq ret (mime-charset-decode-string
+ 		 (std11-strip-quoted-pair
+ 		  (substring string (1+ start) (1- p)))
+ 		 default-mime-charset))
+@@ -631,7 +616,7 @@
+       (cons (cons 'quoted-string ret)
+ 	    p))))
+ 
+-(defun eword-analyze-domain-literal (string start &optional must-unfold)
++(defun eword-analyze-domain-literal (string start &optional _must-unfold)
+   (std11-analyze-domain-literal string start))
+ 
+ (defun eword-analyze-comment (string from &optional must-unfold)
+@@ -649,17 +634,16 @@
+ 	  (cond ((eq chr ?\\)
+ 		 (setq i (1+ i))
+ 		 (if (>= i len)
+-		     (throw 'tag nil)
+-		   )
+-		 (setq last-str (concat last-str
+-					(substring string from (1- i))
+-					(char-to-string (aref string i)))
++		     (throw 'tag nil))
++		 (setq last-str (cons (list (aref string i))
++				      (cons (substring string from (1- i))
++					    last-str))
+ 		       i (1+ i)
+-		       from i)
+-		 )
++		       from i))
+ 		((eq chr ?\))
+-		 (setq ret (concat last-str
+-				   (substring string from i)))
++		 (setq ret
++		       (apply 'concat
++			      (substring string from i) (nreverse last-str)))
+ 		 (throw 'tag (cons
+ 			      (cons 'comment
+ 				    (nreverse
+@@ -667,42 +651,36 @@
+ 					 dest
+ 				       (cons
+ 					(eword-decode-string
+-					 (decode-mime-charset-string
++					 (mime-charset-decode-string
+ 					  ret default-mime-charset)
+ 					 must-unfold)
+-					dest)
+-				       )))
+-			      (1+ i)))
+-		 )
++					dest))))
++			      (1+ i))))
+ 		((eq chr ?\()
+ 		 (if (setq ret (eword-analyze-comment string i must-unfold))
+ 		     (setq last-str
+-			   (concat last-str
+-				   (substring string from i))
++			   (apply 'concat (substring string from i)
++				  (nreverse last-str))
+ 			   dest
+ 			   (if (string= last-str "")
+ 			       (cons (car ret) dest)
+-			     (list* (car ret)
++			     (cl-list* (car ret)
+ 				    (eword-decode-string
+-				     (decode-mime-charset-string
++				     (mime-charset-decode-string
+ 				      last-str default-mime-charset)
+ 				     must-unfold)
+-				    dest)
+-			     )
++				    dest))
+ 			   i (cdr ret)
+ 			   from i
+-			   last-str "")
+-		   (throw 'tag nil)
+-		   ))
++			   last-str nil)
++		   (throw 'tag nil)))
+ 		(t
+-		 (setq i (1+ i))
+-		 ))
+-	  )))))
++		 (setq i (1+ i)))))))))
+ 
+-(defun eword-analyze-spaces (string start &optional must-unfold)
++(defun eword-analyze-spaces (string start &optional _must-unfold)
+   (std11-analyze-spaces string start))
+ 
+-(defun eword-analyze-special (string start &optional must-unfold)
++(defun eword-analyze-special (string start &optional _must-unfold)
+   (std11-analyze-special string start))
+ 
+ (defun eword-analyze-encoded-word (string start &optional must-unfold)
+@@ -713,7 +691,11 @@
+     (while match
+       (setq next (match-end 0))
+       (push (list (match-string 2 string) ;; charset
+-		  (match-string 3 string) ;; language
++		  (when (match-beginning 3) ;; language
++		    (intern
++		     (downcase
++		      (substring string
++				 (1+ (match-beginning 3)) (match-end 3)))))
+ 		  (match-string 4 string) ;; encoding
+ 		  (match-string 5 string) ;; encoded-text
+ 		  (match-string 1 string)) ;; encoded-word
+@@ -721,20 +703,29 @@
+       (setq match (and (string-match regexp string next)
+ 		       (= next (match-beginning 0)))))
+     (when words
+-      (cons (cons 'atom (eword-decode-encoded-words (nreverse words)
+-						    must-unfold))
+-	    next))))
++      (setq words (eword-decode-encoded-words (nreverse words) must-unfold))
++      (cons
++       (cons 'atom
++	     (if (and (string-match (eval-when-compile
++				      (concat "[" std11-special-char-list "]"))
++				    words)
++		      (null (eq (cdr (std11-analyze-quoted-string words 0))
++				(length words))))
++		 ;; Docoded words contains non-atom special chars and are
++		 ;; not quoted.
++		 (std11-wrap-as-quoted-string words)
++	       words))
++       next))))
+ 
+-(defun eword-analyze-atom (string start &optional must-unfold)
++(defun eword-analyze-atom (string start &optional _must-unfold)
+   (if (and (string-match std11-atom-regexp string start)
+ 	   (= (match-beginning 0) start))
+       (let ((end (match-end 0)))
+-	(cons (cons 'atom (decode-mime-charset-string
++	(cons (cons 'atom (mime-charset-decode-string
+ 			   (substring string start end)
+ 			   default-mime-charset))
+ 	      ;;(substring string end)
+-	      end)
+-	)))
++	      end))))
+ 
+ (defun eword-lexical-analyze-internal (string start must-unfold)
+   (let ((len (length string))
+@@ -745,17 +736,13 @@
+ 		  func r)
+ 	      (while (and (setq func (car rest))
+ 			  (null
+-			   (setq r (funcall func string start must-unfold)))
+-			  )
++			   (setq r (funcall func string start must-unfold))))
+ 		(setq rest (cdr rest)))
+ 	      (or r
+-		  (cons (cons 'error (substring string start)) (1+ len)))
+-	      ))
++		  (cons (cons 'error (substring string start)) (1+ len)))))
+       (setq dest (cons (car ret) dest)
+-	    start (cdr ret))
+-      )
+-    (nreverse dest)
+-    ))
++	    start (cdr ret)))
++    (nreverse dest)))
+ 
+ (defun eword-lexical-analyze (string &optional start must-unfold)
+   "Return lexical analyzed list corresponding STRING.
+@@ -783,18 +770,15 @@
+     (cond ((eq type 'quoted-string)
+ 	   (std11-wrap-as-quoted-string value))
+ 	  ((eq type 'comment)
+-	   (let ((dest ""))
++	   (let (dest)
+ 	     (while value
+-	       (setq dest (concat dest
+-				  (if (stringp (car value))
+-				      (std11-wrap-as-quoted-pairs
+-				       (car value) '(?( ?)))
+-				    (eword-decode-token (car value))
+-				    ))
+-		     value (cdr value))
+-	       )
+-	     (concat "(" dest ")")
+-	     ))
++	       (setq dest (cons (if (stringp (car value))
++				    (std11-wrap-as-quoted-pairs
++				     (car value) '(?\( ?\)))
++				  (eword-decode-token (car value)))
++				dest)
++		     value (cdr value)))
++	     (apply 'concat "(" (nreverse (cons ")" dest)))))
+ 	  (t value))))
+ 
+ (defun eword-extract-address-components (string &optional start)
+@@ -809,10 +793,8 @@
+ 			   (std11-unfold-string string) start
+ 			   'must-unfold))))
+          (phrase  (std11-full-name-string structure))
+-         (address (std11-address-string structure))
+-         )
+-    (list phrase address)
+-    ))
++         (address (std11-address-string structure)))
++    (list phrase address)))
+ 
+ 
+ ;;; @ end
diff --git a/flim/patches/patch-eword-encode.el b/flim/patches/patch-eword-encode.el
new file mode 100644
index 0000000000..5f47351119
--- /dev/null
+++ b/flim/patches/patch-eword-encode.el
@@ -0,0 +1,691 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./eword-encode.el	2007-09-06 16:48:50.000000000 +0900
++++ ././eword-encode.el	2020-09-05 16:02:39.899126931 +0900
+@@ -1,4 +1,4 @@
+-;;; eword-encode.el --- RFC 2047 based encoded-word encoder for GNU Emacs
++;;; eword-encode.el --- RFC 2047 based encoded-word encoder for GNU Emacs  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995,1996,1997,1998,1999,2000,2002,2003,2004 Free
+ ;;   Software Foundation, Inc.
+@@ -30,7 +30,6 @@
+ (require 'std11)
+ (require 'eword-decode)
+ 
+-
+ ;;; @ variables
+ ;;;
+ 
+@@ -59,8 +58,7 @@
+     (tis-620		. "B")
+     (iso-2022-jp-2	. "B")
+     (iso-2022-int-1	. "B")
+-    (utf-8		. "B")
+-    ))
++    (utf-8		. "B")))
+ 
+ (defvar mime-header-default-charset-encoding "Q")
+ 
+@@ -74,6 +72,8 @@
+ 	Dcc))
+     (eword-encode-in-reply-to . (In-Reply-To))
+     (eword-encode-structured-field-body . (Mime-Version User-Agent))
++    (eword-encode-Content-Disposition-field-body . (Content-Disposition))
++    (eword-encode-Content-Type-field-body . (Content-Type))
+     (eword-encode-unstructured-field-body)))
+ 
+ ;;; @ encoded-text encoder
+@@ -88,126 +88,75 @@
+   (let ((text (encoded-text-encode-string string encoding mode)))
+     (if text
+ 	(concat "=?" (upcase (symbol-name charset)) "?"
+-		encoding "?" text "?=")
+-      )))
++		encoding "?" text "?="))))
+ 
+ 
+ ;;; @ charset word
+ ;;;
+ 
+-(defsubst eword-encode-char-type (character)
+-  (if (memq character '(?  ?\t ?\n))
+-      nil
+-    (char-charset character)
+-    ))
+-
+-(defun eword-encode-divide-into-charset-words (string)
+-  (let ((len (length string))
+-	dest)
+-    (while (> len 0)
+-      (let* ((chr (aref string 0))
+-             ;; (chr (sref string 0))
+-	     (charset (eword-encode-char-type chr))
+-             (i 1)
+-	     ;; (i (char-length chr))
+-	     )
+-	(while (and (< i len)
+-		    (setq chr (aref string i))
+-                    ;; (setq chr (sref string i))
+-		    (eq charset (eword-encode-char-type chr)))
+-	  (setq i (1+ i))
+-          ;; (setq i (char-next-index chr i))
+-	  )
+-	(setq dest (cons (cons charset (substring string 0 i)) dest)
+-	      string (substring string i)
+-	      len (- len i))))
+-    (nreverse dest)))
+-
+ 
+ ;;; @ word
+ ;;;
+ 
+-(defun eword-encode-charset-words-to-words (charset-words)
+-  (let (dest)
+-    (while charset-words
+-      (let* ((charset-word (car charset-words))
+-	     (charset (car charset-word))
+-	     )
+-	(if charset
+-	    (let ((charsets (list charset))
+-		  (str (cdr charset-word))
+-		  )
+-	      (catch 'tag
+-		(while (setq charset-words (cdr charset-words))
+-		  (setq charset-word (car charset-words)
+-			charset (car charset-word))
+-		  (if (null charset)
+-		      (throw 'tag nil)
+-		    )
+-		  (or (memq charset charsets)
+-		      (setq charsets (cons charset charsets))
+-		      )
+-		  (setq str (concat str (cdr charset-word)))
+-		  ))
+-	      (setq dest (cons (cons charsets str) dest))
+-	      )
+-	  (setq dest (cons charset-word dest)
+-		charset-words (cdr charset-words)
+-		))))
+-    (nreverse dest)
+-    ))
+-
+ 
+ ;;; @ rule
+ ;;;
+ 
+ (defmacro make-ew-rword (text charset encoding type)
+-  (` (list (, text)(, charset)(, encoding)(, type))))
++  `(list ,text ,charset ,encoding ,type))
+ (defmacro ew-rword-text (rword)
+-  (` (car (, rword))))
++  `(car ,rword))
+ (defmacro ew-rword-charset (rword)
+-  (` (car (cdr (, rword)))))
++  `(car (cdr ,rword)))
+ (defmacro ew-rword-encoding (rword)
+-  (` (car (cdr (cdr (, rword))))))
++  `(car (cdr (cdr ,rword))))
+ (defmacro ew-rword-type (rword)
+-  (` (car (cdr (cdr (cdr (, rword)))))))
++  `(car (cdr (cdr (cdr ,rword)))))
+ 
++(unless (and (boundp 'mule-version)
++	     (null (string< mule-version "6.0"))
++	     (fboundp 'detect-mime-charset-string))
+ (defun ew-find-charset-rule (charsets)
+   (if charsets
+       (let* ((charset (find-mime-charset-by-charsets charsets))
+ 	     (encoding
+ 	      (cdr (or (assq charset mime-header-charset-encoding-alist)
+ 		       (cons charset mime-header-default-charset-encoding)))))
+-	(list charset encoding))))
++	(list charset encoding)))))
++
++(defun ew-find-string-rule (string)
++  (let ((charset (detect-mime-charset-string string)))
++    (list charset
++	  (cdr (or (assq charset mime-header-charset-encoding-alist)
++		   (cons nil mime-header-default-charset-encoding))))))
+ 
+-;; [tomo:2002-11-05] The following code is a quick-fix for emacsen
+-;; which is not depended on the Mule model.  We should redesign
+-;; `eword-encode-split-string' to avoid to depend on the Mule model.
+-(if (featurep 'utf-2000)
+-;; for CHISE Architecture
+-(defun tm-eword::words-to-ruled-words (wl &optional mode)
+-  (let (mcs)
+-    (mapcar (function
+-	     (lambda (word)
+-	       (setq mcs (detect-mime-charset-string (cdr word)))
+-	       (make-ew-rword
+-		(cdr word)
+-		mcs
+-		(cdr (or (assq mcs mime-header-charset-encoding-alist)
+-			 (cons mcs mime-header-default-charset-encoding)))
+-		mode)
+-	       ))
+-	    wl)))
+-
+-;; for legacy Mule
+-(defun tm-eword::words-to-ruled-words (wl &optional mode)
+-  (mapcar (function
+-	   (lambda (word)
+-	     (let ((ret (ew-find-charset-rule (car word))))
+-	       (make-ew-rword (cdr word) (car ret)(nth 1 ret) mode)
+-	       )))
+-	  wl))
+-)
++(defun tm-eword::string-to-ruled-words (string &optional mode)
++  (let ((len (length string))
++	(beg 0)
++	(i 1)
++	spacep dest mcs)
++    (when (> len 0)
++      (mapcar
++       (lambda (elt)
++	 (if (cdr elt)
++	     (make-ew-rword (car elt) nil nil mode)
++	   (setq mcs (detect-mime-charset-string (car elt)))
++	   (make-ew-rword
++	    (car elt)
++	    mcs
++	    (cdr (or (assq mcs mime-header-charset-encoding-alist)
++		     (cons nil mime-header-default-charset-encoding)))
++	    mode)))
++       (progn
++	 (setq spacep (memq (aref string 0) '(?\s ?\t ?\n)))
++	 (while (< i len)
++	   (unless (eq spacep (memq (aref string i) '(?\s ?\t ?\n)))
++	     (setq dest (cons (cons (substring string beg i) spacep) dest))
++	     (setq beg i)
++	     (setq spacep (null spacep)))
++	   (setq i (1+ i)))
++	 (nreverse
++	  (cons (cons (substring string beg len) spacep) dest)))))))
+ 
+ (defun ew-space-process (seq)
+   (let (prev a ac b c cc)
+@@ -227,30 +176,19 @@
+ 		       (setq prev (cons
+ 				   (cons (concat (car a)(car b)(car c))
+ 					 (cdr a))
+-				   (cdr prev)
+-				   ))
+-		       (setq seq (cdr seq))
+-		       )
++				   (cdr prev)))
++		       (setq seq (cdr seq)))
+ 		      (t
+ 		       (setq prev (cons
+ 				   (cons (concat (car a)(car b))
+ 					 (cdr a))
+-				   (cdr prev)
+-				   ))
+-		       ))
+-	      (setq prev (cons b prev))
+-	      ))
+-	(setq prev (cons b prev))
+-	))
+-    (reverse prev)
+-    ))
++				   (cdr prev)))))
++	      (setq prev (cons b prev))))
++	(setq prev (cons b prev))))
++    (reverse prev)))
+ 
+ (defun eword-encode-split-string (str &optional mode)
+-  (ew-space-process
+-   (tm-eword::words-to-ruled-words
+-    (eword-encode-charset-words-to-words
+-     (eword-encode-divide-into-charset-words str))
+-    mode)))
++  (ew-space-process (tm-eword::string-to-ruled-words str mode)))
+ 
+ 
+ ;;; @ length
+@@ -263,16 +201,13 @@
+ 	ret)
+     (setq ret
+ 	  (cond ((string-equal encoding "B")
+-		 (setq string (encode-mime-charset-string string charset))
+-		 (base64-encoded-length string)
+-		 )
++		 (setq string (mime-charset-encode-string string charset))
++		 (base64-encoded-length string))
+ 		((string-equal encoding "Q")
+-		 (setq string (encode-mime-charset-string string charset))
+-		 (Q-encoded-text-length string (ew-rword-type rword))
+-		 )))
++		 (setq string (mime-charset-encode-string string charset))
++		 (Q-encoded-text-length string (ew-rword-type rword)))))
+     (if ret
+-	(cons (+ 7 (length (symbol-name charset)) ret) string)
+-      )))
++	(cons (+ 7 (length (symbol-name charset)) ret) string))))
+ 
+ 
+ ;;; @ encode-string
+@@ -286,35 +221,27 @@
+       (if (null ret)
+ 	  (cond ((and (setq string (car rword))
+ 		      (or (<= (setq len (+ (length string) column)) 76)
+-			  (<= column 1))
+-		      )
+-		 (setq rwl (cdr rwl))
+-		 )
+-		((memq (aref string 0) '(?  ?\t))
++			  (<= column 1)))
++		 (setq rwl (cdr rwl)))
++		((memq (aref string 0) '(?\s ?\t))
+ 		 (setq string (concat "\n" string)
+ 		       len (length string)
+-		       rwl (cdr rwl))
+-		 )
++		       rwl (cdr rwl)))
+ 		(must-output
+ 		 (setq string "\n "
+-		       len 1)
+-		 )
++		       len 1))
+ 		(t
+-		 (throw 'can-not-output nil)
+-		 ))
++		 (throw 'can-not-output nil)))
+ 	(cond ((and (setq len (car ret))
+-		    (<= (+ column len) 76)
+-		    )
++		    (<= (+ column len) 76))
+ 	       (setq string
+ 		     (eword-encode-text
+ 		      (ew-rword-charset rword)
+ 		      (ew-rword-encoding rword)
+ 		      (cdr ret)
+-		      (ew-rword-type rword)
+-		      ))
++		      (ew-rword-type rword)))
+ 	       (setq len (+ (length string) column))
+-	       (setq rwl (cdr rwl))
+-	       )
++	       (setq rwl (cdr rwl)))
+ 	      (t
+ 	       (setq string (car rword))
+ 	       (let* ((p 0) np
+@@ -325,12 +252,10 @@
+ 			       ;;(setq np (char-next-index (sref string p) p))
+ 			       (setq nstr (substring string 0 np))
+ 			       (setq ret (tm-eword::encoded-word-length
+-					  (cons nstr (cdr rword))
+-					  ))
++					  (cons nstr (cdr rword))))
+ 			       (setq nstr (cdr ret))
+ 			       (setq len (+ (car ret) column))
+-			       (<= len 76)
+-			       ))
++			       (<= len 76)))
+ 		   (setq str nstr
+ 			 p np))
+ 		 (if (string-equal str "")
+@@ -346,12 +271,8 @@
+ 			  (ew-rword-encoding rword)
+ 			  str
+ 			  (ew-rword-type rword)))
+-		   (setq len (+ (length string) column))
+-		   )
+-		 )))
+-	)
+-      (list string len rwl)
+-      )))
++		   (setq len (+ (length string) column)))))))
++      (list string len rwl))))
+ 
+ (defun eword-encode-rword-list (column rwl)
+   (let (ret dest str ew-f pew-f folded-points)
+@@ -360,23 +281,20 @@
+       (if (and pew-f ew-f)
+ 	  (setq rwl (cons '(" ") rwl)
+ 		pew-f nil)
+-	(setq pew-f ew-f)
+-	)
++	(setq pew-f ew-f))
+       (if (null (setq ret (ew-encode-rword-1 column rwl)))
+ 	  (let ((i (1- (length dest)))
+ 		c s r-dest r-column)
+ 	    (catch 'success
+ 	      (while (catch 'found
+ 		       (while (>= i 0)
+-			 (cond ((memq (setq c (aref dest i)) '(?  ?\t))
++			 (cond ((memq (setq c (aref dest i)) '(?\s ?\t))
+ 				(if (memq i folded-points)
+ 				    (throw 'found nil)
+ 				  (setq folded-points (cons i folded-points))
+-				  (throw 'found i))
+-				)
++				  (throw 'found i)))
+ 			       ((eq c ?\n)
+-				(throw 'found nil)
+-				))
++				(throw 'found nil)))
+ 			 (setq i (1- i))))
+ 		(setq s (substring dest i)
+ 		      r-column (length s)
+@@ -384,17 +302,13 @@
+ 		(when (setq ret (ew-encode-rword-1 r-column rwl))
+ 		  (setq dest r-dest
+ 			column r-column)
+-		  (throw 'success t)
+-		  ))
+-	      (setq ret (ew-encode-rword-1 column rwl 'must-output))
+-	      )))
++		  (throw 'success t)))
++	      (setq ret (ew-encode-rword-1 column rwl 'must-output)))))
+       (setq str (car ret))
+       (setq dest (concat dest str))
+       (setq column (nth 1 ret)
+-	    rwl (nth 2 ret))
+-      )
+-    (list dest column)
+-    ))
++	    rwl (nth 2 ret)))
++    (list dest column)))
+ 
+ 
+ ;;; @ converter
+@@ -410,65 +324,44 @@
+ 	     (setq dest
+ 		   (append dest
+ 			   (list
+-			    (let ((ret (ew-find-charset-rule
+-					(find-charset-string str))))
++			    (let ((ret (ew-find-string-rule str)))
+ 			      (make-ew-rword
+-			       str (car ret)(nth 1 ret) 'phrase)
+-			      )
+-			    )))
+-	     )
++			       str (car ret)(nth 1 ret) 'phrase))))))
+ 	    ((eq type 'comment)
+ 	     (setq dest
+ 		   (append dest
+ 			   '(("(" nil nil special))
+-			   (tm-eword::words-to-ruled-words
+-			    (eword-encode-charset-words-to-words
+-			     (eword-encode-divide-into-charset-words
+-			      (cdr token)))
+-			    'comment)
+-			   '((")" nil nil special))
+-			   ))
+-	     )
++			   (tm-eword::string-to-ruled-words
++			    (cdr token) 'comment)
++			   '((")" nil nil special)))))
+ 	    (t
+ 	     (setq dest
+ 		   (append dest
+-			   (tm-eword::words-to-ruled-words
+-			    (eword-encode-charset-words-to-words
+-			     (eword-encode-divide-into-charset-words
+-			      (cdr token))
+-			     ) 'phrase)))
+-	     ))
+-      (setq phrase (cdr phrase))
+-      )
+-    (ew-space-process dest)
+-    ))
++			   (tm-eword::string-to-ruled-words
++			    (cdr token) 'phrase)))))
++      (setq phrase (cdr phrase)))
++    (ew-space-process dest)))
+ 
+ (defun eword-encode-addr-seq-to-rword-list (seq)
+   (let (dest pname)
+     (while seq
+       (let* ((token (car seq))
+-	     (name (car token))
+-	     )
++	     (name (car token)))
+ 	(cond ((eq name 'spaces)
+-	       (setq dest (nconc dest (list (list (cdr token) nil nil))))
+-	       )
++	       (setq dest (nconc dest (list (list (cdr token) nil nil)))))
+ 	      ((eq name 'comment)
+ 	       (setq dest
+ 		     (nconc
+ 		      dest
+ 		      (list (list "(" nil nil))
+ 		      (eword-encode-split-string (cdr token) 'comment)
+-		      (list (list ")" nil nil))
+-		      ))
+-	       )
++		      (list (list ")" nil nil)))))
+ 	      ((eq name 'quoted-string)
+ 	       (setq dest
+ 		     (nconc
+ 		      dest
+ 		      (list
+-		       (list (concat "\"" (cdr token) "\"") nil nil)
+-		       )))
+-	       )
++		       (list (concat "\"" (cdr token) "\"") nil nil)))))
+ 	      (t
+ 	       (setq dest
+ 		     (if (or (eq pname 'spaces)
+@@ -479,11 +372,9 @@
+ 			      (list
+ 			       (list (concat (car (car (last dest)))
+ 					     (cdr token))
+-				     nil nil)))))
+-	       ))
++				     nil nil)))))))
+ 	(setq seq (cdr seq)
+-	      pname name))
+-      )
++	      pname name)))
+     dest))
+ 
+ (defun eword-encode-phrase-route-addr-to-rword-list (phrase-route-addr)
+@@ -496,36 +387,31 @@
+         ;;   )
+ 	(setq dest (eword-encode-phrase-to-rword-list phrase))
+ 	(if dest
+-	    (setq dest (append dest '((" " nil nil))))
+-	  )
++	    (setq dest (append dest '((" " nil nil)))))
+ 	(append
+ 	 dest
+ 	 (eword-encode-addr-seq-to-rword-list
+ 	  (append '((specials . "<"))
+ 		  route
+-		  '((specials . ">"))))
+-	 ))))
++		  '((specials . ">"))))))))
+ 
+ (defun eword-encode-addr-spec-to-rword-list (addr-spec)
+   (if (eq (car addr-spec) 'addr-spec)
+-      (eword-encode-addr-seq-to-rword-list (cdr addr-spec))
+-    ))
++      (eword-encode-addr-seq-to-rword-list (cdr addr-spec))))
+ 
+ (defun eword-encode-mailbox-to-rword-list (mbox)
+   (let ((addr (nth 1 mbox))
+ 	(comment (nth 2 mbox))
+ 	dest)
+     (setq dest (or (eword-encode-phrase-route-addr-to-rword-list addr)
+-		   (eword-encode-addr-spec-to-rword-list addr)
+-		   ))
++		   (eword-encode-addr-spec-to-rword-list addr)))
+     (if comment
+ 	(setq dest
+ 	      (append dest
+ 		      '((" " nil nil)
+ 			("(" nil nil))
+ 		      (eword-encode-split-string comment 'comment)
+-		      (list '(")" nil nil))
+-		      )))
++		      (list '(")" nil nil)))))
+     dest))
+ 
+ (defsubst eword-encode-mailboxes-to-rword-list (mboxes)
+@@ -577,8 +463,7 @@
+ 		    (let ((elt (car in-reply-to)))
+ 		      (if (eq (car elt) 'phrase)
+ 			  (eword-encode-phrase-to-rword-list (cdr elt))
+-			(eword-encode-msg-id-to-rword-list elt)
+-			))))
++			(eword-encode-msg-id-to-rword-list elt)))))
+       (setq in-reply-to (cdr in-reply-to)))
+     dest))
+ 
+@@ -586,6 +471,9 @@
+ ;;; @ application interfaces
+ ;;;
+ 
++(provide 'eword-encode)
++(require 'mime-parse)
++
+ (defvar eword-encode-default-start-column 10
+   "Default start column if it is omitted.")
+ 
+@@ -604,8 +492,7 @@
+   (car (eword-encode-rword-list
+ 	(or column eword-encode-default-start-column)
+ 	(eword-encode-addresses-to-rword-list
+-	 (std11-parse-addresses-string string))
+-	)))
++	 (std11-parse-addresses-string string)))))
+ 
+ (defun eword-encode-in-reply-to (string &optional column)
+   "Encode header field STRING as In-Reply-To field, and return the result.
+@@ -620,8 +507,7 @@
+ Optional argument COLUMN is start-position of the field."
+   (car (eword-encode-rword-list
+ 	(or column eword-encode-default-start-column)
+-	(eword-encode-addr-seq-to-rword-list (std11-lexical-analyze string))
+-	)))
++	(eword-encode-addr-seq-to-rword-list (std11-lexical-analyze string)))))
+ 
+ (defun eword-encode-unstructured-field-body (string &optional column)
+   "Encode header field STRING as unstructured field, and return the result.
+@@ -630,6 +516,81 @@
+ 	(or column eword-encode-default-start-column)
+ 	(eword-encode-split-string string 'text))))
+ 
++(defun eword-encode-Content-Type-field-body (field-body &optional _column)
++  "Encode FIELD-BODY with MIME Parameter-Value Extensions, if necessary.
++Optional second arg COLUMN is ignored."
++  (let ((tokens (mime-lexical-analyze field-body))
++	primary-type)
++    (unless (eq (car (car tokens)) 'mime-token)
++      (error "Invalid Content-Type value: %s" field-body))
++    (setq primary-type (downcase (cdr (car tokens)))
++	  tokens (cdr tokens))
++    (unless (and (eq (car (car tokens)) 'tspecials)
++		 (string= (cdr (car tokens)) "/")
++		 (setq tokens (cdr tokens))
++		 (eq (car (car tokens)) 'mime-token))
++      (error "Invalid Content-Type value: %s" field-body))
++    (concat " " primary-type "/" (downcase (cdr (car tokens)))
++            (mapconcat
++             (lambda (param)
++               (concat ";\n " (car param) "=" (cdr param)))
++             (mime-encode-parameters
++	      (mime-parse-parameters (cdr tokens)))
++             ""))))
++
++(defun eword-encode-Content-Disposition-field-body
++    (field-body &optional _column)
++  "Encode FIELD-BODY with MIME Parameter-Value Extensions, if necessary.
++Optional second arg COLUMN is ignored."
++  (let ((tokens (mime-lexical-analyze field-body)))
++    (unless (eq (car (car tokens)) 'mime-token)
++      (error "Invalid Content-Disposition value: %s" field-body))
++    (concat " " (cdr (car tokens))
++            (mapconcat
++             (lambda (param)
++               (concat ";\n " (car param) "=" (cdr param)))
++             (mime-encode-parameters
++	      (mime-parse-parameters (cdr tokens)))
++             ""))))
++
++(defun eword-encode-Content-Type-field-body-broken-mime
++  (field-body &optional _column)
++  "Encode FIELD-BODY compatibly with Outlook, if necessary.
++Optional second arg COLUMN is ignored."
++  (let ((tokens (mime-lexical-analyze field-body))
++	primary-type)
++    (unless (eq (car (car tokens)) 'mime-token)
++      (error "Invalid Content-Type value: %s" field-body))
++    (setq primary-type (downcase (cdr (car tokens)))
++	  tokens (cdr tokens))
++    (unless (and (eq (car (car tokens)) 'tspecials)
++		 (string= (cdr (car tokens)) "/")
++		 (setq tokens (cdr tokens))
++		 (eq (car (car tokens)) 'mime-token))
++      (error "Invalid Content-Type value: %s" field-body))
++    (concat " " primary-type "/" (downcase (cdr (car tokens)))
++            (mapconcat
++             (lambda (param)
++               (concat ";\n " (car param) "=\"" (cdr param) "\""))
++             (mime-encode-parameters-broken-mime
++	      (mime-parse-parameters (cdr tokens)))
++             ""))))
++
++(defun eword-encode-Content-Disposition-field-body-broken-mime
++  (field-body &optional _column)
++  "Encode FIELD-BODY compatibly with Outlook, if necessary.
++Optional second arg COLUMN is ignored."
++  (let ((tokens (mime-lexical-analyze field-body)))
++    (unless (eq (car (car tokens)) 'mime-token)
++      (error "Invalid Content-Disposition value: %s" field-body))
++    (concat " " (cdr (car tokens))
++            (mapconcat
++             (lambda (param)
++               (concat ";\n " (car param) "=\"" (cdr param) "\""))
++             (mime-encode-parameters-broken-mime
++	      (mime-parse-parameters (cdr tokens)))
++             ""))))
++
+ ;;;###autoload
+ (defun mime-encode-field-body (field-body field-name)
+   "Encode FIELD-BODY as FIELD-NAME, and return the result.
+@@ -655,13 +616,13 @@
+ 	(setq method-alist (cdr method-alist)))
+       ret)))
+ (defalias 'eword-encode-field-body 'mime-encode-field-body)
+-(make-obsolete 'eword-encode-field-body 'mime-encode-field-body)
++(make-obsolete 'eword-encode-field-body 'mime-encode-field-body "19 Dec 2000")
+ 
+ (defun eword-in-subject-p ()
+   (let ((str (std11-field-body "Subject")))
+     (if (and str (string-match eword-encoded-word-regexp str))
+ 	str)))
+-(make-obsolete 'eword-in-subject-p "Don't use it.")
++(make-obsolete 'eword-in-subject-p "Don't use it." "19 Dec 2000")
+ 
+ (defsubst eword-find-field-encoding-method (field-name)
+   (setq field-name (downcase field-name))
+@@ -672,11 +633,9 @@
+ 	       (str (car pair)))
+ 	  (if (and (stringp str)
+ 		   (string= field-name (downcase str)))
+-	      (throw 'found (cdr pair))
+-	    ))
++	      (throw 'found (cdr pair))))
+ 	(setq alist (cdr alist)))
+-      (cdr (assq t mime-field-encoding-method-alist))
+-      )))
++      (cdr (assq t mime-field-encoding-method-alist)))))
+ 
+ ;;;###autoload
+ (defun mime-encode-header-in-buffer (&optional code-conversion)
+@@ -715,7 +674,8 @@
+ 				   default-cs)))
+ 			  (encode-coding-region bbeg end cs)))))))))))
+ (defalias 'eword-encode-header 'mime-encode-header-in-buffer)
+-(make-obsolete 'eword-encode-header 'mime-encode-header-in-buffer)
++(make-obsolete 'eword-encode-header
++	       'mime-encode-header-in-buffer "19 Dec 2000")
+ 
+ 
+ ;;; @ end
diff --git a/flim/patches/patch-flim-pkg.el b/flim/patches/patch-flim-pkg.el
new file mode 100644
index 0000000000..04a54ab953
--- /dev/null
+++ b/flim/patches/patch-flim-pkg.el
@@ -0,0 +1,10 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./flim-pkg.el	1970-01-01 09:00:00.000000000 +0900
++++ ././flim-pkg.el	2018-07-29 22:48:22.274683207 +0900
+@@ -0,0 +1,3 @@
++(define-package "flim" "1.14.9"
++  "A library to provide basic features about message representation or encoding."
++  '((apel "10.8")))
diff --git a/flim/patches/patch-ftp.in b/flim/patches/patch-ftp.in
new file mode 100644
index 0000000000..8785abfada
--- /dev/null
+++ b/flim/patches/patch-ftp.in
@@ -0,0 +1,22 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./ftp.in	1970-01-01 09:00:00.000000000 +0900
++++ ././ftp.in	2018-07-29 22:48:22.274798660 +0900
+@@ -0,0 +1,15 @@
++--<<alternative>>-{
++
++  It is available from
++
++    http://www.kanji.zinbun.kyoto-u.ac.jp/~tomo/lemi/dist/flim/flim-API/
++
++--[[message/external-body; access-type=URL;
++	URL*0="http://";;
++	URL*1="www.kanji.zinbun.kyoto-u.ac.jp/~tomo/";
++	URL*2="lemi/dist/";
++	URL*3="flim/flim-API/";
++	URL*4="PACKAGE-VERSION.tar.gz"]]
++Content-Type: application/octet-stream
++Content-Disposition: attachment; filename="PACKAGE-VERSION.tar.gz"
++--}-<<alternative>>
diff --git a/flim/patches/patch-hmac-md5.el b/flim/patches/patch-hmac-md5.el
new file mode 100644
index 0000000000..768f494f8c
--- /dev/null
+++ b/flim/patches/patch-hmac-md5.el
@@ -0,0 +1,42 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./hmac-md5.el	2005-07-06 11:09:04.000000000 +0900
++++ ././hmac-md5.el	2020-09-05 16:02:39.899197296 +0900
+@@ -1,4 +1,4 @@
+-;;; hmac-md5.el --- Compute HMAC-MD5.
++;;; hmac-md5.el --- Compute HMAC-MD5.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1999, 2001  Free Software Foundation, Inc.
+ 
+@@ -64,26 +64,13 @@
+ ;;; Code:
+ 
+ (eval-when-compile (require 'hmac-def))
+-(require 'hex-util)			; (decode-hex-string STRING)
+ (require 'md5)				; expects (md5 STRING)
+ 
+ ;; To share *.elc files between Emacs w/ and w/o DL patch,
+ ;; this check must be done at load-time.
+-(cond
+- ((fboundp 'md5-binary)
+-  ;; do nothing.
+-  )
+- ((condition-case nil
+-       ;; `md5' of v21 takes 4th arg CODING (and 5th arg NOERROR).
+-       (md5 "" nil nil 'binary)		; => "d41d8cd98f00b204e9800998ecf8427e"
+-     (wrong-number-of-arguments nil))
+-  (defun md5-binary (string)
+-    "Return the MD5 of STRING in binary form."
+-   (decode-hex-string (md5 string nil nil 'binary))))
+- (t
+-  (defun md5-binary (string)
+-    "Return the MD5 of STRING in binary form."
+-   (decode-hex-string (md5 string)))))
++(defun md5-binary (string)
++  "Return the MD5 of STRING in binary form."
++  (secure-hash 'md5 string nil nil t))
+ 
+ (define-hmac-function hmac-md5 md5-binary 64 16) ; => (hmac-md5 TEXT KEY)
+ (define-hmac-function hmac-md5-96 md5-binary 64 16 96)
diff --git a/flim/patches/patch-hmac-sha1.el b/flim/patches/patch-hmac-sha1.el
new file mode 100644
index 0000000000..914f037c13
--- /dev/null
+++ b/flim/patches/patch-hmac-sha1.el
@@ -0,0 +1,35 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./hmac-sha1.el	2005-07-06 11:09:04.000000000 +0900
++++ ././hmac-sha1.el	2020-09-05 16:02:39.899264499 +0900
+@@ -1,4 +1,4 @@
+-;;; hmac-sha1.el --- Compute HMAC-SHA1.
++;;; hmac-sha1.el --- Compute HMAC-SHA1.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1999, 2001  Free Software Foundation, Inc.
+ 
+@@ -64,19 +64,11 @@
+ ;;; Code:
+ 
+ (eval-when-compile (require 'hmac-def))
+-(require 'hex-util)			; (decode-hex-string STRING)
+ (require 'sha1)				; expects (sha1 STRING)
+ 
+-;; To share *.elc files between Emacs w/ and w/o DL patch,
+-;; this check must be done at load-time.
+-(cond
+- ((fboundp 'sha1-binary)
+-  ;; do nothing.
+-  )
+- (t
+-  (defun sha1-binary (string)
+-    "Return the SHA1 of STRING in binary form."
+-    (decode-hex-string (sha1 string)))))
++(defun sha1-binary (string)
++  "Return the SHA1 of STRING in binary form."
++  (secure-hash 'sha1 string nil nil t))
+ 
+ (define-hmac-function hmac-sha1 sha1-binary 64 20) ; => (hmac-sha1 TEXT KEY)
+ (define-hmac-function hmac-sha1-96 sha1-binary 64 20 96)
diff --git a/flim/patches/patch-luna.el b/flim/patches/patch-luna.el
new file mode 100644
index 0000000000..81d4ed6b35
--- /dev/null
+++ b/flim/patches/patch-luna.el
@@ -0,0 +1,124 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./luna.el	2005-07-06 11:09:04.000000000 +0900
++++ ././luna.el	2020-09-05 16:02:39.899396201 +0900
+@@ -1,4 +1,4 @@
+-;;; luna.el --- tiny OOP system kernel
++;;; luna.el --- tiny OOP system kernel  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1999,2000,2002 Free Software Foundation, Inc.
+ 
+@@ -24,9 +24,6 @@
+ 
+ ;;; Code:
+ 
+-(eval-when-compile (require 'cl))
+-
+-
+ ;;; @ class
+ ;;;
+ 
+@@ -68,13 +65,11 @@
+ 
+ (defun luna-define-class-function (class &optional parents slots)
+   (let ((oa (make-vector 31 0))
+-	(rest parents)
+-	parent name
++	name
+ 	(i 2)
+ 	b j)
+-    (while rest
+-      (setq parent (pop rest)
+-	    b (- i 2))
++    (dolist (parent parents)
++      (setq b (- i 2))
+       (mapatoms (lambda (sym)
+ 		  (when (setq j (get sym 'luna-slot-index))
+ 		    (setq name (symbol-name sym))
+@@ -82,9 +77,8 @@
+ 		      (put (intern name oa) 'luna-slot-index (+ j b))
+ 		      (setq i (1+ i)))))
+ 		(luna-class-obarray (luna-find-class parent))))
+-    (setq rest slots)
+-    (while rest
+-      (setq name (symbol-name (pop rest)))
++    (dolist (slot slots)
++      (setq name (symbol-name slot))
+       (unless (intern-soft name oa)
+ 	(put (intern name oa) 'luna-slot-index i)
+ 	(setq i (1+ i))))
+@@ -95,9 +89,11 @@
+ ;; MEMBER-NAME.
+ 
+ (defun luna-class-find-member (class member-name)
+-  (or (stringp member-name)
+-      (setq member-name (symbol-name member-name)))
+-  (intern-soft member-name (luna-class-obarray class)))
++  (intern-soft
++   (if (stringp member-name)
++       member-name
++     (symbol-name member-name))
++   (luna-class-obarray class)))
+ 
+ 
+ ;; Return a member (slot or method) of CLASS that has name
+@@ -105,9 +101,11 @@
+ ;; CLASS.
+ 
+ (defsubst luna-class-find-or-make-member (class member-name)
+-  (or (stringp member-name)
+-      (setq member-name (symbol-name member-name)))
+-  (intern member-name (luna-class-obarray class)))
++  (intern
++   (if (stringp member-name)
++       member-name
++     (symbol-name member-name))
++   (luna-class-obarray class)))
+ 
+ 
+ ;; Return the index number of SLOT-NAME in CLASS.
+@@ -230,8 +228,8 @@
+ (defmacro luna-get-obarray (entity)
+   `(aref ,entity 1))
+ 
+-(defmacro luna-set-obarray (entity obarray)
+-  `(aset ,entity 1 ,obarray))
++(defmacro luna-set-obarray (entity array)
++  `(aset ,entity 1 ,array))
+ 
+ (defmacro luna-slot-index (entity slot-name)
+   `(luna-class-slot-index (luna-find-class (luna-class-name ,entity))
+@@ -249,12 +247,13 @@
+   `(luna-class-find-functions (luna-find-class (luna-class-name ,entity))
+ 			      ,service))
+ 
+-(defsubst luna-send (entity message &rest luna-current-method-arguments)
++(defsubst luna-send (entity message &rest arguments)
+   "Send MESSAGE to ENTITY, and return the result.
+ ENTITY is an instance of a luna class, and MESSAGE is a method name of
+ the luna class.
+-LUNA-CURRENT-METHOD-ARGUMENTS is arguments of the MESSAGE."
+-  (let ((luna-next-methods (luna-find-functions entity message))
++ARGUMENTS is arguments of the MESSAGE."
++  (let ((luna-current-method-arguments arguments)
++	(luna-next-methods (luna-find-functions entity message))
+ 	luna-current-method
+ 	luna-previous-return-value)
+     (while (and luna-next-methods
+@@ -307,10 +306,11 @@
+ ;;;
+ 
+ ;; Find a method of ENTITY that handles MESSAGE, and call it with
+-;; arguments LUNA-CURRENT-METHOD-ARGUMENTS.
++;; arguments ARGUMENTS.
+ 
+-(defun luna-apply-generic (entity message &rest luna-current-method-arguments)
+-  (let* ((class (luna-class-name entity))
++(defun luna-apply-generic (entity message &rest arguments)
++  (let* ((luna-current-method-arguments arguments)
++	 (class (luna-class-name entity))
+ 	 (cache (get message 'luna-method-cache))
+ 	 (sym (intern-soft (symbol-name class) cache))
+ 	 luna-next-methods)
diff --git a/flim/patches/patch-lunit.el b/flim/patches/patch-lunit.el
new file mode 100644
index 0000000000..22237b9406
--- /dev/null
+++ b/flim/patches/patch-lunit.el
@@ -0,0 +1,78 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./lunit.el	2005-07-06 11:09:04.000000000 +0900
++++ ././lunit.el	2020-09-05 16:02:39.899503364 +0900
+@@ -1,4 +1,4 @@
+-;;; lunit.el --- simple testing framework for luna
++;;; lunit.el --- simple testing framework for luna  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 2000 Daiki Ueno.
+ 
+@@ -52,8 +52,6 @@
+ 
+ (require 'luna)
+ 
+-(eval-when-compile (require 'cl))
+-
+ ;;; @ test
+ ;;;
+ 
+@@ -175,14 +173,14 @@
+ NAME is name of the method to be tested."
+   (luna-make-entity class :name name))
+ 
+-(luna-define-method lunit-test-number-of-tests ((case lunit-test-case))
++(luna-define-method lunit-test-number-of-tests ((_case lunit-test-case))
+   1)
+ 
+ (luna-define-method lunit-test-run ((case lunit-test-case) result)
+   (lunit-test-result-run result case))
+ 
+-(luna-define-method lunit-test-case-setup ((case lunit-test-case)))
+-(luna-define-method lunit-test-case-teardown ((case lunit-test-case)))
++(luna-define-method lunit-test-case-setup ((_case lunit-test-case)))
++(luna-define-method lunit-test-case-teardown ((_case lunit-test-case)))
+ 
+ (luna-define-method lunit-test-case-run ((case lunit-test-case))
+   (lunit-test-case-setup case)
+@@ -242,21 +240,22 @@
+ 
+ (luna-define-class lunit-test-printer (lunit-test-listener))
+ 
+-(luna-define-method lunit-test-listener-error ((printer lunit-test-printer)
+-					       case error)
++(luna-define-method lunit-test-listener-error ((_printer lunit-test-printer)
++					       _case error)
+   (princ (format " error: %S" error)))
+ 
+-(luna-define-method lunit-test-listener-failure ((printer lunit-test-printer)
+-						 case failure)
++(luna-define-method lunit-test-listener-failure ((_printer lunit-test-printer)
++						 _case failure)
+   (princ (format " failure: %S" failure)))
+ 
+-(luna-define-method lunit-test-listener-start ((printer lunit-test-printer)
++(luna-define-method lunit-test-listener-start ((_printer lunit-test-printer)
+ 					       case)
+   (princ (format "Running `%S#%S'..."
+ 		 (luna-class-name case)
+ 		 (lunit-test-name-internal case))))
+ 
+-(luna-define-method lunit-test-listener-end ((printer lunit-test-printer) case)
++(luna-define-method
++  lunit-test-listener-end ((_printer lunit-test-printer) _case)
+   (princ "\n"))
+ 
+ (defun lunit-make-test-suite-from-class (class)
+@@ -301,8 +300,7 @@
+ 
+ (defun lunit-generate-template (file)
+   (interactive "fGenerate lunit template for: ")
+-  (save-excursion
+-    (set-buffer (find-file-noselect file))
++  (with-current-buffer (find-file-noselect file)
+     (let ((index-alist 
+ 	   (lunit-create-index-function)))
+       (with-output-to-temp-buffer "*Lunit template*"
diff --git a/flim/patches/patch-md5.el b/flim/patches/patch-md5.el
new file mode 100644
index 0000000000..47acee4806
--- /dev/null
+++ b/flim/patches/patch-md5.el
@@ -0,0 +1,44 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./md5.el	2005-07-06 11:09:04.000000000 +0900
++++ ././md5.el	2020-09-05 16:02:39.899576592 +0900
+@@ -1,4 +1,4 @@
+-;;; md5.el --- MD5 Message Digest Algorithm.
++;;; md5.el --- MD5 Message Digest Algorithm.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1999, 2001  Free Software Foundation, Inc.
+ 
+@@ -49,30 +49,7 @@
+ 
+ ;;; Code:
+ 
+-(defvar md5-dl-module
+-  (cond
+-   ((and (fboundp 'md5)
+-	 (subrp (symbol-function 'md5)))
+-    nil)
+-   ((fboundp 'dynamic-link)
+-    ;; Should we take care of `dynamic-link-path'?
+-    (let ((path (expand-file-name "md5.so" exec-directory)))
+-      (if (file-exists-p path)
+-	  path
+-	nil)))
+-   (t
+-    nil)))
+-
+-(cond
+- ((and (fboundp 'md5)
+-       (subrp (symbol-function 'md5)))
+-  ;; do nothing.
+-  )
+- ((and (stringp md5-dl-module)
+-       (file-exists-p md5-dl-module))
+-  (require 'md5-dl))
+- (t
+-  (require 'md5-el)))
++(defvar md5-dl-module nil)
+ 
+ (provide 'md5)
+ 
diff --git a/flim/patches/patch-mel-g.el b/flim/patches/patch-mel-g.el
new file mode 100644
index 0000000000..fb5f6e6b65
--- /dev/null
+++ b/flim/patches/patch-mel-g.el
@@ -0,0 +1,12 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mel-g.el	2005-07-06 11:09:04.000000000 +0900
++++ ././mel-g.el	2020-09-05 16:02:39.899646590 +0900
+@@ -1,4 +1,4 @@
+-;;; mel-g.el --- Gzip64 encoder/decoder.
++;;; mel-g.el --- Gzip64 encoder/decoder.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995,96,97,98,99,2001  Free Software Foundation, Inc.
+ 
diff --git a/flim/patches/patch-mel-q-ccl.el b/flim/patches/patch-mel-q-ccl.el
new file mode 100644
index 0000000000..2f714fb95d
--- /dev/null
+++ b/flim/patches/patch-mel-q-ccl.el
@@ -0,0 +1,266 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mel-q-ccl.el	2006-06-13 00:10:02.000000000 +0900
++++ ././mel-q-ccl.el	2020-09-05 16:02:39.899821151 +0900
+@@ -1,4 +1,4 @@
+-;;; mel-q-ccl.el --- Quoted-Printable encoder/decoder using CCL.
++;;; mel-q-ccl.el --- Quoted-Printable encoder/decoder using CCL.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1998,1999 Tanaka Akira
+ 
+@@ -67,7 +67,7 @@
+       0   1   2   3   4   5   6   7   8   9 nil nil nil nil nil nil
+     nil  10  11  12  13  14  15 nil nil nil nil nil nil nil nil nil
+     nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
+-    nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
++    nil  10  11  12  13  14  15 nil nil nil nil nil nil nil nil nil
+     nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
+     nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
+     nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
+@@ -133,9 +133,7 @@
+    enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc
+    enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc
+    enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc
+-   enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc])
+-
+-)
++   enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc]))
+ 
+ 
+ ;;; @ CCL programs
+@@ -146,13 +144,14 @@
+ (define-ccl-program mel-ccl-decode-q
+   `(1
+     ((loop
+-      (read-branch
+-       r0
++      (read r0)
++      (branch
++       (r0 & 255)
+        ,@(mapcar
+           (lambda (r0)
+             (cond
+              ((= r0 (char-int ?_))
+-              `(write-repeat ? ))
++              `(write-repeat ?\s))
+              ((= r0 (char-int ?=))
+               `((loop
+                  (read-branch
+@@ -188,7 +187,9 @@
+   `(3
+     (loop
+      (loop
+-      (read-branch
++      (read r0)
++      (r0 &= 255)
++      (branch
+        r0
+        ,@(mapcar
+           (lambda (r0)
+@@ -214,9 +215,7 @@
+ 	    (if (or (= r1 32) (member r1 raw))
+ 		'((r0 += 1) (repeat))
+ 	      '((r0 += 3) (repeat))))
+-	  mel-ccl-256-table))))))
+-
+-)
++	  mel-ccl-256-table)))))))
+ 
+ (define-ccl-program mel-ccl-encode-uq
+   (mel-ccl-encode-q-generic mel-ccl-u-raw))
+@@ -243,9 +242,7 @@
+     (unless p
+       (setq p (cons branch (length eof-block-branches))
+ 	    eof-block-branches (cons p eof-block-branches)))
+-    `(,eof-block-reg = ,(cdr p))))
+-
+-)
++    `(,eof-block-reg = ,(cdr p)))))
+ 
+ (eval-when-compile
+ 
+@@ -265,9 +262,7 @@
+     `(,(mel-ccl-set-eof-block crlf-eof)
+       (read-if (,reg == ?\n)
+ 	,succ
+-	,crlf-fail))))
+-
+-)
++	,crlf-fail)))))
+ 
+ (eval-when-compile
+ 
+@@ -281,12 +276,10 @@
+ 	(after-wsp 'r5)
+ 	(column 'r6)
+ 	(type 'r3)
+-	(current 'r0)
+ 	(type-raw 0)
+ 	(type-enc 1)
+ 	(type-wsp 2)
+-	(type-brk 3)
+-	)
++	(type-brk 3))
+     `(4
+       ((,column = 0)
+        (,after-wsp = 0)
+@@ -295,6 +288,7 @@
+        (loop	; invariant: column <= 75
+ 	(loop
+ 	 (loop
++	  (r0 &= 255)
+ 	  (branch
+ 	   r0
+ 	   ,@(mapcar
+@@ -310,7 +304,7 @@
+ 			       (,(mel-ccl-set-eof-block '((write "Fro") (end)))
+ 				(read-if (r0 == ?m)
+ 				  (,(mel-ccl-set-eof-block '((write "From") (end)))
+-				   (read-if (r0 == ? )
++				   (read-if (r0 == ?\s)
+ 				     ((,column = 7)
+ 				      (,after-wsp = 1)
+ 				      ,(mel-ccl-set-eof-block '((write "From=20") (end)))
+@@ -359,8 +353,7 @@
+ 		   ((eq tmp 'cr) `((,type = ,(if input-crlf type-brk type-enc))
+ 				   (break)))
+ 		   ((eq tmp 'lf) `((,type = ,(if input-crlf type-enc type-brk))
+-				   (break)))
+-		   )))
++				   (break))))))
+ 	      mel-ccl-256-table)))
+ 	 ;; r0:type{raw,enc,wsp,brk}
+ 	 (branch
+@@ -580,8 +573,7 @@
+ 		 (,column = 0)
+ 		 ,@(if output-crlf '((write ?\r)) '())
+ 		 ,(mel-ccl-set-eof-block `(end))
+-		 (write-read-repeat r0)))
+-	     )))))
++		 (write-read-repeat r0))))))))
+       (branch
+        ,eof-block-reg
+        ,@(reverse (mapcar 'car eof-block-branches))))))
+@@ -591,13 +583,13 @@
+     ((read r0)
+      (loop
+       (branch
+-       r0
++       (r0 & 255)
+        ,@(mapcar
+           (lambda (r0)
+             (let ((tmp (aref mel-ccl-qp-table r0)))
+               (cond
+                ((eq tmp 'raw) `(write-read-repeat r0))
+-               ((eq tmp 'wsp) (if (eq r0 (char-int ? ))
++               ((eq tmp 'wsp) (if (eq r0 (char-int ?\s))
+                                   `(r1 = 1)
+                                 `(r1 = 0)))
+                ((eq tmp 'cr)
+@@ -639,7 +631,7 @@
+                 `((read r0)
+                   ;; '=' r0
+                   (r1 = (r0 == ?\t))
+-                  (if ((r0 == ? ) | r1)
++                  (if ((r0 == ?\s) | r1)
+                       ;; '=' r0:[\t ]
+                       ;; Skip transport-padding.
+                       ;; It should check CR LF after
+@@ -647,7 +639,7 @@
+                       (loop
+                        (read-if (r0 == ?\t)
+                                 (repeat)
+-                                (if (r0 == ? )
++                                (if (r0 == ?\s)
+                                     (repeat)
+                                   (break)))))
+                   ;; '=' [\t ]* r0:[^\t ]
+@@ -729,9 +721,8 @@
+                (t
+                 ;; r0:[^\t\r -~]
+                 ;; invalid character found.
+-                ;; -> ignore.
+-                `((read r0)
+-                  (repeat))))))
++                ;; -> output as is.
++                `((write-read-repeat r0))))))
+           mel-ccl-256-table))
+       ;; r1[0]:[\t ]
+       (loop
+@@ -807,10 +798,7 @@
+ 			(repeat))))
+ 		mel-ccl-28-table))))
+ 	  '(0 1 2 3 4)))
+-      (repeat)
+-      ))))
+-
+-)
++      (repeat))))))
+ 
+ (define-ccl-program mel-ccl-encode-quoted-printable-crlf-crlf
+   (mel-ccl-encode-quoted-printable-generic t t))
+@@ -902,7 +890,7 @@
+      (decode-coding-string
+       (with-temp-buffer
+ 	(set-buffer-multibyte nil)
+-	(insert-file-contents-as-binary filename)
++	(insert-file-contents-literally filename)
+ 	(buffer-string))
+       'mel-ccl-quoted-printable-lf-lf-rev)))
+ 
+@@ -914,8 +902,7 @@
+    'quoted-printable-ccl-encode-region)
+   (mel-define-method-function
+    (mime-insert-encoded-file filename (nil "quoted-printable"))
+-   'quoted-printable-ccl-insert-encoded-file)
+-  )
++   'quoted-printable-ccl-insert-encoded-file))
+ 
+ (defun quoted-printable-ccl-decode-string (string)
+   "Decode quoted-printable encoded STRING."
+@@ -932,7 +919,11 @@
+ (defun quoted-printable-ccl-write-decoded-region (start end filename)
+   "Decode quoted-printable encoded current region and write out to FILENAME."
+   (interactive "*r\nFWrite decoded region to file: ")
+-  (let ((coding-system-for-write 'mel-ccl-quoted-printable-lf-lf-rev)
++  (defvar jam-zcat-filename-list)
++  (let ((coding-system-for-write
++	 (if (coding-system-p 'mel-ccl-quoted-printable-lf-lf-rev-unix)
++	     'mel-ccl-quoted-printable-lf-lf-rev-unix
++	   'mel-ccl-quoted-printable-lf-lf-rev))
+ 	jka-compr-compression-info-list jam-zcat-filename-list)
+     (write-region start end filename)))
+ 
+@@ -967,19 +958,17 @@
+    string
+    'mel-ccl-uq-rev))
+ 
+-(unless (featurep 'xemacs)
+-  (defun q-encoding-ccl-encoded-length (string &optional mode)
+-    (let ((status [nil nil nil nil nil nil nil nil nil]))
+-      (fillarray status nil)		; XXX: Is this necessary?
+-      (ccl-execute-on-string
+-       (cond
+-	((eq mode 'text) 'mel-ccl-count-uq)
+-	((eq mode 'comment) 'mel-ccl-count-cq)
+-	(t 'mel-ccl-count-pq))
+-       status
+-       string)
+-      (aref status 0)))
+-  )
++(defun q-encoding-ccl-encoded-length (string &optional mode)
++  (let ((status [nil nil nil nil nil nil nil nil nil]))
++    (fillarray status nil)		; XXX: Is this necessary?
++    (ccl-execute-on-string
++     (cond
++      ((eq mode 'text) 'mel-ccl-count-uq)
++      ((eq mode 'comment) 'mel-ccl-count-cq)
++      (t 'mel-ccl-count-pq))
++     status
++     string)
++    (aref status 0)))
+ 
+ (mel-define-method-function (encoded-text-encode-string string (nil "Q"))
+ 			    'q-encoding-ccl-encode-string)
diff --git a/flim/patches/patch-mel-q.el b/flim/patches/patch-mel-q.el
new file mode 100644
index 0000000000..6816d18966
--- /dev/null
+++ b/flim/patches/patch-mel-q.el
@@ -0,0 +1,169 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mel-q.el	2005-07-06 11:09:04.000000000 +0900
++++ ././mel-q.el	2020-09-05 16:02:39.899931560 +0900
+@@ -1,4 +1,4 @@
+-;;; mel-q.el --- Quoted-Printable encoder/decoder.
++;;; mel-q.el --- Quoted-Printable encoder/decoder.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+ 
+@@ -31,7 +31,7 @@
+   ;; XXX: should provide char-list instead of string-to-char-list.
+   ;; XXx: and also the macro `as-binary-process' should be provided
+   ;; XXx: by the module "pces" which will be loaded by way of "poem".
+-  (require 'poem))
++  (require 'pces))
+ 
+ 
+ ;;; @ Quoted-Printable encoder
+@@ -40,7 +40,8 @@
+ (defsubst quoted-printable-quote-char (character)
+   (concat
+    "="
+-   (char-to-string (aref quoted-printable-hex-chars (ash character -4)))
++   (char-to-string (aref quoted-printable-hex-chars
++			 (ash (logand character 255) -4)))
+    (char-to-string (aref quoted-printable-hex-chars (logand character 15)))))
+ 
+ (defun quoted-printable-internal-encode-region (start end)
+@@ -58,9 +59,9 @@
+ 	    (forward-char)
+ 	    (setq col 0))
+ 	   (t
+-	    (setq chr (char-after (point)))
++	    (setq chr (logand (following-char) 255))
+ 	    (cond
+-	     ((and (memq chr '(?  ?\t))	; encode WSP char before CRLF.
++	     ((and (memq chr '(?\s ?\t))	; encode WSP char before CRLF.
+ 		   (eq (char-after (1+ (point))) ?\n))
+ 	      (forward-char)
+ 	      (insert "=\n")
+@@ -71,7 +72,7 @@
+ 		   (eq (char-after (1+  (point))) ?r)
+ 		   (eq (char-after (+ 2 (point))) ?o)
+ 		   (eq (char-after (+ 3 (point))) ?m)
+-		   (eq (char-after (+ 4 (point))) ? ))
++		   (eq (char-after (+ 4 (point))) ?\s))
+ 	      (delete-region (point)(1+ (point)))
+ 	      (insert "=46")		; moved to ?r.
+ 	      (forward-char 4)		; skip "rom ".
+@@ -113,8 +114,7 @@
+ 
+ 
+ (defvar quoted-printable-internal-encoding-limit
+-  (if (and (featurep 'xemacs)(featurep 'mule))
+-      0
++  (progn
+     (require 'path-util)
+     (if (exec-installed-p "mmencode")
+ 	1000
+@@ -173,8 +173,20 @@
+ (defsubst quoted-printable-hex-char-to-num (chr)
+   (cond ((<= ?a chr) (+ (- chr ?a) 10))
+ 	((<= ?A chr) (+ (- chr ?A) 10))
+-	((<= ?0 chr) (- chr ?0))
+-	))
++	((<= ?0 chr) (- chr ?0))))
++
++(eval-and-compile
++  (if (eval-when-compile
++	(> (string-to-char (string-as-multibyte "\200")) 128))
++      (defsubst quoted-printable-num-to-raw-byte-char (chr)
++	(if (and chr
++		 (> chr 127))
++	    (logior chr
++		    (eval-when-compile
++		      (- (string-to-char (string-as-multibyte "\200")) 128)))
++	  chr))
++    (defsubst quoted-printable-num-to-raw-byte-char (chr)
++      chr)))
+ 
+ (defun quoted-printable-internal-decode-region (start end)
+   (save-excursion
+@@ -186,20 +198,21 @@
+ 	 ((eolp)
+ 	  ;; unfold soft line break.
+ 	  (delete-region (1- (point))(1+ (point))))
+-	 ((and (memq (char-after (point))
++	 ((and (memq (following-char)
+ 		     (eval-when-compile
+ 		       ;; XXX: should provide char-list instead.
+-		       (string-to-char-list quoted-printable-hex-chars)))
++		       (string-to-list quoted-printable-hex-chars)))
+ 	       (memq (char-after (1+ (point)))
+ 		     (eval-when-compile
+ 		       ;; XXX: should provide char-list instead.
+-		       (string-to-char-list quoted-printable-hex-chars))))
++		       (string-to-list quoted-printable-hex-chars))))
+ 	  ;; encoded char.
+ 	  (insert
+ 	   (prog1
+-	       (logior
+-		(ash (quoted-printable-hex-char-to-num (char-after (point))) 4)
+-		(quoted-printable-hex-char-to-num (char-after (1+ (point)))))
++	       (quoted-printable-num-to-raw-byte-char
++		(logior
++		 (ash (quoted-printable-hex-char-to-num (following-char)) 4)
++		 (quoted-printable-hex-char-to-num (char-after (1+ (point))))))
+ 	     (delete-region (1- (point))(+ 2 (point))))))
+ 	 (t
+ 	  ;; invalid encoding.
+@@ -295,33 +308,33 @@
+ `phrase'."
+   (let ((specials (cdr (or (assq mode q-encoding-special-chars-alist)
+ 			   (assq 'phrase q-encoding-special-chars-alist)))))
+-    (mapconcat (function
+-		(lambda (chr)
+-		  (cond ((eq chr ? ) "_")
+-			((or (< chr 32) (< 126 chr)
+-			     (memq chr specials))
+-			 (quoted-printable-quote-char chr))
+-			(t
+-			 (char-to-string chr)))))
++    (mapconcat (lambda (chr)
++		 (cond ((eq chr ?\s) "_")
++		       ((or (< chr 32) (< 126 chr)
++			    (memq chr specials))
++			(quoted-printable-quote-char chr))
++		       (t
++			(char-to-string chr))))
+ 	       string "")))
+ 
+ (defun q-encoding-decode-string (string)
+   "Decode STRING which is encoded in Q-encoding and return the result."
+   (let (q h l)
+-    (mapconcat (function
+-		(lambda (chr)
+-		  (cond ((eq chr ?_) " ")
+-			((eq chr ?=)
+-			 (setq q t)
+-			 "")
+-			(q (setq h (quoted-printable-hex-char-to-num chr))
+-			   (setq q nil)
+-			   "")
+-			(h (setq l (quoted-printable-hex-char-to-num chr))
+-			   (prog1
+-			       (char-to-string (logior (ash h 4) l))
+-			     (setq h nil)))
+-			(t (char-to-string chr)))))
++    (mapconcat (lambda (chr)
++		 (cond ((eq chr ?_) " ")
++		       ((eq chr ?=)
++			(setq q t)
++			"")
++		       (q (setq h (quoted-printable-hex-char-to-num chr))
++			  (setq q nil)
++			  "")
++		       (h (setq l (quoted-printable-hex-char-to-num chr))
++			  (prog1
++			      (char-to-string
++			       (quoted-printable-num-to-raw-byte-char
++				(logior (ash h 4) l)))
++			    (setq h nil)))
++		       (t (char-to-string chr))))
+ 	       string "")))
+ 
+ (mel-define-method-function (encoded-text-encode-string string (nil "Q"))
diff --git a/flim/patches/patch-mel-u.el b/flim/patches/patch-mel-u.el
new file mode 100644
index 0000000000..b9a0491af1
--- /dev/null
+++ b/flim/patches/patch-mel-u.el
@@ -0,0 +1,12 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mel-u.el	2005-07-06 11:09:04.000000000 +0900
++++ ././mel-u.el	2020-09-05 16:02:39.900016173 +0900
+@@ -1,4 +1,4 @@
+-;;; mel-u.el --- uuencode encoder/decoder.
++;;; mel-u.el --- uuencode encoder/decoder.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc.
+ 
diff --git a/flim/patches/patch-mel.el b/flim/patches/patch-mel.el
new file mode 100644
index 0000000000..457b7221fc
--- /dev/null
+++ b/flim/patches/patch-mel.el
@@ -0,0 +1,320 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mel.el	2007-06-18 19:58:54.000000000 +0900
++++ ././mel.el	2020-09-05 16:02:39.900137733 +0900
+@@ -1,4 +1,4 @@
+-;;; mel.el --- A MIME encoding/decoding library.
++;;; mel.el --- A MIME encoding/decoding library.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc.
+ 
+@@ -27,6 +27,7 @@
+ 
+ (require 'mime-def)
+ (require 'alist)
++(require 'pces)
+ 
+ (defcustom mime-encoding-list
+   '("7bit" "8bit" "binary" "base64" "quoted-printable")
+@@ -42,8 +43,7 @@
+       (let (dest)
+ 	(mapatoms (lambda (sym)
+ 		    (or (eq sym nil)
+-			(setq dest (cons (symbol-name sym) dest)))
+-		    )
++			(setq dest (cons (symbol-name sym) dest))))
+ 		  (symbol-value (intern (format "%s-obarray" service))))
+ 	(let ((rest mel-encoding-module-alist)
+ 	      pair)
+@@ -52,8 +52,7 @@
+ 	      (or (member key dest)
+ 		  (<= (length key) 1)
+ 		  (setq dest (cons key dest))))
+-	    (setq rest (cdr rest)))
+-	  )
++	    (setq rest (cdr rest))))
+ 	dest)
+     mime-encoding-list))
+ 
+@@ -73,6 +72,9 @@
+   (mel-find-function-from-obarray
+    (symbol-value (intern (format "%s-obarray" service))) encoding))
+ 
++(defun mel-prompt-for-encoding (&optional service)
++  (completing-read "Encoding: (default base64) "
++		   (mime-encoding-alist service) nil t nil nil "base64"))
+ 
+ ;;; @ setting for modules
+ ;;;
+@@ -86,7 +88,7 @@
+ 
+ (defun 8bit-write-decoded-region (start end filename)
+   "Decode and write current region encoded by \"8bit\" into FILENAME."
+-  (let ((coding-system-for-write 'raw-text)
++  (let ((coding-system-for-write 'no-conversion)
+ 	format-alist)
+     (write-region start end filename)))
+ 
+@@ -95,8 +97,8 @@
+ 			    'identity)
+ (mel-define-method-function (mime-decode-string string (nil "8bit"))
+ 			    'identity)
+-(mel-define-method mime-encode-region (start end (nil "8bit")))
+-(mel-define-method mime-decode-region (start end (nil "8bit")))
++(mel-define-method mime-encode-region (_start _end (nil "8bit")))
++(mel-define-method mime-decode-region (_start _end (nil "8bit")))
+ (mel-define-method-function (mime-insert-encoded-file filename (nil "8bit"))
+ 			    '8bit-insert-encoded-file)
+ (mel-define-method-function (mime-write-decoded-region
+@@ -112,6 +114,7 @@
+ 
+ (defun binary-write-decoded-region (start end filename)
+   "Decode and write current region encoded by \"binary\" into FILENAME."
++  (defvar jam-zcat-filename-list)
+   (let ((coding-system-for-write 'binary)
+ 	jka-compr-compression-info-list jam-zcat-filename-list)
+     (write-region start end filename)))
+@@ -142,86 +145,126 @@
+ 			    'identity)
+ (mel-define-method-function (mime-decode-string string (nil "binary"))
+ 			    'identity)
+-(mel-define-method mime-encode-region (start end (nil "binary")))
+-(mel-define-method mime-decode-region (start end (nil "binary")))
++(mel-define-method mime-encode-region (_start _end (nil "binary")))
++(mel-define-method mime-decode-region (_start _end (nil "binary")))
+ (mel-define-method-function (mime-insert-encoded-file filename (nil "binary"))
+ 			    'binary-insert-encoded-file)
+ (mel-define-method-function (mime-write-decoded-region
+ 			     start end filename (nil "binary"))
+ 			    'binary-write-decoded-region)
+ 
+-(defvar mel-b-builtin
+-   (and (fboundp 'base64-encode-string)
+-        (subrp (symbol-function 'base64-encode-string))))
+-
+-(when mel-b-builtin
+-  (mel-define-backend "base64")
+-  (mel-define-method-function (mime-encode-string string (nil "base64"))
++(defvar mel-b-builtin t)
++
++(defcustom mel-b-builtin-garbage-strategy 'asis
++  "When non-nil, base64 decoder functions handle non-encoded garbage.  When value is asis decoders keep garbage and when value is discard decoders delete garbage."
++  :group 'mime
++  :type '(choice (const :tag "Keep as is" asis)
++		 (const :tag "Discard" discard)
++		 (const :tag "Not handled" nil)))
++
++(defvar mel-b-builtin-encoded-line-regexp "^[A-Za-z0-9+/]+=*[\t ]*\r?\n?")
++
++(mel-define-backend "base64")
++(mel-define-method-function (mime-encode-string string (nil "base64"))
+ 			      'base64-encode-string)
+-  (mel-define-method-function (mime-decode-string string (nil "base64"))
+-			      'base64-decode-string)
+-  (mel-define-method-function (mime-encode-region start end (nil "base64"))
+-			      'base64-encode-region)
+-  (mel-define-method-function (mime-decode-region start end (nil "base64"))
+-			      'base64-decode-region)  
+-  (mel-define-method mime-insert-encoded-file (filename (nil "base64"))
+-    "Encode contents of file FILENAME to base64, and insert the result.
+-It calls external base64 encoder specified by
+-`base64-external-encoder'.  So you must install the program (maybe
+-mmencode included in metamail or XEmacs package)."
+-    (interactive "*fInsert encoded file: ")
+-    (insert (base64-encode-string
+-	     (with-temp-buffer
+-	       (set-buffer-multibyte nil)
+-	       (binary-insert-encoded-file filename)
+-	       (buffer-string))))
+-    (or (bolp) (insert ?\n)))
+-  (mel-define-method mime-write-decoded-region (start end filename
+-						      (nil "base64"))
+-    "Decode the region from START to END and write out to FILENAME."
+-    (interactive "*r\nFWrite decoded region to file: ")
+-    (let ((str (buffer-substring start end)))
+-      (with-temp-buffer
+-	(insert str)
+-	(base64-decode-region (point-min) (point-max))
+-	(write-region-as-binary (point-min) (point-max) filename))))
+-    
+-  ;; (mel-define-method-function (encoded-text-encode-string string (nil "B"))
+-  ;;                             'base64-encode-string)
+-  (mel-define-method encoded-text-decode-string (string (nil "B"))
+-    (if (string-match (eval-when-compile
+-			(concat "\\`" B-encoded-text-regexp "\\'"))
+-		      string)
++(defun mel-b-builtin-decode-string (string)
++  "Decode base64 encoded STRING with garbage handling.  Garbage handling strategy is decided by `mel-b-builtin-garbage-strategy'.  Return decoded string."
++  (if (null mel-b-builtin-garbage-strategy)
++      (base64-decode-string string)
++    (condition-case error
+ 	(base64-decode-string string)
+-      (error "Invalid encoded-text %s" string)))
+-  )
++      (error
++       (if (string-match mel-b-builtin-encoded-line-regexp string)
++	   (let ((start (match-beginning 0))
++		 end)
++	     (message "Base64 encoded string has garbage")
++	     (while (and (< (setq end (match-end 0)) (length string))
++			 (eq end
++			     (and (string-match
++				   mel-b-builtin-encoded-line-regexp
++				   string end)
++				  (match-beginning 0)))))
++	     (if (eq mel-b-builtin-garbage-strategy 'discard)
++		 (base64-decode-string (substring string start end))
++	       (concat (substring string 0 start)
++		       (base64-decode-string (substring string start end))
++		       (substring string end))))
++	 (signal (car error) (cdr error)))))))
++(mel-define-method-function (mime-decode-string string (nil "base64"))
++			    'mel-b-builtin-decode-string)
++(mel-define-method-function (mime-encode-region start end (nil "base64"))
++			    'base64-encode-region)
++(defun mel-b-builtin-decode-region (start end)
++  "Decode base64 encoded region between START and END with garbage handling.  Garbage handling strategy is decided by `mel-b-builtin-garbage-strategy'."
++  (if (null mel-b-builtin-garbage-strategy)
++      (base64-decode-region start end)
++    (condition-case error
++	(base64-decode-region start end)
++      (error
++       (save-excursion
++	 (let ((start (min start end))
++	       (end (max start end))
++	       base64-start)
++	   (goto-char start)
++	   (if (re-search-forward mel-b-builtin-encoded-line-regexp end t)
++	       (progn
++		 (message "Base64 encoded region contains garbage")
++		 (setq base64-start (match-beginning 0))
++		 (while (eq (point)
++			    (and (re-search-forward
++				  mel-b-builtin-encoded-line-regexp end t)
++				 (match-beginning 0))))
++		 (when (eq mel-b-builtin-garbage-strategy 'discard)
++		   (delete-region (match-end 0) end))
++		 (base64-decode-region base64-start (point))
++		 (when (eq mel-b-builtin-garbage-strategy 'discard)
++		   (delete-region start base64-start)))
++	     (signal (car error) (cdr error)))))))))
++(mel-define-method-function (mime-decode-region start end (nil "base64"))
++			    'mel-b-builtin-decode-region)  
++(mel-define-method mime-insert-encoded-file (filename (nil "base64"))
++  "Encode contents of file FILENAME to base64, and insert the result."
++  (interactive "*fInsert encoded file: ")
++  ;; No need to make buffer unibyte if binary-insert-encoded-file only
++  ;; inserts single-byte characters.
++  (save-restriction
++    (narrow-to-region (point) (point))
++    (binary-insert-encoded-file filename)
++    (base64-encode-region (point-min) (point-max))
++    (goto-char (point-max)))
++  (or (bolp) (insert ?\n)))
++(mel-define-method mime-write-decoded-region (start end filename
++						    (nil "base64"))
++  "Decode the region from START to END and write out to FILENAME."
++  (interactive "*r\nFWrite decoded region to file: ")
++  (let ((buffer (current-buffer)))
++    (with-temp-buffer
++      (insert-buffer-substring buffer start end)
++      (mel-b-builtin-decode-region (point-min) (point-max))
++      (write-region-as-binary (point-min) (point-max) filename))))
++
++;; (mel-define-method-function (encoded-text-encode-string string (nil "B"))
++;;                             'base64-encode-string)
++(mel-define-method encoded-text-decode-string (string (nil "B"))
++  (if (string-match (eval-when-compile
++		      (concat "\\`" B-encoded-text-regexp "\\'"))
++		    string)
++      (base64-decode-string string)
++    (error "Invalid encoded-text %s" string)))
++
+ 
+-(mel-use-module 'mel-b-el '("base64" "B"))
+ (mel-use-module 'mel-q '("quoted-printable" "Q"))
+ (mel-use-module 'mel-g '("x-gzip64"))
+ (mel-use-module 'mel-u '("x-uue" "x-uuencode"))
+ 
+-(defvar mel-b-ccl-module
+-  (and (featurep 'mule)
+-       (progn
+-	 (require 'path-util)
+-	 (module-installed-p 'mel-b-ccl))))
+-
+ (defvar mel-q-ccl-module
+-  (and (featurep 'mule)
+-       (progn
+-	 (require 'path-util)
+-	 (module-installed-p 'mel-q-ccl))))
+-
+-(when mel-b-ccl-module
+-  (mel-use-module 'mel-b-ccl '("base64" "B")))
++  (progn
++    (require 'path-util)
++    (module-installed-p 'mel-q-ccl)))
+ 
+ (when mel-q-ccl-module
+   (mel-use-module 'mel-q-ccl '("quoted-printable" "Q")))
+ 
+-(when base64-dl-module
+-  (mel-use-module 'mel-b-dl '("base64" "B")))
+-
+ 
+ ;;; @ region
+ ;;;
+@@ -232,9 +275,7 @@
+ ENCODING must be string."
+   (interactive
+    (list (region-beginning)(region-end)
+-	 (completing-read "Encoding: "
+-			  (mime-encoding-alist)
+-			  nil t "base64")))
++	 (mel-prompt-for-encoding)))
+   (funcall (mel-find-function 'mime-encode-region encoding) start end))
+ 
+ 
+@@ -244,9 +285,7 @@
+ ENCODING must be string."
+   (interactive
+    (list (region-beginning)(region-end)
+-	 (completing-read "Encoding: "
+-			  (mime-encoding-alist 'mime-decode-region)
+-			  nil t "base64")))
++	 (mel-prompt-for-encoding 'mime-decode-region)))
+   (funcall (mel-find-function 'mime-decode-region encoding)
+ 	   start end))
+ 
+@@ -299,7 +338,7 @@
+     (while (< i len)
+       (setq chr (aref string i))
+       (if (or (Q-encoding-printable-char-p chr mode)
+-	      (eq chr ? ))
++	      (eq chr ?\s))
+ 	  (setq l (+ l 1))
+ 	(setq l (+ l 3)))
+       (setq i (+ i 1)))
+@@ -314,9 +353,7 @@
+   "Insert file FILENAME encoded by ENCODING format."
+   (interactive
+    (list (read-file-name "Insert encoded file: ")
+-	 (completing-read "Encoding: "
+-			  (mime-encoding-alist)
+-			  nil t "base64")))
++	 (mel-prompt-for-encoding)))
+   (funcall (mel-find-function 'mime-insert-encoded-file encoding)
+ 	   filename))
+ 
+@@ -328,9 +365,7 @@
+   (interactive
+    (list (region-beginning)(region-end)
+ 	 (read-file-name "Write decoded region to file: ")
+-	 (completing-read "Encoding: "
+-			  (mime-encoding-alist 'mime-write-decoded-region)
+-			  nil t "base64")))
++	 (mel-prompt-for-encoding 'mime-write-decoded-region)))
+   (funcall (mel-find-function 'mime-write-decoded-region encoding)
+ 	   start end filename))
+ 
diff --git a/flim/patches/patch-mime-conf.el b/flim/patches/patch-mime-conf.el
new file mode 100644
index 0000000000..a3d5e13e64
--- /dev/null
+++ b/flim/patches/patch-mime-conf.el
@@ -0,0 +1,248 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mime-conf.el	2005-07-06 11:09:04.000000000 +0900
++++ ././mime-conf.el	2020-09-05 16:02:39.900236870 +0900
+@@ -1,4 +1,4 @@
+-;;; mime-conf.el --- mailcap parser and MIME playback configuration
++;;; mime-conf.el --- mailcap parser and MIME playback configuration  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1997,1998,1999,2000,2004 Free Software Foundation, Inc.
+ 
+@@ -34,7 +34,7 @@
+ ;;;
+ 
+ (defsubst mime-mailcap-skip-comment ()
+-  (let ((chr (char-after (point))))
++  (let ((chr (following-char)))
+     (when (and chr
+ 	       (or (= chr ?\n)
+ 		   (= chr ?#)))
+@@ -50,8 +50,7 @@
+       (let ((beg (match-beginning 0))
+ 	    (end (match-end 0)))
+ 	(goto-char end)
+-	(buffer-substring beg end)
+-	)))
++	(buffer-substring beg end))))
+ 
+ 
+ ;;; @ typefield
+@@ -60,17 +59,15 @@
+ (defsubst mime-mailcap-look-at-type-field ()
+   (let ((type (mime-mailcap-look-at-token)))
+     (if type
+-	(if (eq (char-after (point)) ?/)
++	(if (eq (following-char) ?/)
+ 	    (progn
+ 	      (forward-char)
+ 	      (let ((subtype (mime-mailcap-look-at-token)))
+ 		(if subtype
+ 		    (cons (cons 'type (intern type))
+ 			  (unless (string= subtype "*")
+-			    (list (cons 'subtype (intern subtype)))
+-			    )))))
+-	  (list (cons 'type (intern type)))
+-	  ))))
++			    (list (cons 'subtype (intern subtype))))))))
++	  (list (cons 'type (intern type)))))))
+ 
+ 
+ ;;; @ field separator
+@@ -87,29 +84,27 @@
+ ;;;
+ 
+ (defsubst mime-mailcap-look-at-schar ()
+-  (let ((chr (char-after (point))))
++  (let ((chr (following-char)))
+     (if (and chr
+-	     (>= chr ? )
++	     (>= chr ?\s)
+ 	     (/= chr ?\;)
+-	     (/= chr ?\\)
+-	     )
++	     (/= chr ?\\))
+ 	(prog1
+ 	    chr
+ 	  (forward-char)))))
+ 
+ (defsubst mime-mailcap-look-at-qchar ()
+-  (when (eq (char-after (point)) ?\\)
++  (when (eq (following-char) ?\\)
+     (prog2
+ 	(forward-char)
+-	(char-after (point))
++	(following-char)
+       (forward-char))))
+ 
+ (defsubst mime-mailcap-look-at-mtext ()
+   (let ((beg (point)))
+     (while (or (mime-mailcap-look-at-qchar)
+ 	       (mime-mailcap-look-at-schar)))
+-    (buffer-substring beg (point))
+-    ))
++    (buffer-substring beg (point))))
+ 
+ 
+ ;;; @ field
+@@ -123,10 +118,8 @@
+ 			   (goto-char (match-end 0))
+ 			   (mime-mailcap-look-at-mtext))))
+ 	      (if value
+-		  (cons (intern token) value)
+-		))
+-	  (list (intern token))
+-	  ))))
++		  (cons (intern token) value)))
++	  (list (intern token))))))
+ 
+ 
+ ;;; @ mailcap entry
+@@ -139,10 +132,8 @@
+ 	      fields field)
+ 	  (when view
+ 	    (while (and (mime-mailcap-skip-field-separator)
+-			(setq field (mime-mailcap-look-at-field))
+-			)
+-	      (setq fields (cons field fields))
+-	      )
++			(setq field (mime-mailcap-look-at-field)))
++	      (setq fields (cons field fields)))
+ 	    (nconc type
+ 		   (list (cons 'view view))
+ 		   fields))))))
+@@ -164,15 +155,12 @@
+     (let (entries entry)
+       (while (progn
+ 	       (while (mime-mailcap-skip-comment))
+-	       (setq entry (mime-mailcap-look-at-entry))
+-	       )
++	       (setq entry (mime-mailcap-look-at-entry)))
+ 	(setq entries (cons entry entries))
+-	(forward-line)
+-	)
++	(forward-line))
+       (cond ((functionp order) (sort entries order))
+ 	    ((null order) (nreverse entries))
+-	    (t entries)
+-	    ))))
++	    (t entries)))))
+ 
+ 
+ ;;;###autoload
+@@ -189,8 +177,7 @@
+       (setq filename mime-mailcap-file))
+   (with-temp-buffer
+     (insert-file-contents filename)
+-    (mime-parse-mailcap-buffer (current-buffer) order)
+-    ))
++    (mime-parse-mailcap-buffer (current-buffer) order)))
+ 
+ 
+ ;;;###autoload
+@@ -213,58 +200,52 @@
+ 	dest)
+     (while (< i len)
+       (let ((chr (aref mtext i)))
+-	(cond ((eq chr ?%)
+-	       (setq i (1+ i)
+-		     chr (aref mtext i))
+-	       (cond ((eq chr ?s)
+-		      (let ((file (cdr (assq 'filename situation))))
+-			(if (null file)
+-			    (error "'filename is not specified in situation.")
+-			  (setq dest (concat dest
+-					     (substring mtext p (1- i))
+-					     (shell-quote-argument file))
+-				i (1+ i)
+-				p i)
+-			  )))
+-		     ((eq chr ?t)
+-		      (let ((type (or (mime-type/subtype-string
+-				       (cdr (assq 'type situation))
+-				       (cdr (assq 'subtype situation)))
+-				      "text/plain")))
+-			(setq dest (concat dest
+-					   (substring mtext p (1- i))
+-					   type)
+-			      i (1+ i)
+-			      p i)
+-			))
+-		     ((eq chr ?\{)
+-		      (setq i (1+ i))
+-		      (if (not (string-match "}" mtext i))
+-			  (error "parse error!!!")
+-			(let* ((me (match-end 0))
+-			       (attribute (substring mtext i (1- me)))
+-			       (parameter (cdr (assoc attribute situation))))
+-			  (if (null parameter)
+-			      (error "\"%s\" is not specified in situation."
+-				     attribute)
+-			    (setq dest (concat dest
+-					       (substring mtext p (- i 2))
+-					       parameter)
+-				  i me
+-				  p i)
+-			    )
+-			  )))
+-		     (t (error "Invalid sequence `%%%c'." chr))
+-		     ))
+-	      ((eq chr ?\\)
+-	       (setq dest (concat dest (substring mtext p i))
+-		     p (1+ i)
+-		     i (+ i 2))
+-	       )
+-	      (t (setq i (1+ i)))
+-	      )))
+-    (concat dest (substring mtext p))
+-    ))
++	(cond
++	 ((eq chr ?%)
++	  (setq i (1+ i)
++		chr (aref mtext i))
++	  (cond
++	   ((eq chr ?s)
++	    (let ((file (cdr (assq 'filename situation))))
++	      (if file
++		  (setq file (shell-quote-argument file))
++		(error "'filename is not specified in situation."))
++	      (setq dest (concat dest
++				 (substring mtext p (1- i))
++				 ;; if the situation (wrongly) quotes
++				 ;; the argument, fix it.
++				 (if (eq ?' (aref mtext (- i 2)))
++				     (concat "'" file "'")
++				   file))
++		    i (1+ i)
++		    p i)))
++	   ((eq chr ?t)
++	    (let ((type (or (mime-type/subtype-string
++			     (cdr (assq 'type situation))
++			     (cdr (assq 'subtype situation)))
++			    "text/plain")))
++	      (setq dest (concat dest (substring mtext p (1- i)) type)
++		    i (1+ i)
++		    p i)))
++	   ((eq chr ?\{)
++	    (setq i (1+ i))
++	    (unless (string-match "}" mtext i)
++	      (error "parse error!!!"))
++	    (let* ((me (match-end 0))
++		   (attribute (substring mtext i (1- me)))
++		   (parameter (cdr (assoc attribute situation))))
++	      (unless parameter
++		(error "\"%s\" is not specified in situation." attribute))
++	      (setq dest (concat dest (substring mtext p (- i 2)) parameter)
++		    i me
++		    p i)))
++	   (t (error "Invalid sequence `%%%c'." chr))))
++	 ((eq chr ?\\)
++	  (setq dest (concat dest (substring mtext p i))
++		p (1+ i)
++		i (+ i 2)))
++	 (t (setq i (1+ i))))))
++    (concat dest (substring mtext p))))
+ 
+ 
+ ;;; @ end
diff --git a/flim/patches/patch-mime-def.el b/flim/patches/patch-mime-def.el
new file mode 100644
index 0000000000..75d004587b
--- /dev/null
+++ b/flim/patches/patch-mime-def.el
@@ -0,0 +1,147 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mime-def.el	2007-09-06 17:04:09.000000000 +0900
++++ ././mime-def.el	2020-09-05 16:02:39.900365807 +0900
+@@ -1,4 +1,4 @@
+-;;; mime-def.el --- definition module about MIME -*- coding: iso-8859-4; -*-
++;;; mime-def.el --- definition module about MIME -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995,96,97,98,99,2000,2001,2002,2003,2004,2005,2006
+ ;;   Free Software Foundation, Inc.
+@@ -33,7 +33,7 @@
+ (eval-when-compile (require 'luna))	; luna-arglist-to-arguments
+ 
+ (eval-and-compile
+-  (defconst mime-library-product ["FLIM" (1 14 9) "Goj�++  (defconst mime-library-product ["FLIM-LB" (1 14 9) "Gojō"]
+     "Product name, version number and code name of MIME-library package."))
+ 
+ (defmacro mime-product-name (product)
+@@ -96,8 +96,7 @@
+   '(("X-Nsubject" . iso-2022-jp-2)
+     ("Newsgroups" . nil)
+     ("Message-ID" . nil)
+-    (t            . mime)
+-    )
++    (t            . mime))
+   "*Alist to specify field encoding method.
+ Its key is field-name, value is encoding method.
+ 
+@@ -142,8 +141,14 @@
+ (defconst mime-token-regexp
+   (concat "[^" mime-tspecial-char-list "\000-\040]+"))
+ (defconst mime-attribute-char-regexp
+-  (concat "[^" mime-tspecial-char-list "\000-\040"
++  (concat "[^" mime-tspecial-char-list
++	  "*'%"				; introduced in RFC 2231.
++	  "\000-\040"
++	  "]"))
++(defconst mime-non-attribute-char-regexp
++  (concat "[" mime-tspecial-char-list
+ 	  "*'%"				; introduced in RFC 2231.
++	  "\000-\040\177-\377"		; non-printable, non-US-ASCII.
+ 	  "]"))
+ 
+ (defconst mime-charset-regexp
+@@ -151,7 +156,8 @@
+ 	  "*'%"				; should not include "%"?
+ 	  "]+"))
+ 
+-;; More precisely, length of "[A-Za-z]+" is limited to at most 8.
++;; More precisely, length of each "[A-Za-z]+" is limited to at most 8.
++;; See RFC 3066 "Tags for the Identification of Languages".
+ ;; (defconst mime-language-regexp "[A-Za-z]+\\(-[A-Za-z]+\\)*")
+ (defconst mime-language-regexp "[-A-Za-z]+")
+ 
+@@ -275,7 +281,8 @@
+ 
+ (make-variable-buffer-local 'mime-message-structure)
+ 
+-(make-obsolete-variable 'mime-message-structure "should not use it.")
++(make-obsolete-variable 'mime-message-structure
++			"should not use it." "26 May 1999")
+ 
+ 
+ ;;; @ for mel-backend
+@@ -294,9 +301,7 @@
+ 	   `((defun ,name ,args
+ 	       ,@rest
+ 	       (funcall (mel-find-function ',name ,(car (last args)))
+-			,@(luna-arglist-to-arguments (butlast args)))
+-	       )))
+-     ))
++			,@(luna-arglist-to-arguments (butlast args))))))))
+ 
+ (put 'mel-define-service 'lisp-indent-function 'defun)
+ 
+@@ -310,10 +315,8 @@
+ 	  (while (and rest
+ 		      (progn
+ 			(require (car rest))
+-			(null (setq f (intern-soft encoding ob-array)))
+-			))
+-	    (setq rest (cdr rest))
+-	    )
++			(null (setq f (intern-soft encoding ob-array)))))
++	    (setq rest (cdr rest)))
+ 	  f))))
+ 
+ (defsubst mel-copy-method (service src-backend dst-backend)
+@@ -323,8 +326,7 @@
+     (when f
+       (setq sym (intern dst-backend oa))
+       (or (fboundp sym)
+-	  (fset sym (symbol-function f))
+-	  ))))
++	  (fset sym (symbol-function f))))))
+        
+ (defsubst mel-copy-backend (src-backend dst-backend)
+   (let ((services mel-service-list))
+@@ -338,8 +340,7 @@
+ Each parent must be backend name (string)."
+   (cons 'progn
+ 	(mapcar (lambda (parent)
+-		  `(mel-copy-backend ,parent ,type)
+-		  )
++		  `(mel-copy-backend ,parent ,type))
+ 		parents)))
+ 
+ (defmacro mel-define-method (name args &rest body)
+@@ -380,8 +381,7 @@
+ 	 (class (nth 1 specializer)))
+     `(progn
+        (define-function ,function
+-	 (intern ,class ,(intern (format "%s-obarray" name))))
+-       )))
++	 (intern ,class ,(intern (format "%s-obarray" name)))))))
+ 
+ (defvar base64-dl-module
+   (if (and (fboundp 'base64-encode-string)
+@@ -390,9 +390,23 @@
+     (if (fboundp 'dynamic-link)
+ 	(let ((path (expand-file-name "base64.so" exec-directory)))
+ 	  (and (file-exists-p path)
+-	       path)
+-	  ))))
++	       path)))))
+ 
++(defsubst mime-charset-decode-string (string charset &optional lbt)
++  "Decode the STRING as MIME CHARSET.
++Buffer's multibyteness is ignored."
++  (let ((cs (mime-charset-to-coding-system charset lbt)))
++    (if cs
++	(decode-coding-string string cs)
++      string)))
++
++(defsubst mime-charset-encode-string (string charset &optional lbt)
++  "Encode the STRING as MIME CHARSET.
++Buffer's multibyteness is ignored."
++  (let ((cs (mime-charset-to-coding-system charset lbt)))
++    (if cs
++	(encode-coding-string string cs)
++      string)))
+ 
+ ;;; @ end
+ ;;;
diff --git a/flim/patches/patch-mime-parse.el-00 b/flim/patches/patch-mime-parse.el-00
new file mode 100644
index 0000000000..c191b69b0b
--- /dev/null
+++ b/flim/patches/patch-mime-parse.el-00
@@ -0,0 +1,28 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+$NetBSD$
+
+string-to-int -> string-to-number
+
+--- mime-parse.el~	2005-07-06 11:09:04.000000000 +0900
++++ mime-parse.el	2016-12-28 10:41:55.000000000 +0900
+@@ -97,7 +97,7 @@ be the result."
+     (insert text)
+     (goto-char (point-min))
+     (while (re-search-forward "%[0-9A-Fa-f][0-9A-Fa-f]" nil t)
+-      (insert (prog1 (string-to-int
++      (insert (prog1 (string-to-number
+ 		      (buffer-substring (point)(- (point) 2))
+ 		      16)
+                 (delete-region (point)(- (point) 3)))))
+@@ -147,7 +147,7 @@ property of the decoded-value."
+           (let* ((attribute (downcase
+ 			     (substring (car params) 0 (match-end 1))))
+                  (section (if (match-beginning 2)
+-			      (string-to-int
++			      (string-to-number
+ 			       (substring (car params)
+ 					  (1+ (match-beginning 2))
+ 					  (match-end 2)))
diff --git a/flim/patches/patch-mime.el b/flim/patches/patch-mime.el
new file mode 100644
index 0000000000..9487f0a058
--- /dev/null
+++ b/flim/patches/patch-mime.el
@@ -0,0 +1,134 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mime.el	2005-07-06 11:09:04.000000000 +0900
++++ ././mime.el	2020-09-05 16:02:39.901261920 +0900
+@@ -1,4 +1,4 @@
+-;;; mime.el --- MIME library module
++;;; mime.el --- MIME library module  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1998,1999,2000,2001,2003 Free Software Foundation, Inc.
+ 
+@@ -61,9 +61,7 @@
+   "Parse STRING as cid URI.")
+ 
+ (autoload 'mime-parse-buffer "mime-parse"
+-  "Parse BUFFER as a MIME message.")
+-
+-)
++  "Parse BUFFER as a MIME message."))
+ 
+ (autoload 'mime-encode-field-body "eword-encode"
+   "Encode FIELD-BODY as FIELD-NAME, and return the result.")
+@@ -110,9 +108,7 @@
+ 	message
+       (let ((rc (nth sn (mime-entity-children message))))
+ 	(if rc
+-	    (mime-find-entity-from-number (cdr entity-number) rc)
+-	  ))
+-      )))
++	    (mime-find-entity-from-number (cdr entity-number) rc))))))
+ 
+ (defun mime-find-entity-from-node-id (entity-node-id message)
+   "Return entity from ENTITY-NODE-ID in MESSAGE."
+@@ -273,8 +269,7 @@
+       (let ((ret (mime-entity-fetch-field entity "Content-Type")))
+ 	(if ret
+ 	    (mime-entity-set-content-type-internal
+-	     entity (mime-parse-Content-Type ret))
+-	  ))))
++	     entity (mime-parse-Content-Type ret))))))
+ 
+ (defun mime-entity-content-disposition (entity)
+   "Return content-disposition of ENTITY."
+@@ -282,8 +277,7 @@
+       (let ((ret (mime-entity-fetch-field entity "Content-Disposition")))
+ 	(if ret
+ 	    (mime-entity-set-content-disposition-internal
+-	     entity (mime-parse-Content-Disposition ret))
+-	  ))))
++	     entity (mime-parse-Content-Disposition ret))))))
+ 
+ (defun mime-entity-encoding (entity &optional default-encoding)
+   "Return content-transfer-encoding of ENTITY.
+@@ -295,8 +289,7 @@
+ 	(mime-entity-set-encoding-internal
+ 	 entity
+ 	 (or (and ret (mime-parse-Content-Transfer-Encoding ret))
+-	     default-encoding "7bit"))
+-	)))
++	     default-encoding "7bit")))))
+ 
+ (defvar mime-field-parser-alist
+   '((Return-Path	. std11-parse-route-addr)
+@@ -324,8 +317,7 @@
+     (In-Reply-To	. std11-parse-msg-ids)
+     (References		. std11-parse-msg-ids)
+     
+-    (Content-Id		. mime-parse-msg-id)
+-    ))
++    (Content-Id		. mime-parse-msg-id)))
+ 
+ (defun mime-entity-read-field (entity field-name)
+   (let ((sym (if (symbolp field-name)
+@@ -334,14 +326,11 @@
+ 		   (setq field-name (symbol-name field-name)))
+ 	       (intern (capitalize field-name)))))
+     (cond ((eq sym 'Content-Type)
+-	   (mime-entity-content-type entity)
+-	   )
++	   (mime-entity-content-type entity))
+ 	  ((eq sym 'Content-Disposition)
+-	   (mime-entity-content-disposition entity)
+-	   )
++	   (mime-entity-content-disposition entity))
+ 	  ((eq sym 'Content-Transfer-Encoding)
+-	   (mime-entity-encoding entity)
+-	   )
++	   (mime-entity-encoding entity))
+ 	  (t
+ 	   (let* ((header (mime-entity-parsed-header-internal entity))
+ 		  (field (cdr (assq sym header))))
+@@ -355,8 +344,7 @@
+ 			   (if parser
+ 			       (funcall parser
+ 					(eword-lexical-analyze field-body))
+-			     (mime-decode-field-body field-body sym 'plain)
+-			     ))
++			     (mime-decode-field-body field-body sym 'plain)))
+ 		     (mime-entity-set-parsed-header-internal
+ 		      entity (put-alist sym field header))
+ 		     field))))))))
+@@ -385,22 +373,20 @@
+ 	(mime-insert-entity-body entity)
+ 	(if (re-search-forward "^begin [0-9]+ " nil t)
+ 	    (if (looking-at ".+$")
+-		(buffer-substring (match-beginning 0)(match-end 0))
+-	      )))))
++		(buffer-substring (match-beginning 0)(match-end 0)))))))
+ 
+ (defun mime-entity-filename (entity)
+   "Return filename of ENTITY."
+   (or (mime-entity-uu-filename entity)
+-      (let ((ret (mime-content-disposition-filename
+-		  (mime-entity-content-disposition entity))))
+-	(if (and mime-header-accept-quoted-encoded-words
+-		 ret)
++      (let ((ret (or (mime-content-disposition-filename
++		      (mime-entity-content-disposition entity))
++		     (cdr (let ((param (mime-content-type-parameters
++					(mime-entity-content-type entity))))
++			    (or (assoc "name" param)
++				(assoc "x-name" param)))))))
++	(if ret
+ 	    (eword-decode-string ret)
+-	  ret))
+-      (cdr (let ((param (mime-content-type-parameters
+-			 (mime-entity-content-type entity))))
+-	     (or (assoc "name" param)
+-		 (assoc "x-name" param))))))
++	  ""))))
+ 
+ 
+ (defsubst mime-entity-media-type (entity)
diff --git a/flim/patches/patch-mmbuffer.el b/flim/patches/patch-mmbuffer.el
new file mode 100644
index 0000000000..a0b021788e
--- /dev/null
+++ b/flim/patches/patch-mmbuffer.el
@@ -0,0 +1,187 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mmbuffer.el	2005-07-06 11:09:04.000000000 +0900
++++ ././mmbuffer.el	2020-09-05 16:02:39.901364499 +0900
+@@ -1,4 +1,4 @@
+-;;; mmbuffer.el --- MIME entity module for binary buffer
++;;; mmbuffer.el --- MIME entity module for binary buffer  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1998,1999,2000 Free Software Foundation, Inc.
+ 
+@@ -35,16 +35,14 @@
+ 		      body-start
+ 		      body-end))
+ 
+-  (luna-define-internal-accessors 'mime-buffer-entity)
+-  )
++  (luna-define-internal-accessors 'mime-buffer-entity))
+ 
+ (luna-define-method initialize-instance :after ((entity mime-buffer-entity)
+-						&rest init-args)
++						&rest _init-args)
+   (or (mime-buffer-entity-buffer-internal entity)
+       (mime-buffer-entity-set-buffer-internal
+        entity (get-buffer (mime-entity-location-internal entity))))
+-  (save-excursion
+-    (set-buffer (mime-buffer-entity-buffer-internal entity))
++  (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+     (let ((header-start
+ 	   (or (mime-buffer-entity-header-start-internal entity)
+ 	       (mime-buffer-entity-set-header-start-internal
+@@ -64,8 +62,7 @@
+ 	  (setq header-end (point-min)
+ 		body-start (point-min)))
+ 	(mime-buffer-entity-set-header-end-internal entity header-end)
+-	(mime-buffer-entity-set-body-start-internal entity body-start)
+-	)
++	(mime-buffer-entity-set-body-start-internal entity body-start))
+       (or (mime-entity-content-type-internal entity)
+ 	  (save-restriction
+ 	    (narrow-to-region header-start header-end)
+@@ -73,15 +70,11 @@
+ 	     entity
+ 	     (let ((str (std11-fetch-field "Content-Type")))
+ 	       (if str
+-		   (mime-parse-Content-Type str)
+-		 )))
+-	    ))
+-      ))
++		   (mime-parse-Content-Type str))))))))
+   entity)
+ 
+ (luna-define-method mime-entity-name ((entity mime-buffer-entity))
+-  (buffer-name (mime-buffer-entity-buffer-internal entity))
+-  )
++  (buffer-name (mime-buffer-entity-buffer-internal entity)))
+ 
+ 
+ ;;; @ entity
+@@ -90,12 +83,10 @@
+ (luna-define-method mime-insert-entity ((entity mime-buffer-entity))
+   (insert-buffer-substring (mime-buffer-entity-buffer-internal entity)
+ 			   (mime-buffer-entity-header-start-internal entity)
+-			   (mime-buffer-entity-body-end-internal entity))
+-  )
++			   (mime-buffer-entity-body-end-internal entity)))
+ 
+ (luna-define-method mime-write-entity ((entity mime-buffer-entity) filename)
+-  (save-excursion
+-    (set-buffer (mime-buffer-entity-buffer-internal entity))
++  (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+     (let ((coding-system-for-write 'raw-text-dos))
+       (write-region (mime-buffer-entity-header-start-internal entity)
+ 		    (mime-buffer-entity-body-end-internal entity)
+@@ -110,21 +101,18 @@
+ ;;;
+ 
+ (luna-define-method mime-entity-body ((entity mime-buffer-entity))
+-  (save-excursion
+-    (set-buffer (mime-buffer-entity-buffer-internal entity))
++  (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+     (buffer-substring (mime-buffer-entity-body-start-internal entity)
+ 		      (mime-buffer-entity-body-end-internal entity))))
+ 
+ (luna-define-method mime-insert-entity-body ((entity mime-buffer-entity))
+   (insert-buffer-substring (mime-buffer-entity-buffer-internal entity)
+ 			   (mime-buffer-entity-body-start-internal entity)
+-			   (mime-buffer-entity-body-end-internal entity))
+-  )
++			   (mime-buffer-entity-body-end-internal entity)))
+ 
+ (luna-define-method mime-write-entity-body ((entity mime-buffer-entity)
+ 					    filename)
+-  (save-excursion
+-    (set-buffer (mime-buffer-entity-buffer-internal entity))
++  (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+     (binary-write-decoded-region
+      (mime-buffer-entity-body-start-internal entity)
+      (mime-buffer-entity-body-end-internal entity)
+@@ -135,8 +123,7 @@
+ ;;;
+ 
+ (luna-define-method mime-entity-content ((entity mime-buffer-entity))
+-  (save-excursion
+-    (set-buffer (mime-buffer-entity-buffer-internal entity))
++  (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+     (mime-decode-string
+      (buffer-substring (mime-buffer-entity-body-start-internal entity)
+ 		       (mime-buffer-entity-body-end-internal entity))
+@@ -151,13 +138,11 @@
+ 
+ (luna-define-method mime-write-entity-content ((entity mime-buffer-entity)
+ 					       filename)
+-  (save-excursion
+-    (set-buffer (mime-buffer-entity-buffer-internal entity))
++  (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+     (mime-write-decoded-region (mime-buffer-entity-body-start-internal entity)
+ 			       (mime-buffer-entity-body-end-internal entity)
+ 			       filename
+-			       (or (mime-entity-encoding entity) "7bit"))
+-    ))
++			       (or (mime-entity-encoding entity) "7bit"))))
+ 
+ 
+ ;;; @ header field
+@@ -166,8 +151,7 @@
+ (luna-define-method mime-entity-fetch-field :around
+   ((entity mime-buffer-entity) field-name)
+   (or (luna-call-next-method)
+-      (save-excursion
+-	(set-buffer (mime-buffer-entity-buffer-internal entity))
++      (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+ 	(save-restriction
+ 	  (narrow-to-region (mime-buffer-entity-header-start-internal entity)
+ 			    (mime-buffer-entity-header-end-internal entity))
+@@ -188,8 +172,7 @@
+    (mime-buffer-entity-buffer-internal entity)
+    (mime-buffer-entity-header-start-internal entity)
+    (mime-buffer-entity-header-end-internal entity)
+-   invisible-fields visible-fields)
+-  )
++   invisible-fields visible-fields))
+ 
+ 
+ ;;; @ header buffer
+@@ -275,8 +258,7 @@
+ 	   (dc-ctl
+ 	    (if (eq (mime-content-type-subtype content-type) 'digest)
+ 		(make-mime-content-type 'message 'rfc822)
+-	      (make-mime-content-type 'text 'plain)
+-	      ))
++	      (make-mime-content-type 'text 'plain)))
+ 	   (body-start (mime-buffer-entity-body-start-internal entity))
+ 	   (body-end (mime-buffer-entity-body-end-internal entity)))
+       (save-restriction
+@@ -299,25 +281,20 @@
+ 		(save-restriction
+ 		  (narrow-to-region cb ce)
+ 		  (setq ret (mime-parse-message representation-type dc-ctl
+-						entity (cons i node-id)))
+-		  )
++						entity (cons i node-id))))
+ 		(setq children (cons ret children))
+ 		(goto-char (setq cb ncb))
+-		(setq i (1+ i))
+-		)
++		(setq i (1+ i)))
+ 	      (setq ce (point-max))
+ 	      (save-restriction
+ 		(narrow-to-region cb ce)
+ 		(setq ret (mime-parse-message representation-type dc-ctl
+-					      entity (cons i node-id)))
+-		)
++					      entity (cons i node-id))))
+ 	      (setq children (cons ret children))
+-	      (mime-entity-set-children-internal entity (nreverse children))
+-	      )
++	      (mime-entity-set-children-internal entity (nreverse children)))
+ 	  (mime-entity-set-content-type-internal
+ 	   entity (make-mime-content-type 'message 'x-broken))
+-	  nil)
+-	))))
++	  nil)))))
+ 
+ (defun mmbuffer-parse-encapsulated (entity &optional external
+ 					   representation-type)
diff --git a/flim/patches/patch-mmcooked.el b/flim/patches/patch-mmcooked.el
new file mode 100644
index 0000000000..9e6eb54720
--- /dev/null
+++ b/flim/patches/patch-mmcooked.el
@@ -0,0 +1,76 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mmcooked.el	2005-07-06 11:09:05.000000000 +0900
++++ ././mmcooked.el	2020-09-05 16:02:39.901426573 +0900
+@@ -1,4 +1,4 @@
+-;;; mmcooked.el --- MIME entity implementation for binary buffer
++;;; mmcooked.el --- MIME entity implementation for binary buffer  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1998,1999 Free Software Foundation, Inc.
+ 
+@@ -28,11 +28,10 @@
+ 
+ (mm-define-backend cooked (buffer))
+ 
+-(mm-define-method entity-cooked-p ((entity cooked)) t)
++(mm-define-method entity-cooked-p ((_entity cooked)) t)
+ 
+ (mm-define-method write-entity-content ((entity cooked) filename)
+-  (save-excursion
+-    (set-buffer (mime-buffer-entity-buffer-internal entity))
++  (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+     (let ((encoding (or (mime-entity-encoding entity) "7bit")))
+       (if (member encoding '("7bit" "8bit" "binary"))
+ 	  (write-region (mime-buffer-entity-body-start-internal entity)
+@@ -40,24 +39,19 @@
+ 	(mime-write-decoded-region
+ 	 (mime-buffer-entity-body-start-internal entity)
+ 	 (mime-buffer-entity-body-end-internal entity)
+-	 filename encoding)
+-	))))
++	 filename encoding)))))
+ 
+ (mm-define-method write-entity ((entity cooked) filename)
+-  (save-excursion
+-    (set-buffer (mime-buffer-entity-buffer-internal entity))
++  (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+     (write-region (mime-buffer-entity-header-start-internal entity)
+ 		  (mime-buffer-entity-body-end-internal entity)
+-		  filename)
+-    ))
++		  filename)))
+ 
+ (mm-define-method write-entity-body ((entity cooked) filename)
+-  (save-excursion
+-    (set-buffer (mime-buffer-entity-buffer-internal entity))
++  (with-current-buffer (mime-buffer-entity-buffer-internal entity)
+     (write-region (mime-buffer-entity-body-start-internal entity)
+ 		  (mime-buffer-entity-body-end-internal entity)
+-		  filename)
+-    ))
++		  filename)))
+ 
+ (luna-define-method mime-insert-header ((entity mime-cooked-entity)
+ 					&optional invisible-fields
+@@ -66,8 +60,7 @@
+     (funcall (car (luna-class-find-functions
+ 		   (luna-find-class 'mime-buffer-entity)
+ 		   'mime-insert-header))
+-	     entity invisible-fields visible-fields)
+-    ))
++	     entity invisible-fields visible-fields)))
+ 
+ (mm-define-method insert-text-content ((entity cooked))
+   (let ((str (mime-entity-content entity)))
+@@ -80,8 +73,7 @@
+ 					(mime-entity-content-type entity)
+ 					"charset")
+ 				       default-mime-charset)
+-				   'CRLF)
+-       ))))
++				   'CRLF)))))
+ 
+ 
+ ;;; @ end
diff --git a/flim/patches/patch-mmexternal.el b/flim/patches/patch-mmexternal.el
new file mode 100644
index 0000000000..2f24f84d53
--- /dev/null
+++ b/flim/patches/patch-mmexternal.el
@@ -0,0 +1,12 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mmexternal.el	2005-07-06 11:09:05.000000000 +0900
++++ ././mmexternal.el	2020-09-05 16:02:39.901504841 +0900
+@@ -1,4 +1,4 @@
+-;;; mmexternal.el --- MIME entity module for external buffer
++;;; mmexternal.el --- MIME entity module for external buffer  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1998,1999,2000 Free Software Foundation, Inc.
+ 
diff --git a/flim/patches/patch-mmgeneric.el b/flim/patches/patch-mmgeneric.el
new file mode 100644
index 0000000000..6079050e4a
--- /dev/null
+++ b/flim/patches/patch-mmgeneric.el
@@ -0,0 +1,105 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./mmgeneric.el	2005-07-06 11:09:05.000000000 +0900
++++ ././mmgeneric.el	2020-09-05 16:02:39.901580357 +0900
+@@ -1,4 +1,4 @@
+-;;; mmgeneric.el --- MIME generic entity module
++;;; mmgeneric.el --- MIME generic entity module  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc.
+ 
+@@ -50,8 +50,7 @@
+ 		      ;; for other fields
+ 		      original-header parsed-header))
+ 
+-  (luna-define-internal-accessors 'mime-entity)
+-  )
++  (luna-define-internal-accessors 'mime-entity))
+ 
+ (defalias 'mime-entity-representation-type-internal 'luna-class-name)
+ (defalias 'mime-entity-set-representation-type-internal 'luna-set-class-name)
+@@ -70,8 +69,7 @@
+ 				    (mime-entity-content-type entity)
+ 				    "charset")
+ 				   default-mime-charset)
+-			       'CRLF)
+-   ))
++			       'CRLF)))
+ 
+ 
+ ;;; @ for mm-backend
+@@ -83,8 +81,7 @@
+ (defmacro mm-define-backend (type &optional parents)
+   `(luna-define-class ,(mm-expand-class-name type)
+ 		      ,(nconc (mapcar (lambda (parent)
+-					(mm-expand-class-name parent)
+-					)
++					(mm-expand-class-name parent))
+ 				      parents)
+ 			      '(mime-entity))))
+ 
+@@ -96,8 +93,7 @@
+ 	  (cons (list (car spec)
+ 		      (mm-expand-class-name (nth 1 spec)))
+ 		(cdr args)))
+-    `(luna-define-method ,name ,args ,@body)
+-    ))
++    `(luna-define-method ,name ,args ,@body)))
+ 
+ (put 'mm-define-method 'lisp-indent-function 'defun)
+ 
+@@ -105,8 +101,7 @@
+   (&define name ((arg symbolp)
+ 		 [&rest arg]
+ 		 [&optional ["&optional" arg &rest arg]]
+-		 &optional ["&rest" arg]
+-		 )
++		 &optional ["&rest" arg])
+ 	   def-body))
+ 
+ 
+@@ -121,18 +116,14 @@
+ 	(while visible-fields
+ 	  (let ((regexp (car visible-fields)))
+ 	    (if (string-match regexp field-name)
+-		(throw 'found t)
+-	      ))
+-	  (setq visible-fields (cdr visible-fields))
+-	  ))
++		(throw 'found t)))
++	  (setq visible-fields (cdr visible-fields))))
+       (catch 'found
+ 	(while invisible-fields
+ 	  (let ((regexp (car invisible-fields)))
+ 	    (if (string-match regexp field-name)
+-		(throw 'found nil)
+-	      ))
+-	  (setq invisible-fields (cdr invisible-fields))
+-	  )
++		(throw 'found nil)))
++	  (setq invisible-fields (cdr invisible-fields)))
+ 	t)))
+ 
+ (defun mime-insert-header-from-buffer (buffer start end
+@@ -142,8 +133,7 @@
+ 	(mode-obj (mime-find-field-presentation-method 'wide))
+ 	field-decoder
+ 	f-b p f-e field-name len field field-body)
+-    (save-excursion
+-      (set-buffer buffer)
++    (with-current-buffer buffer
+       (save-restriction
+ 	(narrow-to-region start end)
+ 	(goto-char start)
+@@ -166,8 +156,7 @@
+ 			  (funcall field-decoder field-body len)
+ 			;; Don't decode
+ 			field-body))
+-	      (insert "\n")
+-	      )))))))
++	      (insert "\n"))))))))
+ 
+ 
+ ;;; @ end
diff --git a/flim/patches/patch-qmtp.el b/flim/patches/patch-qmtp.el
new file mode 100644
index 0000000000..5d050ce297
--- /dev/null
+++ b/flim/patches/patch-qmtp.el
@@ -0,0 +1,30 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./qmtp.el	2005-07-06 11:09:05.000000000 +0900
++++ ././qmtp.el	2020-09-05 16:02:39.901653957 +0900
+@@ -1,4 +1,4 @@
+-;;; qmtp.el --- basic functions to send mail with QMTP server
++;;; qmtp.el --- basic functions to send mail with QMTP server  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 2000 Free Software Foundation, Inc.
+ 
+@@ -112,14 +112,12 @@
+ 	t)
+     (error)))
+ 
+-(make-obsolete 'qmtp-via-qmtp "It's old API.")
++(make-obsolete 'qmtp-via-qmtp "It's old API." "05 Nov 2000")
+ 
+ ;;;###autoload
+ (defun qmtp-send-buffer (sender recipients buffer)
+-  (save-excursion
+-    (set-buffer
+-     (get-buffer-create
+-      (format "*trace of QMTP session to %s*" qmtp-server)))
++  (with-current-buffer (get-buffer-create
++			(format "*trace of QMTP session to %s*" qmtp-server))
+     (buffer-disable-undo)
+     (erase-buffer)
+     (make-local-variable 'qmtp-read-point)
diff --git a/flim/patches/patch-sasl-cram.el b/flim/patches/patch-sasl-cram.el
new file mode 100644
index 0000000000..433bfc60d6
--- /dev/null
+++ b/flim/patches/patch-sasl-cram.el
@@ -0,0 +1,20 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./sasl-cram.el	2005-07-06 11:09:05.000000000 +0900
++++ ././sasl-cram.el	2020-09-05 16:02:39.901715405 +0900
+@@ -1,4 +1,4 @@
+-;;; sasl-cram.el --- CRAM-MD5 module for the SASL client framework
++;;; sasl-cram.el --- CRAM-MD5 module for the SASL client framework  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 2000 Free Software Foundation, Inc.
+ 
+@@ -27,6 +27,7 @@
+ 
+ (require 'sasl)
+ (require 'hmac-md5)
++(require 'hex-util)
+ 
+ (defconst sasl-cram-md5-steps
+   '(ignore				;no initial response
diff --git a/flim/patches/patch-sasl-digest.el b/flim/patches/patch-sasl-digest.el
new file mode 100644
index 0000000000..11b1e810eb
--- /dev/null
+++ b/flim/patches/patch-sasl-digest.el
@@ -0,0 +1,20 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./sasl-digest.el	2005-07-06 11:09:05.000000000 +0900
++++ ././sasl-digest.el	2020-09-05 16:02:39.901792159 +0900
+@@ -1,4 +1,4 @@
+-;;; sasl-digest.el --- DIGEST-MD5 module for the SASL client framework
++;;; sasl-digest.el --- DIGEST-MD5 module for the SASL client framework  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 2000 Free Software Foundation, Inc.
+ 
+@@ -34,6 +34,7 @@
+ 
+ (require 'sasl)
+ (require 'hmac-md5)
++(require 'hex-util)
+ 
+ (defvar sasl-digest-md5-nonce-count 1)
+ (defvar sasl-digest-md5-unique-id-function
diff --git a/flim/patches/patch-sasl-scram.el b/flim/patches/patch-sasl-scram.el
new file mode 100644
index 0000000000..76cfee132b
--- /dev/null
+++ b/flim/patches/patch-sasl-scram.el
@@ -0,0 +1,21 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./sasl-scram.el	2005-07-06 11:09:05.000000000 +0900
++++ ././sasl-scram.el	2020-09-05 16:02:39.901895077 +0900
+@@ -1,4 +1,4 @@
+-;;; sasl-scram.el --- Compute SCRAM-MD5.
++;;; sasl-scram.el --- Compute SCRAM-MD5.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1999 Shuhei KOBAYASHI
+ 
+@@ -204,7 +204,7 @@
+       (fillarray server-salt 0)
+       (fillarray buff 0))))
+ 
+-(defun sasl-scram-md5-response-1 (client step)
++(defun sasl-scram-md5-response-1 (client _step)
+   (sasl-client-set-property
+    client 'client-msg-1
+    (sasl-scram-md5-make-client-msg-1
diff --git a/flim/patches/patch-sasl-xoauth2.el b/flim/patches/patch-sasl-xoauth2.el
new file mode 100644
index 0000000000..0c099beb10
--- /dev/null
+++ b/flim/patches/patch-sasl-xoauth2.el
@@ -0,0 +1,255 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./sasl-xoauth2.el	1970-01-01 09:00:00.000000000 +0900
++++ ././sasl-xoauth2.el	2020-09-05 16:02:39.901994104 +0900
+@@ -0,0 +1,248 @@
++;;; sasl-xoauth2.el --- OAuth 2.0 module for the SASL client framework  -*- lexical-binding: t -*-
++
++;; Copyright (C) 2018 Kazuhiro Ito
++
++;; Author: Kazuhiro Ito <kzhr%d1.dion.ne.jp@localhost>
++;; Keywords: SASL, OAuth 2.0
++;; Version: 1.00
++;; Created: January 2018
++
++;; This program is free software; you can redistribute it and/or modify
++;; it under the terms of the GNU General Public License as published by
++;; the Free Software Foundation; either version 3, or (at your option)
++;; any later version.
++;;
++;; This program is distributed in the hope that it will be useful,
++;; but WITHOUT ANY WARRANTY; without even the implied warranty of
++;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++;; GNU General Public License for more details.
++;;
++;; You should have received a copy of the GNU General Public License
++;; along with this program; see the file COPYING.  If not, write to the
++;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++;; Boston, MA 02110-1301, USA.
++
++;;; Commentary:
++
++;; This is a SASL interface layer for OAuth 2.0 authorization message.
++
++;;; Requirements:
++;;
++;; * oauth2.el
++;; https://elpa.gnu.org/packages/oauth2.html
++
++;;; Usage
++;;
++;; 1. Set up sasl-xoauth2-host-url-table and
++;; sasl-xoauth2-host-user-id-table variables.
++;;
++;; 2. When passphrase is asked, input client secret.
++
++;;; Code:
++
++(require 'sasl)
++(require 'oauth2)
++
++(defconst sasl-xoauth2-steps
++  '(sasl-xoauth2-response))
++
++(defgroup sasl-xoauth2 nil
++  "SASL interface layer for OAuth 2.0 authorization message."
++  :group 'mail)
++
++(defcustom sasl-xoauth2-token-directory
++  (expand-file-name "sasl-xoauth2" user-emacs-directory)
++  "Directory name to store OAuth 2.0 tokens."
++  :type 'directory
++  :group 'sasl-xoauth2)
++
++(defcustom sasl-xoauth2-refresh-token-threshold 60
++  "Refresh token if expiration limit is left less than specified seconds."
++  :type 'number
++  :group 'sasl-xoauth2)
++
++(defcustom sasl-xoauth2-host-url-table
++  '(;; Gmail
++    ("gmail\\.com$"
++     "https://accounts.google.com/o/oauth2/v2/auth";
++     "https://www.googleapis.com/oauth2/v4/token";
++     "https://mail.google.com/";
++     nil)
++    ;; Outlook.com
++    ("outlook\\.com$"
++     "https://login.live.com/oauth20_authorize.srf";
++     "https://login.live.com/oauth20_token.srf";
++     "wl.offline_access wl.imap"
++     ;; You need register redirect URL at Application Registration Portal
++     ;; https://apps.dev.microsoft.com/
++     "http://localhost/result";))
++  "List of OAuth 2.0 URLs.  Each element of list is regexp for host, auth-url, token-url, scope and redirect-uri (optional)."
++      :type '(repeat (list
++		      (regexp :tag "Regexp for Host")
++		      (string :tag "Auth-URL")
++		      (string :tag "Token-URL")
++		      (string :tag "Scope")
++		      (choice string (const :tag "none" nil))))
++      :group 'sasl-xoauth2)
++
++(defcustom sasl-xoauth2-host-user-id-table
++  nil
++  "List of OAuth 2.0 Client IDs.  Each element of list is regexp for host, regexp for User ID, client ID and client secret (optional).
++Below is example to use Thunderbird's client ID and secret (not recommended, just an expample).
++
++(setq sasl-xoauth2-host-user-id-table
++      '((\"\\\\.gmail\\\\.com$\"
++	 \".\"
++	 \"91623021742-ud877vhta8ch9llegih22bc7er6589ar.apps.googleusercontent.com\"
++	 \"iBn5rLbhbm_qoPbdGkgX81Dj\"))
++"
++  :type '(repeat (list
++		  (regexp :tag "Regexp for Host")
++		  (regexp :tag "Regexp for User ID")
++		  (string :tag "Client ID")
++		  (choice :tag "Client Secret"
++			  string
++			  (const :tag "none" nil))))
++  :group 'sasl-xoauth2)
++
++
++;; This advice makes oauth2.el to keep the time of getting token.
++(defadvice oauth2-make-access-request (after sasl-xoauth2 disable)
++  (setq ad-return-value (cons `(auth_time . ,(current-time))
++			      ad-return-value)))
++
++;; Modified version of oauth2-refresh-access.  It keeps refreshed time
++;; and updates expires_in parameter.
++(defun sasl-xoauth2-refresh-access (token)
++  "Refresh OAuth access TOKEN.
++TOKEN should be obtained with `oauth2-request-access'."
++  (let ((response
++	 (oauth2-make-access-request
++          (oauth2-token-token-url token)
++          (concat "client_id=" (oauth2-token-client-id token)
++                  "&client_secret=" (oauth2-token-client-secret token)
++                  "&refresh_token=" (oauth2-token-refresh-token token)
++                  "&grant_type=refresh_token"))))
++    (setf (oauth2-token-access-token token)
++          (cdr (assq 'access_token response)))
++    ;; Update authorization time.
++    (setcdr (assq 'auth_time (oauth2-token-access-response token))
++	    (current-time))
++    ;; Update expires_in parameter.
++    (cond
++     ((and (assq 'expires_in (oauth2-token-access-response token))
++	   (assq 'expires_in response))
++      (setcdr (assq 'expires_in (oauth2-token-access-response token))
++	      (cdr (assq 'expires_in response))))
++     ((assq 'expires_in (oauth2-token-access-response token))
++      (let ((list (memq (assq 'expires_in (oauth2-token-access-response token))
++			(oauth2-token-access-response token))))
++	(setcdr list (cdr list))))
++     ((assq 'expires_in response)
++      (setf (oauth2-token-access-response token)
++	    (cons (assq 'expires_in response)
++		  (oauth2-token-access-response token))))))
++  ;; If the token has a plstore, update it
++  (let ((plstore (oauth2-token-plstore token)))
++    (when plstore
++      (plstore-put plstore (oauth2-token-plstore-id token)
++                   nil `(:access-token
++                         ,(oauth2-token-access-token token)
++                         :refresh-token
++                         ,(oauth2-token-refresh-token token)
++                         :access-response
++                         ,(oauth2-token-access-response token)))
++      (plstore-save plstore)))
++  token)
++
++(defun sasl-xoauth2-resolve-urls (host user)
++  (let (auth-url token-url client-id scope redirect-uri client-secret)
++    (let ((table sasl-xoauth2-host-url-table))
++      (while table
++	(when (string-match (caar table) host)
++	  (setq auth-url  (nth 1 (car table))
++		token-url (nth 2 (car table))
++		scope     (nth 3 (car table))
++		redirect-uri (nth 4 (car table))
++		table nil))
++	(setq table (cdr table))))
++    (let ((table sasl-xoauth2-host-user-id-table))
++      (while table
++	(when (and (string-match (caar table) host)
++		   (string-match (nth 1 (car table)) user))
++	  (setq client-id (nth 2 (car table))
++		client-secret (nth 3 (car table))
++		table nil))
++	(setq table (cdr table))))
++    (list auth-url token-url scope client-id client-secret redirect-uri)))
++
++(defun sasl-xoauth2-token-expired-p (token)
++  (let ((access-response (oauth2-token-access-response token)))
++    (or (null (assq 'expires_in access-response))
++	(time-less-p
++	 (time-add (cdr (assq 'auth_time access-response))
++		   (cdr (assq 'expires_in access-response)))
++	 (time-add (current-time)
++		   (- sasl-xoauth2-refresh-token-threshold))))))
++
++(defun sasl-xoauth2-response (client _step &optional _retry)
++  (let ((host (sasl-client-server client))
++	(user (sasl-client-name client))
++	info access-token oauth2-token
++	auth-url token-url client-id scope redirect-uri client-secret)
++    (setq info (sasl-xoauth2-resolve-urls host user)
++	  auth-url
++	  (or (car info)
++	      (read-string (format "Input OAuth 2.0 AUTH-URL for %s: " host)))
++	  token-url
++	  (or (nth 1 info)
++	      (read-string (format "Input OAuth 2.0 TOKEN-URL for %s: " host)))
++	  scope
++	  (or (nth 2 info)
++	      (read-string (format "Input OAuth 2.0 SCOPE for %s: " host)))
++	  client-id
++	  (or (nth 3 info)
++	      (read-string
++	       (format "Input OAuth 2.0 CLIENT-ID for %s@%s: " user host)
++	       user nil user))
++	  client-secret
++	  (or (nth 4 info)
++	      (sasl-read-passphrase
++	       (format "Input Oauth 2.0 CLIENT-SECRET for %s@%s: " user host)))
++	  redirect-uri
++	  (or (nth 5 info)
++	      ;; Do not ask when sasl-xoauth2-host-url-table is
++	      ;; matched.
++	      (unless (car info)
++		(read-string
++		 (format "Input OAuth 2.0 Redirect-URI for %s: " host)))))
++    (setq oauth2-token
++	  (let ((oauth2-token-file
++		 (expand-file-name (concat
++				    (md5 (concat
++					  client-id
++					  client-secret
++					  (sasl-client-name client)))
++				    ".plstore")
++				   sasl-xoauth2-token-directory)))
++	    (ad-enable-advice 'oauth2-make-access-request 'after 'sasl-xoauth2)
++	    (ad-activate 'oauth2-make-access-request)
++	    (prog1
++		(oauth2-auth-and-store
++		 auth-url token-url scope client-id client-secret redirect-uri)
++	      (ad-disable-advice 'oauth2-make-access-request
++				 'after 'sasl-xoauth2)
++	      (ad-activate 'oauth2-make-access-request))))
++    (when (sasl-xoauth2-token-expired-p oauth2-token)
++      (setq oauth2-token (sasl-xoauth2-refresh-access oauth2-token)))
++    (setq access-token (oauth2-token-access-token oauth2-token))
++    (format "user=%s\001auth=Bearer %s\001\001"
++	    (sasl-client-name client)
++	    access-token)))
++
++(put 'sasl-xoauth2 'sasl-mechanism
++     (sasl-make-mechanism "XOAUTH2" sasl-xoauth2-steps))
++
++(provide 'sasl-xoauth2)
++
++;;; sasl-xoauth2.el ends here
diff --git a/flim/patches/patch-sasl.el b/flim/patches/patch-sasl.el
new file mode 100644
index 0000000000..1d9a3a2d0d
--- /dev/null
+++ b/flim/patches/patch-sasl.el
@@ -0,0 +1,94 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./sasl.el	2005-07-06 11:09:05.000000000 +0900
++++ ././sasl.el	2020-09-05 16:02:39.902101886 +0900
+@@ -1,4 +1,4 @@
+-;;; sasl.el --- SASL client framework
++;;; sasl.el --- SASL client framework  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 2000 Free Software Foundation, Inc.
+ 
+@@ -36,18 +36,30 @@
+ 
+ ;;; Code:
+ 
+-(defvar sasl-mechanisms
+-  '("CRAM-MD5" "DIGEST-MD5" "PLAIN" "LOGIN" "ANONYMOUS"
+-    "NTLM" "SCRAM-MD5"))
++(defvar sasl-additional-mechanism-alist
++  '((sasl-scram-rfc "SCRAM-SHA-1")
++    (sasl-scram-sha256 "SCRAM-SHA-256")))
+ 
+ (defvar sasl-mechanism-alist
+-  '(("CRAM-MD5" sasl-cram)
+-    ("DIGEST-MD5" sasl-digest)
+-    ("PLAIN" sasl-plain)
+-    ("LOGIN" sasl-login)
+-    ("ANONYMOUS" sasl-anonymous)
+-    ("NTLM" sasl-ntlm)
+-    ("SCRAM-MD5" sasl-scram)))
++  (append '(("CRAM-MD5" sasl-cram)
++	    ("DIGEST-MD5" sasl-digest)
++	    ("PLAIN" sasl-plain)
++	    ("LOGIN" sasl-login)
++	    ("ANONYMOUS" sasl-anonymous)
++	    ("NTLM" sasl-ntlm)
++	    ("SCRAM-MD5" sasl-scram)
++	    ("OAUTHBEARER" sasl-xoauth2)
++	    ("XOAUTH2" sasl-xoauth2))
++	  (let (result)
++	    (mapc (lambda (elt)
++		    (when (locate-library (symbol-name (car elt)))
++		      (dolist (name (cdr elt))
++			(setq result (cons (list name (car elt)) result)))))
++		  sasl-additional-mechanism-alist)
++	    result)))
++
++(defvar sasl-mechanisms
++  (mapcar 'car sasl-mechanism-alist))
+ 
+ (defvar sasl-unique-id-function #'sasl-unique-id-function)
+ 
+@@ -204,14 +216,13 @@
+ 	(= len 0))
+       ""
+     (concat (sasl-unique-id-number-base36 (/ num 36) (1- len))
+-	    (char-to-string (aref "zyxwvutsrqponmlkjihgfedcba9876543210"
+-				  (% num 36))))))
++	    (list (aref "zyxwvutsrqponmlkjihgfedcba9876543210" (% num 36))))))
+ 
+ ;;; PLAIN (RFC2595 Section 6)
+ (defconst sasl-plain-steps
+   '(sasl-plain-response))
+ 
+-(defun sasl-plain-response (client step)
++(defun sasl-plain-response (client _step)
+   (let ((passphrase
+ 	 (sasl-read-passphrase
+ 	  (format "PLAIN passphrase for %s: " (sasl-client-name client))))
+@@ -237,12 +248,12 @@
+     sasl-login-response-1
+     sasl-login-response-2))
+ 
+-(defun sasl-login-response-1 (client step)
++(defun sasl-login-response-1 (client _step)
+ ;;;  (unless (string-match "^Username:" (sasl-step-data step))
+ ;;;    (sasl-error (format "Unexpected response: %s" (sasl-step-data step))))
+   (sasl-client-name client))
+ 
+-(defun sasl-login-response-2 (client step)
++(defun sasl-login-response-2 (client _step)
+ ;;;  (unless (string-match "^Password:" (sasl-step-data step))
+ ;;;    (sasl-error (format "Unexpected response: %s" (sasl-step-data step))))
+   (sasl-read-passphrase
+@@ -258,7 +269,7 @@
+   '(ignore				;no initial response
+     sasl-anonymous-response))
+ 
+-(defun sasl-anonymous-response (client step)
++(defun sasl-anonymous-response (client _step)
+   (or (sasl-client-property client 'trace)
+       (sasl-client-name client)))
+ 
diff --git a/flim/patches/patch-sha1.el b/flim/patches/patch-sha1.el
new file mode 100644
index 0000000000..c4c160e36e
--- /dev/null
+++ b/flim/patches/patch-sha1.el
@@ -0,0 +1,40 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./sha1.el	2005-07-06 11:09:05.000000000 +0900
++++ ././sha1.el	2020-09-05 16:02:39.902173976 +0900
+@@ -1,4 +1,4 @@
+-;;; sha1.el --- SHA1 Secure Hash Algorithm.
++;;; sha1.el --- SHA1 Secure Hash Algorithm.  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1999, 2001  Free Software Foundation, Inc.
+ 
+@@ -38,26 +38,7 @@
+ 
+ ;;; Code:
+ 
+-(defvar sha1-dl-module
+-  (cond
+-   ((and (fboundp 'sha1)
+-	 (subrp (symbol-function 'sha1)))
+-    nil)
+-   ((fboundp 'dynamic-link)
+-    ;; Should we take care of `dynamic-link-path'?
+-    (let ((path (expand-file-name "sha1.so" exec-directory)))
+-      (if (file-exists-p path)
+-	  path
+-	nil)))
+-   (t
+-    nil)))
+-
+-(cond
+- ((and (stringp sha1-dl-module)
+-       (file-exists-p sha1-dl-module))
+-  (require 'sha1-dl))
+- (t
+-  (require 'sha1-el)))
++(defvar sha1-dl-module nil)
+ 
+ (provide 'sha1)
+ 
diff --git a/flim/patches/patch-smtp.el b/flim/patches/patch-smtp.el
new file mode 100644
index 0000000000..c6fc811944
--- /dev/null
+++ b/flim/patches/patch-smtp.el
@@ -0,0 +1,381 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./smtp.el	2006-09-24 09:40:58.000000000 +0900
++++ ././smtp.el	2020-09-05 16:02:39.902356053 +0900
+@@ -1,4 +1,4 @@
+-;;; smtp.el --- basic functions to send mail with SMTP server
++;;; smtp.el --- basic functions to send mail with SMTP server  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001 ,2002, 2004
+ ;; Free Software Foundation, Inc.
+@@ -79,7 +79,7 @@
+   :group 'smtp)
+ 
+ (defcustom smtp-fqdn nil
+-  "Fully qualified domain name used for Message-ID."
++  "Fully qualified domain name used for SMTP HELO/EHLO."
+   :type '(choice (const nil) string)
+   :group 'smtp)
+ 
+@@ -98,17 +98,15 @@
+   :type 'boolean
+   :group 'smtp-extensions)
+ 
+-(defcustom smtp-use-starttls-ignore-error nil
+-  "If non-nil, do not use STARTTLS if STARTTLS is not available."
++(defcustom smtp-use-gnutls (and (fboundp 'gnutls-available-p)
++				(gnutls-available-p))
++  "If non-nil, use built-in GnuTLS for STARTTLS."
+   :type 'boolean
+   :group 'smtp-extensions)
+ 
+-(defcustom smtp-starttls-program "starttls"
+-  "The program to run in a subprocess to open an TLSv1 connection."
+-  :group 'smtp-extensions)
+-
+-(defcustom smtp-starttls-extra-args nil
+-  "Extra arguments to `starttls-program'"
++(defcustom smtp-use-starttls-ignore-error nil
++  "If non-nil, do not use STARTTLS if STARTTLS is not available."
++  :type 'boolean
+   :group 'smtp-extensions)
+ 
+ (defcustom smtp-use-sasl nil
+@@ -186,8 +184,7 @@
+ 
+ (defun smtp-package-buffer-internal-size (package)
+   "Return the size of PACKAGE, an integer."
+-  (save-excursion
+-    (set-buffer (smtp-package-buffer-internal package))
++  (with-current-buffer (smtp-package-buffer-internal package)
+     (let ((size
+ 	   (+ (buffer-size)
+ 	      ;; Add one byte for each change-of-line
+@@ -245,14 +242,14 @@
+   "Return user's fully qualified domain name."
+   (if smtp-fqdn
+       smtp-fqdn
+-    (let ((system-name (system-name)))
++    (let ((name (system-name)))
+       (cond
+        (smtp-local-domain
+-	(concat system-name "." smtp-local-domain))
+-       ((string-match "[^.]\\.[^.]" system-name)
+-	system-name)
++	(concat name "." smtp-local-domain))
++       ((string-match "[^.]\\.[^.]" name)
++	name)
+        (t
+-	(error "Cannot generate valid FQDN"))))))
++	(error "invalid FQDN. Set smtp-fqdn or smtp-local-domain correctly"))))))
+ 
+ (defun smtp-find-connection (buffer)
+   "Find the connection delivering to BUFFER."
+@@ -268,7 +265,8 @@
+ 
+ (eval-and-compile
+   (autoload 'starttls-open-stream "starttls")
+-  (autoload 'starttls-negotiate "starttls"))
++  (autoload 'starttls-negotiate "starttls")
++  (autoload 'gnutls-negotiate "gnutls"))
+ 
+ (defun smtp-open-connection (buffer server service)
+   "Open a SMTP connection for a service to a host.
+@@ -276,9 +274,18 @@
+ BUFFER is the buffer to associate with the connection.  SERVER is name
+ of the host to connect to.  SERVICE is name of the service desired."
+   (let ((process
+-	 (binary-funcall smtp-open-connection-function
+-			 "SMTP" buffer server service))
++	 (binary-funcall
++	  (cond
++	   ((and smtp-use-starttls (null smtp-use-gnutls))
++	    'starttls-open-stream)
++	   (t
++	    smtp-open-connection-function))
++	  "SMTP" buffer server service))
+ 	connection)
++    (unless (and (processp process)
++		 (memq (process-status process) '(open run)))
++      (error "Open SMTP connection function to %s:%s failed"
++	     server (if (integerp service) (format "%d" service) service)))
+     (when process
+       (setq connection (smtp-make-connection process server service))
+       (set-process-filter process 'smtp-process-filter)
+@@ -341,7 +348,7 @@
+ 	t)
+     (smtp-error)))
+ 
+-(make-obsolete 'smtp-via-smtp "It's old API.")
++(make-obsolete 'smtp-via-smtp "It's old API." "02 Nov 2000")
+ 
+ ;;;###autoload
+ (defun smtp-send-buffer (sender recipients buffer)
+@@ -357,24 +364,22 @@
+ 	      (or smtp-server
+ 		  (error "`smtp-server' not defined"))))
+ 	   (package
+-	    (smtp-make-package sender recipients buffer))
+-	   (starttls-program smtp-starttls-program)
+-	   (starttls-extra-args smtp-starttls-extra-args)
+-	   (smtp-open-connection-function
+-	    (if smtp-use-starttls
+-		#'starttls-open-stream
+-	      smtp-open-connection-function)))
+-      (save-excursion
+-	(set-buffer
+-	 (get-buffer-create
+-	  (format "*trace of SMTP session to %s*" server)))
++	    (smtp-make-package sender recipients buffer)))
++      (with-current-buffer
++	  (setq buffer (get-buffer-create
++			(format "*trace of SMTP session to %s*" server)))
+ 	(erase-buffer)
+ 	(buffer-disable-undo)
+-	(unless (smtp-find-connection (current-buffer))
+-	  (smtp-open-connection (current-buffer) server smtp-service))
++	(unless (smtp-find-connection buffer)
++	  (smtp-open-connection buffer server smtp-service))
+ 	(make-local-variable 'smtp-read-point)
+ 	(setq smtp-read-point (point-min))
+-	(funcall smtp-submit-package-function package)))))
++	(funcall smtp-submit-package-function package)
++	(unless (or smtp-debug (smtp-find-connection buffer))
++	  (setq smtp-connection-alist
++		(delq (assq buffer smtp-connection-alist)
++		      smtp-connection-alist))
++	  (kill-buffer nil))))))
+ 
+ (defun smtp-submit-package (package)
+   (unwind-protect
+@@ -399,7 +404,7 @@
+ 	(smtp-primitive-rcptto package)
+ 	(smtp-primitive-data package))
+     (let ((connection (smtp-find-connection (current-buffer))))
+-      (when (smtp-connection-opened connection)
++      (when (and connection (smtp-connection-opened connection))
+ 	(condition-case nil
+ 	    (smtp-primitive-quit package)
+ 	  (smtp-error))
+@@ -412,10 +417,6 @@
+ BUFFER may be a buffer or a buffer name which contains mail message."
+   (let ((servers
+ 	 (smtp-find-server recipients))
+-	(smtp-open-connection-function
+-	 (if smtp-use-starttls
+-	     #'starttls-open-stream
+-	   smtp-open-connection-function))
+ 	server package)
+       (while (car servers)
+ 	(setq server (caar servers))
+@@ -426,25 +427,29 @@
+ 			   (mapconcat 'concat recipients ">,<"))))
+ 	(setq package
+ 	      (smtp-make-package sender recipients buffer))
+-	(save-excursion
+-	  (set-buffer
+-	   (get-buffer-create
+-	    (format "*trace of SMTP session to %s*" server)))
++	(with-current-buffer
++	    (setq buffer (get-buffer-create
++			  (format "*trace of SMTP session to %s*" server)))
+ 	  (erase-buffer)
+ 	  (buffer-disable-undo)
+-	  (unless (smtp-find-connection (current-buffer))
+-	    (smtp-open-connection (current-buffer) server smtp-service))
++	  (unless (smtp-find-connection buffer)
++	    (smtp-open-connection buffer server smtp-service))
+ 	  (make-local-variable 'smtp-read-point)
+ 	  (setq smtp-read-point (point-min))
+ 	  (let ((smtp-use-sasl nil)
+ 		(smtp-use-starttls-ignore-error t))
+-	    (funcall smtp-submit-package-function package)))
++	    (funcall smtp-submit-package-function package))
++	  (unless (or smtp-debug (smtp-find-connection buffer))
++	    (setq smtp-connection-alist
++		  (delq (assq buffer smtp-connection-alist)
++			smtp-connection-alist))
++	    (kill-buffer nil)))
+ 	(setq servers (cdr servers)))))
+ 
+ ;;; @ hook methods for `smtp-submit-package'
+ ;;;
+ 
+-(defun smtp-primitive-greeting (package)
++(defun smtp-primitive-greeting (_package)
+   (let* ((connection
+ 	  (smtp-find-connection (current-buffer)))
+ 	 (response
+@@ -452,7 +457,7 @@
+     (if (/= (car response) 220)
+ 	(smtp-response-error response))))
+ 
+-(defun smtp-primitive-ehlo (package)
++(defun smtp-primitive-ehlo (_package)
+   (let* ((connection
+ 	  (smtp-find-connection (current-buffer)))
+ 	 response)
+@@ -471,7 +476,7 @@
+ 		     extensions))
+ 		 (cdr response)))))
+ 
+-(defun smtp-primitive-helo (package)
++(defun smtp-primitive-helo (_package)
+   (let* ((connection
+ 	  (smtp-find-connection (current-buffer)))
+ 	 response)
+@@ -480,7 +485,7 @@
+     (if (/= (car response) 250)
+ 	(smtp-response-error response))))
+ 
+-(defun smtp-primitive-auth (package)
++(defun smtp-primitive-auth (_package)
+   (let* ((connection
+ 	  (smtp-find-connection (current-buffer)))
+ 	 (mechanisms
+@@ -518,7 +523,11 @@
+ 	  (smtp-response-error response)) ;Bogus server?
+ 	(if (/= (car response) 334)
+ 	    (smtp-response-error response))
+-	(sasl-step-set-data step (base64-decode-string (nth 1 response)))
++	;; Server may return human readable string.
++	;; https://msdn.microsoft.com/en-us/library/cc246825.aspx
++	(sasl-step-set-data step (condition-case nil
++				     (base64-decode-string (nth 1 response))
++				   (error (nth 1 response))))
+ 	(setq step (sasl-next-step client step))
+ 	(smtp-send-command
+ 	 connection
+@@ -531,16 +540,21 @@
+ ;;;     connection (sasl-client-decoder client))
+     ))
+ 
+-(defun smtp-primitive-starttls (package)
++(defun smtp-primitive-starttls (_package)
+   (let* ((connection
+ 	  (smtp-find-connection (current-buffer)))
++	 (process (smtp-connection-process-internal connection))
+ 	 response)
+     ;; STARTTLS --- begin a TLS negotiation (RFC 2595)
+     (smtp-send-command connection "STARTTLS")
+     (setq response (smtp-read-response connection))
+     (if (/= (car response) 220)
+ 	(smtp-response-error response))
+-    (starttls-negotiate (smtp-connection-process-internal connection))))
++    (if (memq (process-status process) '(run stop exit signal))
++	(starttls-negotiate process)
++      (gnutls-negotiate
++       :process process
++       :hostname (smtp-connection-server-internal connection)))))
+ 
+ (defun smtp-primitive-mailfrom (package)
+   (let* ((connection
+@@ -555,7 +569,7 @@
+     ;; SIZE --- Message Size Declaration (RFC1870)
+     (if (and smtp-use-size
+ 	     (assq 'size extensions))
+-	(setq extension (format "SIZE=%d" (smtp-package-buffer-internal-size package))))
++	(setq extension (format " SIZE=%d" (smtp-package-buffer-internal-size package))))
+     ;; 8BITMIME --- 8bit-MIMEtransport (RFC1652)
+     (if (and smtp-use-8bitmime
+ 	     (assq '8bitmime extensions))
+@@ -563,7 +577,7 @@
+     (smtp-send-command
+      connection
+      (if extension
+-	 (format "MAIL FROM:<%s> %s" sender extension)
++	 (format "MAIL FROM:<%s>%s" sender extension)
+        (format "MAIL FROM:<%s>" sender)))
+     (setq response (smtp-read-response connection))
+     (if (/= (car response) 250)
+@@ -590,8 +604,7 @@
+     (setq response (smtp-read-response connection))
+     (if (/= (car response) 354)
+ 	(smtp-response-error response))
+-    (save-excursion
+-      (set-buffer (smtp-package-buffer-internal package))
++    (with-current-buffer (smtp-package-buffer-internal package)
+       (goto-char (point-min))
+       (while (not (eobp))
+ 	(smtp-send-data
+@@ -602,7 +615,7 @@
+     (if (/= (car response) 250)
+ 	(smtp-response-error response))))
+ 
+-(defun smtp-primitive-quit (package)
++(defun smtp-primitive-quit (_package)
+   (let* ((connection
+ 	  (smtp-find-connection (current-buffer)))
+ 	 response)
+@@ -614,8 +627,7 @@
+ ;;; @ low level process manipulating function
+ ;;;
+ (defun smtp-process-filter (process output)
+-  (save-excursion
+-    (set-buffer (process-buffer process))
++  (with-current-buffer (process-buffer process)
+     (goto-char (point-max))
+     (insert output)))
+ 
+@@ -663,12 +675,11 @@
+     response))
+ 
+ (defun smtp-send-command (connection command)
+-  (save-excursion
+-    (let ((process
+-	   (smtp-connection-process-internal connection))
+-	  (encoder
+-	   (smtp-connection-encoder-internal connection)))
+-      (set-buffer (process-buffer process))
++  (let ((process
++	 (smtp-connection-process-internal connection))
++	(encoder
++	 (smtp-connection-encoder-internal connection)))
++    (with-current-buffer (process-buffer process)
+       (goto-char (point-max))
+       (setq command (concat command "\r\n"))
+       (insert command)
+@@ -683,9 +694,7 @@
+ 	(encoder
+ 	 (smtp-connection-encoder-internal connection)))
+     ;; Escape "." at start of a line.
+-    (if (eq (string-to-char data) ?.)
+-	(setq data (concat "." data "\r\n"))
+-      (setq data (concat data "\r\n")))
++    (setq data (concat (when (eq (string-to-char data) ?.) ".") data "\r\n"))
+     (if encoder
+ 	(setq data (funcall encoder data)))
+     (process-send-string process data)))
+@@ -698,13 +707,10 @@
+ 	addr-regexp
+ 	(smtp-address-buffer (generate-new-buffer " *smtp-mail*")))
+     (unwind-protect
+-	(save-excursion
+-	  ;;
+-	  (set-buffer smtp-address-buffer)
++	(with-current-buffer smtp-address-buffer
+ 	  (setq case-fold-search t)
+ 	  (erase-buffer)
+-	  (insert (save-excursion
+-		    (set-buffer smtp-text-buffer)
++	  (insert (with-current-buffer smtp-text-buffer
+ 		    (buffer-substring-no-properties header-start header-end)))
+ 	  (goto-char (point-min))
+ 	  ;; RESENT-* fields should stop processing of regular fields.
+@@ -729,11 +735,11 @@
+ 	  (erase-buffer)
+ 	  (insert " " simple-address-list "\n")
+ 	  ;; newline --> blank
+-	  (subst-char-in-region (point-min) (point-max) 10 ?  t)
++	  (subst-char-in-region (point-min) (point-max) 10 ?\s t)
+ 	  ;; comma   --> blank
+-	  (subst-char-in-region (point-min) (point-max) ?, ?  t)
++	  (subst-char-in-region (point-min) (point-max) ?, ?\s t)
+ 	  ;; tab     --> blank
+-	  (subst-char-in-region (point-min) (point-max)	 9 ?  t)
++	  (subst-char-in-region (point-min) (point-max)	 9 ?\s t)
+ 
+ 	  (goto-char (point-min))
+ 	  ;; tidyness in case hook is not robust when it looks at this
diff --git a/flim/patches/patch-std11.el b/flim/patches/patch-std11.el
new file mode 100644
index 0000000000..8b9a91b294
--- /dev/null
+++ b/flim/patches/patch-std11.el
@@ -0,0 +1,1095 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./std11.el	2005-11-13 10:04:36.000000000 +0900
++++ ././std11.el	2020-09-05 16:02:39.902584770 +0900
+@@ -1,4 +1,4 @@
+-;;; std11.el --- STD 11 functions for GNU Emacs
++;;; std11.el --- STD 11 functions for GNU Emacs  -*- lexical-binding: t -*-
+ 
+ ;; Copyright (C) 1995,96,97,98,99,2000,01,02 Free Software Foundation, Inc.
+ 
+@@ -24,8 +24,8 @@
+ 
+ ;;; Code:
+ 
+-(require 'custom)			; std11-lexical-analyzer
+-
++(require 'pccl)
++(require 'static)
+ 
+ ;;; @ fetch
+ ;;;
+@@ -54,8 +54,7 @@
+     (goto-char (point-min))
+     (let ((case-fold-search t))
+       (if (re-search-forward (concat "^" name ":[ \t]*") nil t)
+-	  (buffer-substring-no-properties (match-end 0) (std11-field-end))
+-	))))
++	  (buffer-substring-no-properties (match-end 0) (std11-field-end))))))
+ 
+ ;;;###autoload
+ (defun std11-narrow-to-header (&optional boundary)
+@@ -64,11 +63,12 @@
+   (narrow-to-region
+    (goto-char (point-min))
+    (if (re-search-forward
+-	(concat "^\\(" (regexp-quote (or boundary "")) "\\)?$")
++	(if boundary
++	    (concat "^\\(" (regexp-quote boundary) "\\)?$")
++	  "^$")
+ 	nil t)
+        (match-beginning 0)
+-     (point-max)
+-     )))
++     (point-max))))
+ 
+ ;;;###autoload
+ (defun std11-field-body (name &optional boundary)
+@@ -77,8 +77,7 @@
+   (save-excursion
+     (save-restriction
+       (inline (std11-narrow-to-header boundary)
+-	      (std11-fetch-field name))
+-      )))
++	      (std11-fetch-field name)))))
+ 
+ (defun std11-find-field-body (field-names &optional boundary)
+   "Return the first found field-body specified by FIELD-NAMES
+@@ -90,15 +89,13 @@
+       (let ((case-fold-search t)
+ 	    field-name)
+ 	(catch 'tag
++	  (goto-char (point-min))
+ 	  (while (setq field-name (car field-names))
+-	    (goto-char (point-min))
+ 	    (if (re-search-forward (concat "^" field-name ":[ \t]*") nil t)
+ 		(throw 'tag
+ 		       (buffer-substring-no-properties
+-			(match-end 0) (std11-field-end)))
+-	      )
+-	    (setq field-names (cdr field-names))
+-	    ))))))
++			(match-end 0) (std11-field-end))))
++	    (setq field-names (cdr field-names))))))))
+ 
+ (defun std11-field-bodies (field-names &optional default-value boundary)
+   "Return list of each field-bodies of FIELD-NAMES of the message header
+@@ -117,11 +114,9 @@
+ 	  (if (re-search-forward (concat "^" field-name ":[ \t]*") nil t)
+ 	      (setcar d-rest
+ 		      (buffer-substring-no-properties
+-		       (match-end 0) (std11-field-end)))
+-	    )
++		       (match-end 0) (std11-field-end))))
+ 	  (setq s-rest (cdr s-rest)
+-		d-rest (cdr d-rest))
+-	  )
++		d-rest (cdr d-rest)))
+ 	dest))))
+ 
+ (defun std11-header-string (regexp &optional boundary)
+@@ -136,11 +131,9 @@
+ 	  (while (re-search-forward std11-field-head-regexp nil t)
+ 	    (setq field
+ 		  (buffer-substring (match-beginning 0) (std11-field-end)))
+-	    (if (string-match regexp field)
+-		(setq header (concat header field "\n"))
+-	      ))
+-	  header)
+-	))))
++	    (when (string-match regexp field)
++	      (setq header (cons "\n" (cons field header)))))
++	  (apply 'concat (nreverse header)))))))
+ 
+ (defun std11-header-string-except (regexp &optional boundary)
+   "Return string of message header fields not matched by REGEXP.
+@@ -155,10 +148,8 @@
+ 	    (setq field
+ 		  (buffer-substring (match-beginning 0) (std11-field-end)))
+ 	    (if (not (string-match regexp field))
+-		(setq header (concat header field "\n"))
+-	      ))
+-	  header)
+-	))))
++		(setq header (cons "\n" (cons field header)))))
++	  (apply 'concat (nreverse header)))))))
+ 
+ (defun std11-collect-field-names (&optional boundary)
+   "Return list of all field-names of the message header in current buffer.
+@@ -172,30 +163,33 @@
+ 	  (setq name (buffer-substring-no-properties
+ 		      (match-beginning 0)(1- (match-end 0))))
+ 	  (or (member name dest)
+-	      (setq dest (cons name dest))
+-	      )
+-	  )
++	      (setq dest (cons name dest))))
+ 	dest))))
+ 
+ 
+ ;;; @ unfolding
+ ;;;
+ 
++(defcustom std11-unfold-strip-leading-tab t
++  "When non-nil, `std11-unfold-string' strips leading TAB, which is mainly added by incorrect folding."
++  :group 'news
++  :group 'mail
++  :type 'boolean)
++
+ ;;;###autoload
+ (defun std11-unfold-string (string)
+   "Unfold STRING as message header field."
+-  (let ((dest "")
++  (let (dest
+ 	(p 0))
+-    (while (string-match "\n\\([ \t]\\)" string p)
+-      (setq dest (concat dest
+-                         (substring string p (match-beginning 0))
+-                         (substring string
+-				    (match-beginning 1)
+-				    (setq p (match-end 0)))
+-                         ))
+-      )
+-    (concat dest (substring string p))
+-    ))
++    (while (string-match "\\( ?\\)\n\\([ \t]\\)" string p)
++      (setq dest (cons (unless (and std11-unfold-strip-leading-tab
++				    (< (match-beginning 0) (match-end 1))
++				    (eq (aref string (match-beginning 2)) ?\t))
++			 (match-string 2 string))
++		       (cons (substring string p (match-end 1))
++			     dest))
++	    p (match-end 0)))
++    (apply 'concat (nreverse (cons (substring string p) dest)))))
+ 
+ 
+ ;;; @ quoted-string
+@@ -205,18 +199,13 @@
+   (let (dest
+ 	(i 0)
+ 	(b 0)
+-	(len (length string))
+-	)
++	(len (length string)))
+     (while (< i len)
+-      (let ((chr (aref string i)))
+-	(if (memq chr specials)
+-	    (setq dest (concat dest (substring string b i) "\\")
+-		  b i)
+-	  ))
+-      (setq i (1+ i))
+-      )
+-    (concat dest (substring string b))
+-    ))
++      (if (memq (aref string i) specials)
++	  (setq dest (cons "\\" (cons (substring string b i) dest))
++		b i))
++      (setq i (1+ i)))
++    (apply 'concat (nreverse (cons (substring string b) dest)))))
+ 
+ (defconst std11-non-qtext-char-list '(?\" ?\\ ?\r ?\n))
+ 
+@@ -231,18 +220,14 @@
+   (let (dest
+ 	(b 0)
+ 	(i 0)
+-	(len (length string))
+-	)
++	(len (length string)))
+     (while (< i len)
+-      (let ((chr (aref string i)))
+-	(if (eq chr ?\\)
+-	    (setq dest (concat dest (substring string b i))
+-		  b (1+ i)
+-		  i (+ i 2))
+-	  (setq i (1+ i))
+-	  )))
+-    (concat dest (substring string b))
+-    ))
++      (if (eq (aref string i) ?\\)
++	  (setq dest (cons (substring string b i) dest)
++		b (1+ i)
++		i (+ i 2))
++	(setq i (1+ i))))
++    (apply 'concat (nreverse (cons (substring string b) dest)))))
+ 
+ (defun std11-strip-quoted-string (string)
+   "Strip quoted-string STRING."
+@@ -251,14 +236,142 @@
+ 	     (let ((max (1- len)))
+ 	       (and (eq (aref string 0) ?\")
+ 		    (eq (aref string max) ?\")
+-		    (std11-strip-quoted-pair (substring string 1 max))
+-		    )))
++		    (std11-strip-quoted-pair (substring string 1 max)))))
+ 	string)))
+ 
+ 
+ ;;; @ lexical analyze
+ ;;;
+ 
++(unless-broken ccl-usable
++(define-ccl-program std11-default-ccl-lexical-analyzer
++  ;; r0 input
++  ;; r1 flag means any character exists.
++  ;; r2 in parse flag
++  ;;    1 atom, 2 spaces, 3 quoted string or domain literal, 4 comment
++  ;; r3 comment depth
++  (eval-when-compile
++    (let* ((wrt `(if (r0 == ?\") (write "\\\"")
++		   (if (r0 == ?\\) (write "\\\\")
++		     (write r0))))
++	   (atm `((branch r2
++			  ((r2 = 1)
++			   (write "(atom . \"")
++			   (write-read-repeat r0))
++			  (write-read-repeat r0)
++			  ((write "\")")
++			   (r2 = 1)
++			   (write "(atom . \"")
++			   (write-read-repeat r0)))))
++	   (spc `((if r2 ((write "\")") (r2 = 0)))
++		  (write "(specials . \"")
++		  ,wrt
++		  (write "\")")
++		  (read r0)
++		  (repeat)))
++	   (sp  `((branch r2
++			  ((r2 = 2)
++			   (write "(spaces . \"")
++			   (write-read-repeat r0))
++			  ((write "\")")
++			   (r2 = 2)
++			   (write "(spaces . \"")
++			   (write-read-repeat r0))
++			  (write-read-repeat r0))))
++	   (enc (lambda (name tag)
++		  `((if r2 ((write "\")")))
++		    (write ,(concat "(" name " . \""))
++		    (r2 = 3)
++		    (loop
++		     (read-branch
++		      r0
++		      ,@(let* ((count (1+ (max tag ?\\)))
++			       (result (make-vector count '(write-repeat r0))))
++			  (aset result tag '(break))
++			  (aset result ?\\ `((write "\\\\")
++					     (read r0)
++					     ,wrt
++					     (repeat)))
++			  (aset result ?\" '((write "\\\"")
++					     (repeat)))
++			  (mapcar 'identity result)))
++		     (write-repeat r0))
++		    (write "\")")
++		    (r2 = 0)
++		    (read r0)
++		    (repeat))))
++	   (qs (funcall enc "quoted-string" ?\"))
++	   (dl (funcall enc "domain-literal" ?\]))
++	   (cm  `((if r2 ((write "\")")))
++		  (write "(comment . \"")
++		  (r2 = 4)
++		  (r3 = 1)
++		  (loop
++		   (read-branch
++		    r0
++		    ,@(let* ((count (1+ (max ?\( ?\) ?\\)))
++			     (result (make-vector count '(write-repeat r0))))
++			(aset result ?\( '((r3 += 1) (write-repeat r0)))
++			(aset result ?\) '((r3 -= 1)
++					   (if (r3 < 1) (break)
++					     (write-repeat r0))))
++			(aset result ?\\ `((write "\\\\")
++					   (read r0)
++					   ,wrt
++					   (repeat)))
++			(aset result ?\"
++			      '((write "\\\"") (repeat)))
++			(mapcar 'identity result)))
++		   (write-repeat r0))
++		  (write "\")")
++		  (r2 = 0)
++		  (read r0)
++		  (repeat))))
++      `(8
++	((r2 = 0)
++	 (read r0)
++	 (r1 = 1)
++	 (write "((")
++	 (loop
++	  (branch r0
++		  ,@(mapcar (lambda (elt)
++			      (eval elt))
++			    '(atm atm atm atm atm atm atm atm
++				  atm sp  sp  atm atm atm atm atm
++				  atm atm atm atm atm atm atm atm
++				  atm atm atm atm atm atm atm atm
++				  sp  atm qs  atm atm atm atm atm
++				  cm  spc atm atm spc atm spc atm
++				  atm atm atm atm atm atm atm atm
++				  atm atm spc spc spc atm spc atm
++				  spc atm atm atm atm atm atm atm
++				  atm atm atm atm atm atm atm atm
++				  atm atm atm atm atm atm atm atm
++				  atm atm atm dl  spc spc)))
++	  ,@atm))
++	((branch r1
++		 (write "(nil . t)")
++		 (branch r2
++			 (write ") . t)")
++			 (write "\")) . t)")
++			 (write "\")) . t)")
++			 (write "\")))")
++			 (write "\")))")))))))))
++
++(defcustom std11-ccl-lexical-analyzer
++  (static-unless (or (broken-p 'ccl-execute-eof-block)
++		     (broken-p 'ccl-usable))
++    'std11-default-ccl-lexical-analyzer)
++  "Specify CCL-program symbol for `std11-lexical-analyze'.
++When nil, do not use CCL.
++CCL-program returns a string which expresses a cons.
++When cons's cdr is non-nil, CCL-program succeeds in analyzing and car is analyzed result.
++When cdr is nil,CCL-program fails in analyzing.
++If you modify `std11-lexical-analyzer', set this variable to nil or prepare corresponding CCL-program."
++  :group 'news
++  :group 'mail
++  :type '(choice symbol (const :tag "Do not use CCL." nil)))
++
+ (defcustom std11-lexical-analyzer
+   '(std11-analyze-quoted-string
+     std11-analyze-domain-literal
+@@ -279,12 +392,11 @@
+   :type '(repeat function))
+ 
+ (eval-and-compile
+-  (defconst std11-space-char-list '(?  ?\t ?\n))
++  (defconst std11-space-char-list '(?\s ?\t ?\n))
+   (defconst std11-special-char-list '(?\] ?\[
+ 					  ?\( ?\) ?< ?> ?@
+ 					  ?, ?\; ?: ?\\ ?\"
+-					  ?.))
+-  )
++					  ?.)))
+ ;; (defconst std11-spaces-regexp
+ ;;   (eval-when-compile (concat "[" std11-space-char-list "]+")))
+ 
+@@ -304,16 +416,14 @@
+       (let ((end (match-end 0)))
+ 	(cons (cons 'spaces (substring string start end))
+ 	      ;;(substring string end)
+-	      end)
+-	)))
++	      end))))
+ 
+ (defun std11-analyze-special (string start)
+   (if (and (> (length string) start)
+ 	   (memq (aref string start) std11-special-char-list))
+       (cons (cons 'specials (substring string start (1+ start)))
+ 	    ;;(substring string 1)
+-	    (1+ start))
+-    ))
++	    (1+ start))))
+ 
+ (defun std11-analyze-atom (string start)
+   (if (string-match std11-non-atom-regexp string start)
+@@ -334,8 +444,7 @@
+ 
+ (defun std11-check-enclosure (string open close &optional recursive from)
+   (let ((len (length string))
+-	(i (or from 0))
+-	)
++	(i (or from 0)))
+     (if (and (> len i)
+ 	     (eq (aref string i) open))
+ 	(let (p chr)
+@@ -346,97 +455,83 @@
+ 	      (cond ((eq chr ?\\)
+ 		     (setq i (1+ i))
+ 		     (if (>= i len)
+-			 (throw 'tag nil)
+-		       )
+-		     (setq i (1+ i))
+-		     )
++			 (throw 'tag nil))
++		     (setq i (1+ i)))
+ 		    ((eq chr close)
+-		     (throw 'tag (1+ i))
+-		     )
++		     (throw 'tag (1+ i)))
+ 		    ((eq chr open)
+ 		     (if (and recursive
+ 			      (setq p (std11-check-enclosure
+-				       string open close recursive i))
+-			      )
++				       string open close recursive i)))
+ 			 (setq i p)
+-		       (throw 'tag nil)
+-		       ))
++		       (throw 'tag nil)))
+ 		    (t
+-		     (setq i (1+ i))
+-		     ))
+-	      ))))))
++		     (setq i (1+ i))))))))))
+ 
+ (defun std11-analyze-quoted-string (string start)
+   (let ((p (std11-check-enclosure string ?\" ?\" nil start)))
+     (if p
+ 	(cons (cons 'quoted-string (substring string (1+ start) (1- p)))
+ 	      ;;(substring string p))
+-	      p)
+-      )))
++	      p))))
+ 
+ (defun std11-analyze-domain-literal (string start)
+   (let ((p (std11-check-enclosure string ?\[ ?\] nil start)))
+     (if p
+ 	(cons (cons 'domain-literal (substring string (1+ start) (1- p)))
+ 	      ;;(substring string p))
+-	      p)
+-      )))
++	      p))))
+ 
+ (defun std11-analyze-comment (string start)
+   (let ((p (std11-check-enclosure string ?\( ?\) t start)))
+     (if p
+ 	(cons (cons 'comment (substring string (1+ start) (1- p)))
+ 	      ;;(substring string p))
+-	      p)
+-      )))
++	      p))))
+ 
+ ;;;###autoload
+ (defun std11-lexical-analyze (string &optional analyzer start)
+   "Analyze STRING as lexical tokens of STD 11."
+-  (or analyzer
+-      (setq analyzer std11-lexical-analyzer))
+-  (or start
+-      (setq start 0))
+-  (let ((len (length string))
+-	dest ret)
+-    (while (< start len)
+-      (setq ret
+-	    (let ((rest analyzer)
+-		  func r)
+-	      (while (and (setq func (car rest))
+-			  (null (setq r (funcall func string start))))
+-		(setq rest (cdr rest)))
+-	      (or r
+-		  (cons (cons 'error (substring string start)) (1+ len)))
+-	      ))
+-      (setq dest (cons (car ret) dest)
+-	    start (cdr ret))
+-      )
+-    (nreverse dest)
+-    ))
++  (let (len dest ret)
++    (if (and std11-ccl-lexical-analyzer
++	     (null analyzer)
++	     (cdr (setq ret (read (ccl-execute-on-string
++				   std11-ccl-lexical-analyzer
++				   (make-vector 9 0)
++				   (if start (substring string start)
++				     (or string "")))))))
++	(car ret)
++      (setq len (length string)
++	    analyzer (or analyzer std11-lexical-analyzer)
++	    start (or start 0))
++      (while (< start len)
++	(setq ret
++	      (let ((rest analyzer)
++		    func r)
++		(while (and (setq func (car rest))
++			    (null (setq r (funcall func string start))))
++		  (setq rest (cdr rest)))
++		(or r
++		    (cons (cons 'error (substring string start)) (1+ len)))))
++	(setq dest (cons (car ret) dest)
++	      start (cdr ret)))
++      (nreverse dest))))
+ 
+ 
+ ;;; @ parser
+ ;;;
+ 
+ (defun std11-ignored-token-p (token)
+-  (let ((type (car token)))
+-    (or (eq type 'spaces)(eq type 'comment))
+-    ))
++  (memq (car token) '(spaces comment)))
+ 
+ (defun std11-parse-token (lal)
+   (let (token itl)
+     (while (and lal
+-		(progn
+-		  (setq token (car lal))
+-		  (std11-ignored-token-p token)
+-		  ))
++		(std11-ignored-token-p (setq token (car lal))))
+       (setq lal (cdr lal))
+-      (setq itl (cons token itl))
+-      )
++      (setq itl (cons token itl)))
+     (cons (nreverse (cons token itl))
+-	  (cdr lal))
+-    ))
++	  (cdr lal))))
+ 
+ (defun std11-parse-ascii-token (lal)
+   (let (token itl parsed token-value)
+@@ -445,69 +540,51 @@
+ 		(or (std11-ignored-token-p token)
+ 		    (if (and (setq token-value (cdr token))
+ 			     (delq 'ascii (find-charset-string token-value)))
+-			(setq token nil)
+-		      )))
++			(setq token nil))))
+       (setq lal (cdr lal))
+-      (setq itl (cons token itl))
+-      )
++      (setq itl (cons token itl)))
+     (if (and token
+-	     (setq parsed (nreverse (cons token itl)))
+-	     )
+-	(cons parsed (cdr lal))
+-      )))
++	     (setq parsed (nreverse (cons token itl))))
++	(cons parsed (cdr lal)))))
+ 
+ (defun std11-parse-token-or-comment (lal)
+   (let (token itl)
+     (while (and lal
+-		(progn
+-		  (setq token (car lal))
+-		  (eq (car token) 'spaces)
+-		  ))
++		(eq (car (setq token (car lal))) 'spaces))
+       (setq lal (cdr lal))
+-      (setq itl (cons token itl))
+-      )
++      (setq itl (cons token itl)))
+     (cons (nreverse (cons token itl))
+-	  (cdr lal))
+-    ))
++	  (cdr lal))))
+ 
+ (defun std11-parse-word (lal)
+   (let ((ret (std11-parse-ascii-token lal)))
+     (if ret
+ 	(let ((elt (car ret))
+-	      (rest (cdr ret))
+-	      )
++	      (rest (cdr ret)))
+ 	  (if (or (assq 'atom elt)
+ 		  (assq 'quoted-string elt))
+-	      (cons (cons 'word elt) rest)
+-	    )))))
++	      (cons (cons 'word elt) rest))))))
+ 
+ (defun std11-parse-word-or-comment-or-period (lal)
+   (let ((ret (std11-parse-token-or-comment lal)))
+     (if ret
+ 	(let ((elt (car ret))
+-	      (rest (cdr ret))
+-	      )
++	      (rest (cdr ret)))
+ 	  (cond ((or (assq 'atom elt)
+ 		     (assq 'quoted-string elt))
+-		 (cons (cons 'word elt) rest)
+-		 )
++		 (cons (cons 'word elt) rest))
+ 		((assq 'comment elt)
+-		 (cons (cons 'comment-word elt) rest)
+-		 )
++		 (cons (cons 'comment-word elt) rest))
+ 		((string-equal (cdr (assq 'specials elt)) ".")
+-		 (cons (cons 'period elt) rest)
+-		 ))
+-	  ))))
++		 (cons (cons 'period elt) rest)))))))
+ 
+ (defun std11-parse-phrase (lal)
+   (let (ret phrase)
+     (while (setq ret (std11-parse-word-or-comment-or-period lal))
+       (setq phrase (append phrase (cdr (car ret))))
+-      (setq lal (cdr ret))
+-      )
++      (setq lal (cdr ret)))
+     (if phrase
+-	(cons (cons 'phrase phrase) lal)
+-      )))
++	(cons (cons 'phrase phrase) lal))))
+ 
+ (defun std11-parse-local-part (lal)
+   (let ((ret (std11-parse-word lal)))
+@@ -519,24 +596,18 @@
+ 		      (string-equal (cdr (assq 'specials dot)) ".")
+ 		      (setq ret (std11-parse-word (cdr ret)))
+ 		      (setq local-part
+-			    (append local-part dot (cdr (car ret)))
+-			    )
+-		      (setq lal (cdr ret))
+-		      ))
+-	  (cons (cons 'local-part local-part) lal)
+-	  ))))
++			    (append local-part dot (cdr (car ret))))
++		      (setq lal (cdr ret))))
++	  (cons (cons 'local-part local-part) lal)))))
+ 
+ (defun std11-parse-sub-domain (lal)
+   (let ((ret (std11-parse-ascii-token lal)))
+     (if ret
+ 	(let ((sub-domain (car ret)))
+ 	  (if (or (assq 'atom sub-domain)
+-		  (assq 'domain-literal sub-domain)
+-		  )
++		  (assq 'domain-literal sub-domain))
+ 	      (cons (cons 'sub-domain sub-domain)
+-		    (cdr ret)
+-		    )
+-	    )))))
++		    (cdr ret)))))))
+ 
+ (defun std11-parse-domain (lal)
+   (let ((ret (std11-parse-sub-domain lal)))
+@@ -548,23 +619,18 @@
+ 		      (string-equal (cdr (assq 'specials dot)) ".")
+ 		      (setq ret (std11-parse-sub-domain (cdr ret)))
+ 		      (setq domain
+-			    (append domain dot (cdr (car ret)))
+-			    )
+-		      (setq lal (cdr ret))
+-		      ))
+-	  (cons (cons 'domain domain) lal)
+-	  ))))
++			    (append domain dot (cdr (car ret))))
++		      (setq lal (cdr ret))))
++	  (cons (cons 'domain domain) lal)))))
+ 
+ (defun std11-parse-at-domain (lal)
+   (let ((ret (std11-parse-ascii-token lal)) at-sign)
+     (if (and ret
+ 	     (setq at-sign (car ret))
+ 	     (string-equal (cdr (assq 'specials at-sign)) "@")
+-	     (setq ret (std11-parse-domain (cdr ret)))
+-	     )
++	     (setq ret (std11-parse-domain (cdr ret))))
+ 	(cons (cons 'at-domain (append at-sign (cdr (car ret))))
+-	      (cdr ret))
+-      )))
++	      (cdr ret)))))
+ 
+ (defun std11-parse-addr-spec (lal)
+   (let ((ret (std11-parse-local-part lal))
+@@ -575,10 +641,8 @@
+ 	       (setq lal (cdr ret))
+ 	       (and (setq ret (std11-parse-at-domain lal))
+ 		    (setq addr (append addr (cdr (car ret))))
+-		    (setq lal (cdr ret))
+-		    )))
+-	(cons (cons 'addr-spec addr) lal)
+-      )))
++		    (setq lal (cdr ret)))))
++	(cons (cons 'addr-spec addr) lal))))
+ 
+ (defun std11-parse-route (lal)
+   (let ((ret (std11-parse-at-domain lal))
+@@ -590,21 +654,15 @@
+ 	       (while (and (setq ret (std11-parse-ascii-token lal))
+ 			   (setq comma (car ret))
+ 			   (string-equal (cdr (assq 'specials comma)) ",")
+-			   (setq ret (std11-parse-at-domain (cdr ret)))
+-			   )
++			   (setq ret (std11-parse-at-domain (cdr ret))))
+ 		 (setq route (append route comma (cdr (car ret))))
+-		 (setq lal (cdr ret))
+-		 )
++		 (setq lal (cdr ret)))
+ 	       (and (setq ret (std11-parse-ascii-token lal))
+ 		    (setq colon (car ret))
+ 		    (string-equal (cdr (assq 'specials colon)) ":")
+-		    (setq route (append route colon))
+-		    )
+-	       ))
++		    (setq route (append route colon)))))
+ 	(cons (cons 'route route)
+-	      (cdr ret)
+-	      )
+-      )))
++	      (cdr ret)))))
+ 
+ (defun std11-parse-route-addr (lal)
+   (let ((ret (std11-parse-ascii-token lal))
+@@ -615,34 +673,27 @@
+ 	     (setq lal (cdr ret))
+ 	     (progn (and (setq ret (std11-parse-route lal))
+ 			 (setq route (cdr (car ret)))
+-			 (setq lal (cdr ret))
+-			 )
+-		    (setq ret (std11-parse-addr-spec lal))
+-		    )
++			 (setq lal (cdr ret)))
++		    (setq ret (std11-parse-addr-spec lal)))
+ 	     (setq addr-spec (cdr (car ret)))
+ 	     (setq lal (cdr ret))
+ 	     (setq ret (std11-parse-ascii-token lal))
+ 	     (setq > (car ret))
+-	     (string-equal (cdr (assq 'specials >)) ">")
+-	     )
++	     (string-equal (cdr (assq 'specials >)) ">"))
+ 	(cons (cons 'route-addr (append route addr-spec))
+-	      (cdr ret)
+-	      )
+-      )))
++	      (cdr ret)))))
+ 
+ (defun std11-parse-phrase-route-addr (lal)
+   (let ((ret (std11-parse-phrase lal)) phrase)
+     (if ret
+ 	(progn
+ 	  (setq phrase (cdr (car ret)))
+-	  (setq lal (cdr ret))
+-	  ))
++	  (setq lal (cdr ret))))
+     (if (setq ret (std11-parse-route-addr lal))
+ 	(cons (list 'phrase-route-addr
+ 		    phrase
+ 		    (cdr (car ret)))
+-	      (cdr ret))
+-      )))
++	      (cdr ret)))))
+ 
+ (defun std11-parse-mailbox (lal)
+   (let ((ret (or (std11-parse-phrase-route-addr lal)
+@@ -653,13 +704,10 @@
+ 		 (setq mbox (car ret))
+ 	       (setq lal (cdr ret))
+ 	       (if (and (setq ret (std11-parse-token-or-comment lal))
+-			(setq comment (cdr (assq 'comment (car ret))))
+-			)
+-		   (setq lal (cdr ret))
+-		 )))
++			(setq comment (cdr (assq 'comment (car ret)))))
++		   (setq lal (cdr ret)))))
+ 	(cons (list 'mailbox mbox comment)
+-	      lal)
+-      )))
++	      lal))))
+ 
+ (defun std11-parse-group (lal)
+   (let ((ret (std11-parse-phrase lal))
+@@ -675,30 +723,24 @@
+ 	       (and (setq ret (std11-parse-mailbox lal))
+ 		    (setq mbox (list (car ret)))
+ 		    (setq lal (cdr ret))
+-		    (progn
+-		      (while (and (setq ret (std11-parse-ascii-token lal))
+-				  (setq comma (car ret))
+-				  (string-equal
+-				   (cdr (assq 'specials comma)) ",")
+-				  (setq lal (cdr ret))
+-				  (setq ret (std11-parse-mailbox lal))
+-				  (setq mbox (cons (car ret) mbox))
+-				  (setq lal (cdr ret))
+-				  )
+-			)))
++		    (while (and (setq ret (std11-parse-ascii-token lal))
++				(setq comma (car ret))
++				(string-equal
++				 (cdr (assq 'specials comma)) ",")
++				(setq lal (cdr ret))
++				(setq ret (std11-parse-mailbox lal))
++				(setq mbox (cons (car ret) mbox))
++				(setq lal (cdr ret)))))
+ 	       (and (setq ret (std11-parse-ascii-token lal))
+ 		    (setq semicolon (car ret))
+ 		    (string-equal (cdr (assq 'specials semicolon)) ";")
+ 		    )))
+ 	(cons (list 'group phrase (nreverse mbox))
+-	      (cdr ret)
+-	      )
+-      )))
++	      (cdr ret)))))
+ 
+ (defun std11-parse-address (lal)
+   (or (std11-parse-group lal)
+-      (std11-parse-mailbox lal)
+-      ))
++      (std11-parse-mailbox lal)))
+ 
+ (defun std11-parse-addresses (lal)
+   (let ((ret (std11-parse-address lal)))
+@@ -707,13 +749,10 @@
+ 	  (setq lal (cdr ret))
+ 	  (while (and (setq ret (std11-parse-ascii-token lal))
+ 		      (string-equal (cdr (assq 'specials (car ret))) ",")
+-		      (setq ret (std11-parse-address (cdr ret)))
+-		      )
++		      (setq ret (std11-parse-address (cdr ret))))
+ 	    (setq dest (cons (car ret) dest))
+-	    (setq lal (cdr ret))
+-	    )
+-	  (nreverse dest)
+-	  ))))
++	    (setq lal (cdr ret)))
++	  (nreverse dest)))))
+ 
+ (defun std11-parse-msg-id (lal)
+   (let ((ret (std11-parse-ascii-token lal))
+@@ -727,11 +766,9 @@
+ 	     (setq lal (cdr ret))
+ 	     (setq ret (std11-parse-ascii-token lal))
+ 	     (setq > (car ret))
+-	     (string-equal (cdr (assq 'specials >)) ">")
+-	     )
++	     (string-equal (cdr (assq 'specials >)) ">"))
+ 	(cons (cons 'msg-id (cdr addr-spec))
+-	      (cdr ret))
+-      )))
++	      (cdr ret)))))
+ 
+ (defun std11-parse-msg-ids (tokens)
+   "Parse lexical TOKENS as `*(phrase / msg-id)', and return the result."
+@@ -743,13 +780,11 @@
+ 	  (while (setq ret (or (std11-parse-msg-id tokens)
+ 			       (std11-parse-phrase tokens)))
+ 	    (setq dest (cons (car ret) dest))
+-	    (setq tokens (cdr ret))
+-	    )
+-	  (nreverse dest)
+-	  ))))
++	    (setq tokens (cdr ret)))
++	  (nreverse dest)))))
+ 
+ (defalias 'std11-parse-in-reply-to 'std11-parse-msg-ids)
+-(make-obsolete 'std11-parse-in-reply-to 'std11-parse-msg-ids)
++(make-obsolete 'std11-parse-in-reply-to 'std11-parse-msg-ids "23 Jan 1999")
+ 
+ 
+ ;;; @ composer
+@@ -758,20 +793,16 @@
+ (defun std11-addr-to-string (seq)
+   "Return string from lexical analyzed list SEQ
+ represents addr-spec of RFC 822."
+-  (mapconcat (function
+-	      (lambda (token)
+-		(let ((name (car token)))
+-                  (cond
+-                   ((eq name 'spaces) "")
+-                   ((eq name 'comment) "")
+-                   ((eq name 'quoted-string)
+-                    (concat "\"" (cdr token) "\""))
+-                   ((eq name 'domain-literal)
+-                    (concat "[" (cdr token) "]"))
+-                   (t (cdr token)))
+-                  )))
+-	     seq "")
+-  )
++  (mapconcat (lambda (token)
++	       (let ((name (car token)))
++                 (cond
++                  ((memq name '(spaces comment)) nil)
++                  ((eq name 'quoted-string)
++                   (concat "\"" (cdr token) "\""))
++                  ((eq name 'domain-literal)
++                   (concat "[" (cdr token) "]"))
++                  (t (cdr token)))))
++	     seq nil))
+ 
+ ;;;###autoload
+ (defun std11-address-string (address)
+@@ -779,45 +810,34 @@
+   (cond ((eq (car address) 'group)
+ 	 (mapconcat (function std11-address-string)
+ 		    (nth 2 address)
+-		    ", ")
+-	 )
++		    ", "))
+ 	((eq (car address) 'mailbox)
+ 	 (let ((addr (nth 1 address)))
+ 	   (std11-addr-to-string
+ 	    (if (eq (car addr) 'phrase-route-addr)
+ 		(nth 2 addr)
+-	      (cdr addr)
+-	      )
+-	    )))))
++	      (cdr addr)))))))
+ 
+ (defun std11-comment-value-to-string (value)
+   (if (stringp value)
+       (std11-strip-quoted-pair value)
+-    (let ((dest ""))
++    (let (dest)
+       (while value
+ 	(setq dest
+-	      (concat dest
+-		      (if (stringp (car value))
+-			  (car value)
+-			(concat "("
+-				(std11-comment-value-to-string
+-				 (cdr (car value)))
+-				")")
+-			))
+-	      value (cdr value))
+-	)
+-      dest)))
++	      (if (stringp (car value))
++		  (cons (car value) dest)
++		(cons ")"
++		      (cons (std11-comment-value-to-string
++			     (cdr (car value)))
++			    (cons "(" dest))))
++	      value (cdr value)))
++      (apply 'concat (nreverse dest)))))
+ 
+ ;;;###autoload
+ (defun std11-full-name-string (address)
+   "Return string of full-name part from parsed ADDRESS of RFC 822."
+   (cond ((eq (car address) 'group)
+-	 (mapconcat (function
+-		     (lambda (token)
+-		       (cdr token)
+-		       ))
+-		    (nth 1 address) "")
+-	 )
++	 (mapconcat 'cdr (nth 1 address) ""))
+ 	((eq (car address) 'mailbox)
+ 	 (let ((addr (nth 1 address))
+ 	       (comment (nth 2 address))
+@@ -825,33 +845,25 @@
+ 	   (if (eq (car addr) 'phrase-route-addr)
+ 	       (setq phrase
+ 		     (mapconcat
+-		      (function
+-		       (lambda (token)
+-			 (let ((type (car token)))
+-			   (cond ((eq type 'quoted-string)
+-				  (std11-strip-quoted-pair (cdr token))
+-				  )
+-				 ((eq type 'comment)
+-				  (concat "("
+-					  (std11-comment-value-to-string
+-					   (cdr token))
+-					  ")")
+-				  )
+-				 (t
+-				  (cdr token)
+-				  )))))
+-		      (nth 1 addr) ""))
+-	     )
++		      (lambda (token)
++			(let ((type (car token)))
++			  (cond ((eq type 'quoted-string)
++				 (std11-strip-quoted-pair (cdr token)))
++				((eq type 'comment)
++				 (concat "("
++					 (std11-comment-value-to-string
++					  (cdr token))
++					 ")"))
++				(t
++				 (cdr token)))))
++		      (nth 1 addr) "")))
+ 	   (cond ((> (length phrase) 0) phrase)
+-		 (comment (std11-comment-value-to-string comment))
+-		 )
+-	   ))))
++		 (comment (std11-comment-value-to-string comment)))))))
+ 
+ ;;;###autoload
+ (defun std11-msg-id-string (msg-id)
+   "Return string from parsed MSG-ID of RFC 822."
+-  (concat "<" (std11-addr-to-string (cdr msg-id)) ">")
+-  )
++  (concat "<" (std11-addr-to-string (cdr msg-id)) ">"))
+ 
+ ;;;###autoload
+ (defun std11-fill-msg-id-list-string (string &optional column)
+@@ -866,14 +878,12 @@
+ 		 (len (length str)))
+ 	    (setq lal (cdr ret))
+ 	    (if (> (+ len column) 76)
+-		(setq dest (concat dest "\n " str)
++		(setq dest (cons str (cons "\n " dest))
+ 		      column (1+ len))
+ 	      (setq dest str
+-		    column (+ column len))
+-	      ))
+-	(setq dest (concat dest (cdr (car lal)))
+-	      lal (cdr lal))
+-	))
++		    column (+ column len))))
++	(setq dest (cons (cdr (car lal)) dest)
++	      lal (cdr lal))))
+     (while lal
+       (let ((ret (std11-parse-msg-id lal)))
+ 	(if ret
+@@ -881,15 +891,13 @@
+ 		   (len (1+ (length str))))
+ 	      (setq lal (cdr ret))
+ 	      (if (> (+ len column) 76)
+-		  (setq dest (concat dest "\n " str)
++		  (setq dest (cons str (cons "\n " dest))
+ 			column len)
+-		(setq dest (concat dest " " str)
+-		      column (+ column len))
+-		))
+-	  (setq dest (concat dest (cdr (car lal)))
+-		lal (cdr lal))
+-	  )))
+-    dest))
++		(setq dest (cons str (cons " " dest))
++		      column (+ column len))))
++	  (setq dest (cons (cdr (car lal)) dest)
++		lal (cdr lal)))))
++    (apply 'concat (nreverse dest))))
+ 
+ 
+ ;;; @ parser with lexical analyzer
+@@ -898,26 +906,22 @@
+ ;;;###autoload
+ (defun std11-parse-address-string (string)
+   "Parse STRING as mail address."
+-  (std11-parse-address (std11-lexical-analyze string))
+-  )
++  (std11-parse-address (std11-lexical-analyze string)))
+ 
+ ;;;###autoload
+ (defun std11-parse-addresses-string (string)
+   "Parse STRING as mail address list."
+-  (std11-parse-addresses (std11-lexical-analyze string))
+-  )
++  (std11-parse-addresses (std11-lexical-analyze string)))
+ 
+ ;;;###autoload
+ (defun std11-parse-msg-id-string (string)
+   "Parse STRING as msg-id."
+-  (std11-parse-msg-id (std11-lexical-analyze string))
+-  )
++  (std11-parse-msg-id (std11-lexical-analyze string)))
+ 
+ ;;;###autoload
+ (defun std11-parse-msg-ids-string (string)
+   "Parse STRING as `*(phrase / msg-id)'."
+-  (std11-parse-msg-ids (std11-lexical-analyze string))
+-  )
++  (std11-parse-msg-ids (std11-lexical-analyze string)))
+ 
+ ;;;###autoload
+ (defun std11-extract-address-components (string)
+@@ -927,10 +931,8 @@
+   (let* ((structure (car (std11-parse-address-string
+ 			  (std11-unfold-string string))))
+          (phrase  (std11-full-name-string structure))
+-         (address (std11-address-string structure))
+-         )
+-    (list phrase address)
+-    ))
++         (address (std11-address-string structure)))
++    (list phrase address)))
+ 
+ 
+ ;;; @ end
diff --git a/flim/patches/patch-tests_test-rfc2231.el b/flim/patches/patch-tests_test-rfc2231.el
new file mode 100644
index 0000000000..358191571d
--- /dev/null
+++ b/flim/patches/patch-tests_test-rfc2231.el
@@ -0,0 +1,31 @@
+$NetBSD$
+
+sync to  lexical-binding
+
+--- /tmp/wip/flim/work/flim-1.14.9/./tests/test-rfc2231.el	2001-05-31 11:38:29.000000000 +0900
++++ ././tests/test-rfc2231.el	2018-07-29 22:48:22.287997569 +0900
+@@ -151,13 +151,13 @@
+ (luna-define-method test-rfc2231-encoded-word-1 ((case test-rfc2231))
+   (lunit-assert
+    (string=
+-    (eword-decode-encoded-word "=?US-ASCII?Q?Keith_Moore?=")
++    (eword-decode-string "=?US-ASCII?Q?Keith_Moore?=")
+     "Keith Moore")))
+ 
+ (luna-define-method test-rfc2231-encoded-word-2 ((case test-rfc2231))
+   (lunit-assert
+    (string=
+-    (eword-decode-encoded-word "=?US-ASCII*EN?Q?Keith_Moore?=")
++    (eword-decode-string "=?US-ASCII*EN?Q?Keith_Moore?=")
+     "Keith Moore")))
+ 
+ (luna-define-method test-rfc2231-encoded-word-3 ((case test-rfc2231))
+@@ -165,7 +165,7 @@
+    (eq
+     (get-text-property
+      0 'mime-language
+-     (eword-decode-encoded-word "=?US-ASCII*EN?Q?Keith_Moore?="))
++     (eword-decode-string "=?US-ASCII*EN?Q?Keith_Moore?="))
+     'en)))
+ 
+ ;;;


Home | Main Index | Thread Index | Old Index