NetBSD Problem Report #60647

From zakinko@snowrabbit.org  Wed Aug 26 16:40:40 2026
Return-Path: <zakinko@snowrabbit.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.netbsd.org", Issuer "YR2" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id E97531A923B
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 26 Aug 2026 16:40:39 +0000 (UTC)
Message-Id: <20260826164036.2679FC92EA@bambi.snowrabbit.org>
Date: Thu, 27 Aug 2026 01:40:36 +0900 (JST)
From: Showta Ishizaki <zakinko@snowrabbit.org>
Reply-To: zakinko@snowrabbit.org
To: gnats-bugs@NetBSD.org
Cc: zakinko@snowrabbit.org
Subject: New package: inputmethod/anthy-unicode and inputmethod/anthy-unicode-elisp
X-Send-Pr-Version: 3.95
X-From4GNATS: "Showta Ishizaki via gnats" <gnats-admin@NetBSD.org>

>Number:         60647
>Category:       pkg
>Synopsis:       New package: inputmethod/anthy-unicode and inputmethod/anthy-unicode-elisp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 26 16:45:00 +0000 2026
>Closed-Date:    Fri Aug 28 11:31:36 +0000 2026
>Last-Modified:  Fri Aug 28 11:35:02 +0000 2026
>Originator:     Showta Ishizaki
>Release:        pkgsrc current (2026Q3)
>Organization:
>Environment:
System: NetBSD 11.0/amd64; also built on NetBSD 9.4 and 10.1

>Description:

anthy-unicode is the maintained fork of anthy.  The anthy in pkgsrc
(inputmethod/anthy) is 9100h, whose last release was in 2009; anthy-unicode
(https://github.com/fujiwarat/anthy-unicode) is still released and moves the
internal encoding from EUC-JP to UTF-8, which is where the name comes from.
FreeBSD has replaced japanese/anthy with japanese/anthy-unicode, and Debian's
anthy source package is now anthy-unicode; pkgsrc and OpenBSD still ship only
9100h.

These two packages add it, split the way inputmethod/anthy and
inputmethod/anthy-elisp are: anthy-unicode builds the C library, the agent
and the dictionaries with EMACS=no, and anthy-unicode-elisp installs the
Emacs lisp and is the only part that depends on EMACS_TYPE.  Everything is
installed under -unicode names (bin/anthy-agent-unicode,
lib/libanthy-unicode, the japanese-anthy-unicode input method, and the
elisp under .../anthy-unicode/), so anthy and anthy-unicode can be installed
side by side.  anthy-unicode ships a buildlink3.mk so a future
consumer built against the fork (an ibus or uim variant) can link it.

anthy-unicode-elisp carries one patch, patch-src-util_anthy-unicode.el.  The
elisp was modernised to names newer than the older Emacs versions pkgsrc
still accepts, so it no longer loads on emacs20 or converts on emacs21; the
patch guards the six removed names with fboundp/boundp and sets UTF-8 on the
pipe to the agent.  It has been sent upstream as fujiwarat/anthy-unicode#21
and can be dropped once a release includes it.  On emacs20 and emacs21 the
agent's UTF-8 also needs editors/mule-ucs, which the Makefile pulls in for
EMACS_VERSION_MAJOR < 22.

Built on NetBSD 11.0/amd64; pkglint is clean for both.  japanese-anthy-unicode
was driven through a conversion (nihongo -> the kanji) and
deactivate-input-method on emacs26, 28, 29, 30 and 31, and on emacs20.7 and
emacs21.4 with Mule-UCS installed.

>How-To-Repeat:

Unpack the shar below under pkgsrc/, add

	SUBDIR+=	anthy-unicode
	SUBDIR+=	anthy-unicode-elisp

to inputmethod/Makefile after anthy-elisp, then build
inputmethod/anthy-unicode-elisp (it pulls in inputmethod/anthy-unicode).

>Fix:
The shar of both directories follows.

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	anthy-unicode-elisp/DESCR
#	anthy-unicode-elisp/Makefile
#	anthy-unicode-elisp/PLIST
#	anthy-unicode/DESCR
#	anthy-unicode/Makefile
#	anthy-unicode/Makefile.common
#	anthy-unicode/PLIST
#	anthy-unicode/buildlink3.mk
#	anthy-unicode/distinfo
#	anthy-unicode/patches/patch-src-util_anthy-unicode.el
#
echo x - 'anthy-unicode-elisp/DESCR'
sed 's/^X//' >'anthy-unicode-elisp/DESCR' << 'END-of-anthy-unicode-elisp/DESCR'
XEmacs lisp files for anthy-unicode, the maintained Unicode fork of anthy.
XThey install as anthy-unicode.el and friends and talk to
Xanthy-agent-unicode, so they do not collide with inputmethod/anthy-elisp
Xand both can be installed at once.
END-of-anthy-unicode-elisp/DESCR
echo x - 'anthy-unicode-elisp/Makefile'
sed 's/^X//' >'anthy-unicode-elisp/Makefile' << 'END-of-anthy-unicode-elisp/Makefile'
X# $NetBSD$
X
X.include	"../../inputmethod/anthy-unicode/Makefile.common"
X
XPKGNAME=	${EMACS_PKGNAME_PREFIX}anthy-unicode-elisp-${ANTHY_UNICODE_VERSION}
XCATEGORIES=	inputmethod editors
X
XMAINTAINER=	pkgsrc-users@NetBSD.org
XCOMMENT=	Emacs lisp files for inputmethod/anthy-unicode
X
XDEPENDS+=	anthy-unicode>=${ANTHY_UNICODE_VERSION}:../../inputmethod/anthy-unicode
X
XUSE_LIBTOOL=		yes
XCONFIGURE_ENV+=		EMACS=${EMACS_BIN:Q}
XEMACS_MODULES+=		base leim
X
X# The accepted versions were measured, not guessed: on NetBSD 11.0/amd64 the
X# package was built with emacs26, 28, 29, 30 and 31, and with emacs20.7 and
X# emacs21.4, and japanese-anthy-unicode was driven through a conversion
X# (nihongo -> the kanji) and deactivate-input-method in each.  emacs26/27/28
X# are not listed because they were removed from pkgsrc and no longer appear
X# in editors/emacs/modules.mk, so naming them would not select anything.
X#
X# emacs20 and emacs21 additionally need the patch
X# (patch-src-util_anthy-unicode.el) and Mule-UCS; see the
X# EMACS_VERSION_MAJOR < 22 block below.
XEMACS_VERSIONS_ACCEPTED=	emacs29 emacs29nox
XEMACS_VERSIONS_ACCEPTED+=	emacs30 emacs30nox
XEMACS_VERSIONS_ACCEPTED+=	emacs31 emacs31nox
XEMACS_VERSIONS_ACCEPTED+=	emacs21 emacs21nox emacs20
X
X.include "../../editors/emacs/modules.mk"
X
X.if ${EMACS_VERSION_MAJOR} < 22
X# anthy-agent-unicode speaks UTF-8 and nothing else (src-util/input.c sets
X# ANTHY_UTF8_ENCODING unconditionally; --eucjp only reaches the --egg
X# protocol).  But Emacs 20 has no utf-8 coding system at all, and Emacs 21's
X# mule-utf-8 cannot represent CJK: the mule-unicode-* charsets cover
X# U+0100-U+33FF and U+E000-U+FFFF but not U+4E00-U+9FFF, and utf-translate-cjk
X# only arrives in Emacs 22.  Mule-UCS supplies a utf-8 that maps CJK onto
X# japanese-jisx0208, so both versions work through it.
X#
X# It is needed for byte compilation too: the 20/21 byte compiler writes the
X# decoded buffer with no-conversion, so the mule-unicode internal form (a
X# 4-byte sequence starting 0x9C) lands in the .elc verbatim and cannot be
X# read back.  Through Mule-UCS it becomes the 3-byte jisx0208 form and round
X# trips.
XDEPENDS+=	${EMACS_PKGNAME_PREFIX}Mule-UCS-[0-9]*:../../editors/mule-ucs
XELISP_PRELOAD=	-L ${EMACS_LISPPREFIX}/mule-ucs -l un-define
X.endif
X
XELISP_EL=	anthy-unicode.el anthy-unicode-azik.el anthy-unicode-conf.el \
X		anthy-unicode-dic.el anthy-unicode-isearch.el \
X		anthy-unicode-kyuri.el
X
X# Byte compile here rather than through the upstream Makefile (elisp-comp),
X# for two reasons: ELISP_PRELOAD has to be fed in first, and leim-list.el has
X# to be left out.  leim-list.el carries a no-byte-compile cookie on its first
X# line, but that cookie is only honoured from Emacs 22 on; the 20 and 21
X# batch-byte-compile write a leim-list.elc anyway, which is not in PLIST and
X# makes the install fail.
Xdo-build:
X	cd ${WRKSRC}/src-util && ${EMACS_BIN} -batch -q -no-site-file \
X		${ELISP_PRELOAD} -L . -f batch-byte-compile ${ELISP_EL}
X
Xdo-install:
X	${INSTALL_DATA_DIR} ${DESTDIR}${EMACS_LISPPREFIX}/anthy-unicode
X	${INSTALL_DATA} ${WRKSRC}/src-util/*.el	${DESTDIR}${EMACS_LISPPREFIX}/anthy-unicode
X	${INSTALL_DATA} ${WRKSRC}/src-util/*.elc ${DESTDIR}${EMACS_LISPPREFIX}/anthy-unicode
X
X.include "../../mk/bsd.pkg.mk"
END-of-anthy-unicode-elisp/Makefile
echo x - 'anthy-unicode-elisp/PLIST'
sed 's/^X//' >'anthy-unicode-elisp/PLIST' << 'END-of-anthy-unicode-elisp/PLIST'
X@comment $NetBSD$
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-azik.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-azik.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-conf.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-conf.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-dic.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-dic.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-isearch.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-isearch.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-kyuri.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode-kyuri.elc
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode.el
X${EMACS_LISPPREFIX}/anthy-unicode/anthy-unicode.elc
X${EMACS_LISPPREFIX}/anthy-unicode/leim-list.el
END-of-anthy-unicode-elisp/PLIST
echo x - 'anthy-unicode/DESCR'
sed 's/^X//' >'anthy-unicode/DESCR' << 'END-of-anthy-unicode/DESCR'
XAnthy is a Japanese kana-kanji conversion engine.  anthy-unicode is the
Xmaintained fork of anthy 9100h, whose last release was in 2009.  It moves
Xthe internal encoding from EUC-JP to UTF-8, from which it takes its name,
Xand installs everything under -unicode names so that it can be used
Xalongside the original.
END-of-anthy-unicode/DESCR
echo x - 'anthy-unicode/Makefile'
sed 's/^X//' >'anthy-unicode/Makefile' << 'END-of-anthy-unicode/Makefile'
X# $NetBSD$
X
X.include	"../../inputmethod/anthy-unicode/Makefile.common"
X
XMAINTAINER=	pkgsrc-users@NetBSD.org
XCOMMENT=	Kana Kanji conversion system (Unicode fork of anthy)
X
XUSE_LIBTOOL=		yes
XUSE_TOOLS+=		printf
X
XCONFIGURE_ENV+=		EMACS=no
XEGDIR=			${PREFIX}/share/examples/anthy-unicode
XINSTALL_MAKE_FLAGS+=	sysconfdir=${EGDIR}
XCONF_FILES+=		${EGDIR}/anthy-unicode.conf ${PKG_SYSCONFDIR}/anthy-unicode.conf
XINSTALLATION_DIRS=	share/doc/anthy-unicode
X
XPKGCONFIG_OVERRIDE+=	anthy-unicode.pc.in
X
XUNLIMIT_RESOURCES+=	stacksize
X
Xpost-install:
X.for f in doc/DICUTIL doc/ELISP doc/GUIDE.english README README.en
X	${INSTALL_DATA} ${WRKSRC}/${f} ${DESTDIR}${PREFIX}/share/doc/anthy-unicode
X.endfor
X
X.include	"../../mk/bsd.pkg.mk"
END-of-anthy-unicode/Makefile
echo x - 'anthy-unicode/Makefile.common'
sed 's/^X//' >'anthy-unicode/Makefile.common' << 'END-of-anthy-unicode/Makefile.common'
X# $NetBSD$
X# used by inputmethod/anthy-unicode/Makefile
X# used by inputmethod/anthy-unicode-elisp/Makefile
X
XANTHY_UNICODE_VERSION=	1.0.0.20260213
XDISTNAME=		anthy-unicode-${ANTHY_UNICODE_VERSION}
XCATEGORIES=		inputmethod
XMASTER_SITES=		${MASTER_SITE_GITHUB:=fujiwarat/}
XGITHUB_PROJECT=		anthy-unicode
XGITHUB_RELEASE=		${ANTHY_UNICODE_VERSION}
X
XDISTINFO_FILE=		${.CURDIR}/../../inputmethod/anthy-unicode/distinfo
XPATCHDIR=		${.CURDIR}/../../inputmethod/anthy-unicode/patches
X
XHOMEPAGE=		https://github.com/fujiwarat/anthy-unicode/
XLICENSE=		gnu-gpl-v2
X
XGNU_CONFIGURE=		yes
XUSE_LANGUAGES=		c
END-of-anthy-unicode/Makefile.common
echo x - 'anthy-unicode/PLIST'
sed 's/^X//' >'anthy-unicode/PLIST' << 'END-of-anthy-unicode/PLIST'
X@comment $NetBSD$
Xbin/anthy-agent-unicode
Xbin/anthy-dic-tool-unicode
Xbin/anthy-morphological-analyzer-unicode
Xinclude/anthy-unicode-1.0/anthy/anthy.h
Xinclude/anthy-unicode-1.0/anthy/dicutil.h
Xinclude/anthy-unicode-1.0/anthy/input.h
Xlib/libanthy-unicode.la
Xlib/libanthydic-unicode.la
Xlib/libanthyinput-unicode.la
Xlib/pkgconfig/anthy-unicode.pc
Xshare/anthy-unicode/anthy.dic
Xshare/anthy-unicode/dic-tool-usage.txt
Xshare/anthy-unicode/typetab
Xshare/anthy-unicode/zipcode.t
Xshare/doc/anthy-unicode/DICUTIL
Xshare/doc/anthy-unicode/ELISP
Xshare/doc/anthy-unicode/GUIDE.english
Xshare/doc/anthy-unicode/README
Xshare/doc/anthy-unicode/README.en
Xshare/examples/anthy-unicode/anthy-unicode.conf
END-of-anthy-unicode/PLIST
echo x - 'anthy-unicode/buildlink3.mk'
sed 's/^X//' >'anthy-unicode/buildlink3.mk' << 'END-of-anthy-unicode/buildlink3.mk'
X# $NetBSD$
X
XBUILDLINK_TREE+=	anthy-unicode
X
X.if !defined(ANTHY_UNICODE_BUILDLINK3_MK)
XANTHY_UNICODE_BUILDLINK3_MK:=
X
XBUILDLINK_API_DEPENDS.anthy-unicode+=	anthy-unicode>=1.0.0.20260213
XBUILDLINK_PKGSRCDIR.anthy-unicode?=	../../inputmethod/anthy-unicode
X.endif # ANTHY_UNICODE_BUILDLINK3_MK
X
XBUILDLINK_TREE+=	-anthy-unicode
END-of-anthy-unicode/buildlink3.mk
echo x - 'anthy-unicode/distinfo'
sed 's/^X//' >'anthy-unicode/distinfo' << 'END-of-anthy-unicode/distinfo'
X$NetBSD$
X
XBLAKE2s (anthy-unicode-1.0.0.20260213.tar.gz) = 184005918110fb3381927d20052ff541fb826e5e376ee4aa7c55715f19c201db
XSHA512 (anthy-unicode-1.0.0.20260213.tar.gz) = fcb7651c3d1cfa389fc1d25606c088528154e659668af92908c202b5cf936f81fc28b616f3bc764be4835a8016c347c1a7e0a14691bd1a7697bac3df842d694e
XSize (anthy-unicode-1.0.0.20260213.tar.gz) = 5184155 bytes
XSHA1 (patch-src-util_anthy-unicode.el) = c7c2c59eb0d3a4e7c32a4093197ea48a45901d82
END-of-anthy-unicode/distinfo
echo x - 'anthy-unicode/patches/patch-src-util_anthy-unicode.el'
sed 's/^X//' >'anthy-unicode/patches/patch-src-util_anthy-unicode.el' << 'END-of-anthy-unicode/patches/patch-src-util_anthy-unicode.el'
X$NetBSD$
X
XMake anthy-unicode.el work on the older Emacs versions pkgsrc still carries,
Xnot only on a current one.
X
Xanthy-unicode inherited anthy 9100h's elisp and modernised the names it uses.
XThat is the mirror image of what 9100h now does on a current Emacs: where
X9100h calls names Emacs has since removed, anthy-unicode calls names Emacs 20
Xand 21 do not have yet.
X
X  set-face-underline              new in Emacs 22.1; Emacs 20 has
X                                  set-face-underline-p only.  The call is at
X                                  top level, so on Emacs 20 loading the file
X                                  signals an error, and anthy-unicode-isearch
X                                  and anthy-unicode-kyuri then fail to
X                                  byte-compile because they require it --
X                                  5 of the 7 .elc files get built.
X  mapc                            new in Emacs 21.  9100h used mapcar in this
X                                  same line, which every Emacs and XEmacs has.
X  set-process-query-on-exit-flag  new in Emacs 22.1; Emacs 20 and 21 have
X                                  process-kill-without-query.  It is called
X                                  from anthy-check-agent, which starts the
X                                  agent, so on Emacs 21 the package builds
X                                  cleanly and dies on the first conversion.
X  deactivate-current-input-method-function,
X  deactivate-input-method         renamed from inactivate-* in Emacs 24.3.
X                                  Emacs 20 and 21 know the old names only, so
X                                  the input method cannot be switched off.
X
XThe coding system of the pipe to the agent is set explicitly as well.
Xanthy-agent-unicode speaks UTF-8 -- src-util/input.c sets
XANTHY_UTF8_ENCODING unconditionally, and --eucjp only reaches the --egg
Xprotocol, which the elisp does not use.  9100h's anthy.el set euc-japan on
Xthe pipe for exactly this reason; anthy-unicode commented that out and left
Xthe Emacs default in charge, which is utf-8 only on a current Emacs.  On
XEmacs 21 with the Japanese language environment the default decodes the
Xagent's replies as euc-jp, and the conversion result arrives as mojibake.
X
XEmacs 20 has no utf-8 coding system at all, and Emacs 21's mule-utf-8 cannot
Xrepresent CJK ideographs: it decodes into the mule-unicode-* charsets, which
Xcover U+0100-U+33FF and U+E000-U+FFFF but not U+4E00-U+9FFF, and
Xutf-translate-cjk does not exist before Emacs 22.  So the kanji come back as
Xeight-bit characters, and a .elc compiled from these UTF-8 sources cannot be
Xread back either, because the compiler writes the mule-unicode internal form
Xstraight into the .elc.  Mule-UCS supplies a utf-8 that maps CJK onto
Xjapanese-jisx0208 and fixes both, so it is loaded when emacs-major-version is
Xbelow 22.  The require is wrapped in condition-case, so nothing changes where
XMule-UCS is not installed, and nothing at all happens on Emacs 22 and later.
X
XFrom Emacs 21 on, the byte compiler warns that the value from mapcar is
Xunused and suggests mapc or dolist.  The same warning is already raised twice
Xin this package -- anthy-unicode-azik.el:226 and anthy-unicode-conf.el:108
Xcall mapcar the same way -- so this adds a third of a warning that is already
Xthere, which is the price of keeping Emacs 20 in the accepted list.  Guarding
Xthe one call with fboundp would cost more lines than the warning is worth.
X
XMeasured on NetBSD 11.0/amd64 with emacs 20.7, 21.4 and 30.2: with this patch
Xand Mule-UCS, all three byte-compile the six files, convert nihongo to the
Xkanji, and deactivate the input method cleanly.  Without it, Emacs 20 stops
Xat load and Emacs 21 at the first conversion.
X
X--- src-util/anthy-unicode.el.orig
X+++ src-util/anthy-unicode.el
X@@ -70,12 +70,23 @@
X (defvar anthy-agent-unicode-command-list '("anthy-agent-unicode")
X   "anthy-agent-unicodeのPATH 名")
X 
X+;; Emacs 20 と 21 の utf-8 は CJK を含まない (20 には utf-8 そのものが無い)。
X+;; anthy-agent-unicode は UTF-8 で話すので、Mule-UCS があれば載せる。
X+(if (and (not (featurep 'xemacs))
X+	 (< emacs-major-version 22)
X+	 (not (featurep 'un-define)))
X+    (condition-case nil
X+	(require 'un-define)
X+      (error nil)))
X+
X ;; face
X (defvar anthy-highlight-face nil)
X (defvar anthy-underline-face nil)
X (copy-face 'highlight 'anthy-highlight-face)
X (if (not (featurep 'xemacs))
X-    (set-face-underline 'anthy-highlight-face t))
X+    (if (fboundp 'set-face-underline)
X+	(set-face-underline 'anthy-highlight-face t)
X+      (set-face-underline-p 'anthy-highlight-face t)))
X (copy-face 'underline 'anthy-underline-face)
X 
X ;;
X@@ -250,7 +261,7 @@
X 	(delete-region start (+ start len))
X 	(goto-char start)))
X   (setq anthy-preedit "")
X-  (mapc 'delete-overlay anthy-preedit-overlays)
X+  (mapcar 'delete-overlay anthy-preedit-overlays)
X   (setq anthy-preedit-overlays nil))
X 
X (defun anthy-select-face-by-attr (attr)
X@@ -752,7 +763,11 @@
X 	(if anthy-agent-unicode-process
X 	    (kill-process anthy-agent-unicode-process))
X 	(setq anthy-agent-unicode-process proc)
X-	(set-process-query-on-exit-flag proc nil)
X+	(if (fboundp 'set-process-query-on-exit-flag)
X+	    (set-process-query-on-exit-flag proc nil)
X+	  (process-kill-without-query proc))
X+	(if (coding-system-p 'utf-8)
X+	    (set-process-coding-system proc 'utf-8 'utf-8))
X ;;	(if anthy-xemacs
X ;;	    (if (coding-system-p (find-coding-system 'euc-japan))
X ;;		(set-process-coding-system proc 'euc-japan 'euc-japan))
X@@ -871,7 +886,9 @@
X ;; leim の activate
X ;;
X (defun anthy-unicode-leim-activate (&optional name)
X-  (setq deactivate-current-input-method-function 'anthy-unicode-leim-inactivate)
X+  (if (boundp 'deactivate-current-input-method-function)
X+      (setq deactivate-current-input-method-function 'anthy-unicode-leim-inactivate)
X+    (setq inactivate-current-input-method-function 'anthy-unicode-leim-inactivate))
X   (setq anthy-leim-active-p t)
X   (anthy-update-mode)
X   (when (eq (selected-window) (minibuffer-window))
X@@ -881,7 +898,9 @@
X ;; emacsのバグ避けらしいです
X ;;
X (defun anthy-unicode-leim-exit-from-minibuffer ()
X-  (deactivate-input-method)
X+  (if (fboundp 'deactivate-input-method)
X+      (deactivate-input-method)
X+    (inactivate-input-method))
X   (when (<= (minibuffer-depth) 1)
X     (remove-hook 'minibuffer-exit-hook 'anthy-unicode-leim-exit-from-minibuffer)))
X 
END-of-anthy-unicode/patches/patch-src-util_anthy-unicode.el
exit


>Release-Note:

>Audit-Trail:
From: Showta Ishizaki <zakinko@snowrabbit.org>
To: gnats-bugs@NetBSD.org
Cc: zakinko@snowrabbit.org
Subject: Re: pkg/60647: New package: inputmethod/anthy-unicode and inputmethod/anthy-unicode-elisp
Date: Fri, 28 Aug 2026 08:42:23 +0900 (JST)

 Please replace patch-src-util_anthy-unicode.el from the shar with the one
 below.  Working on the upstream pull request (fujiwarat/anthy-unicode#21)
 turned up two problems with the version I sent.

 The first is that it adds byte-compile warnings on Emacs 24 and later.  It
 wrote the old names directly in an else branch, so an Emacs that does not
 have them reports "not known to be defined"; on Emacs 30 the count went from
 nine to fourteen.  Picking the name once at load time and calling through a
 variable adds none.

 The second is the coding system on the pipe: it should be 'utf-8-unix, not
 'utf-8.  Plain utf-8 leaves the end-of-line undecided and the decoding side
 settles on utf-8-dos.

 While there, two problems that have nothing to do with Emacs 20 and 21 also
 turned up, and the new patch fixes them.  The coding system on the pipe is
 left to the locale, so a ja_JP.eucJP or ja_JP.SJIS user gets mojibake out of
 the conversion; and the undo list anthy puts aside while a preedit is open is
 shared by every buffer, so opening a preedit in a second buffer overwrites
 what the first one saved and the first buffer gets the wrong undo history
 back.  Both happen on Emacs 22.3 through 31.1.

 The patch was applied to the 1.0.0.20260213 tarball and the six .el files
 byte-compiled the way the package does it -- with Mule-UCS preloaded on
 Emacs 20 and 21 -- then exercised from the .elc alone: 6 of 6 files compiled
 with no warnings on Emacs 20.7, 21.4 and 30.2, and japanese-anthy-unicode
 converted nihongo and switched off again under both ja_JP.UTF-8 and
 ja_JP.eucJP on all three.

 The elisp itself was measured more widely on NetBSD 11.0/amd64, with Emacs
 20.7, 21.4, 22.3, 23.4, 24.5, 25.3, 26.3, 27.2, 28.2, 29.4, 30.2, 31.1 and
 XEmacs 21.4.25.

 Once upstream takes it the patch can be dropped.  PKGREVISION is not touched,
 the package not being in the tree yet.

 $NetBSD$

 Fix the coding system on the pipe to the agent, keep each buffer's saved undo
 list to itself, and let the file work on the older Emacs versions pkgsrc
 still carries.

 The first two are not about old Emacs at all.  anthy-agent-unicode speaks
 UTF-8 and nothing else, but nothing sets the coding system on the pipe, so
 Emacs uses default-process-coding-system, which follows the user's locale.
 Under a ja_JP.eucJP or ja_JP.SJIS locale the conversion comes back as
 mojibake on Emacs 22.3 through 31.1 alike.  utf-8-unix is set explicitly;
 the -unix matters, because plain utf-8 leaves the end-of-line undecided and
 the decoding side settles on utf-8-dos.

 anthy stops undo while a preedit is open and puts the buffer's undo list
 aside until the text is committed.  The flag saying it did so is
 anthy-deflocalvar, that is per buffer, but the list itself was an undeclared
 global shared by every buffer, so opening a preedit in a second buffer
 overwrote what the first one had put aside, and the first buffer got the
 second one's undo history when it committed.

 anthy-restore-undo-list is dead: the two places that set the variable it
 reads and its one call site are all commented out, as they already were in
 anthy 9100h.  It is commented out too rather than deleted, the same way its
 callers are, so that taking the semicolons off brings it back.

 The rest is the older Emacs versions.  Each name is picked once at load time
 and called through a variable:

   set-face-underline              Emacs 20 has only set-face-underline-p, and
                                   until 24.3 that is the current spelling.
                                   The call is at top level, so on Emacs 20 the
                                   file does not load and only 4 of the 6 .elc
                                   files get built.
   set-process-query-on-exit-flag  new in 22.1.  It is called from
                                   anthy-check-agent, so Emacs 21 and XEmacs
                                   build and load and then die at the first
                                   conversion.
   deactivate-input-method,
   deactivate-current-input-method-function
                                   renamed from inactivate-* in 24.3.  Emacs 22
                                   and 23 convert and then cannot leave the
                                   input method: void-function nil, because the
                                   variable they read stays nil.
   mapc                            new in Emacs 21; 9100h used mapcar here.

 Writing the old name in an else branch would work, but a current Emacs then
 reports it as not known to be defined, so this goes through a variable.  The
 XEmacs-only names in anthy-last-command-char get the same treatment, and a
 lexical-binding cookie is added, which together take Emacs 24 and later from
 nine byte-compile warnings to none.

 Emacs 20, 21 and XEmacs 21.4 have no utf-8 coding system that covers CJK, so
 Mule-UCS is required there, inside condition-case so that nothing happens
 where it is not installed and nothing at all happens from Emacs 22 on.
 XEmacs takes a coding system object rather than a symbol, so the value goes
 through find-coding-system there.

 Measured on NetBSD 11.0/amd64 with Emacs 20.7, 21.4, 22.3, 23.4, 24.5, 25.3,
 26.3, 27.2, 28.2, 29.4, 30.2, 31.1 and XEmacs 21.4.25, typing nihongo,
 converting, committing and switching the input method off again.

 Sent upstream as fujiwarat/anthy-unicode#21; this can be dropped once a
 release includes it.

 --- src-util/anthy-unicode.el.orig
 +++ src-util/anthy-unicode.el
 @@ -1,4 +1,4 @@
 -;;; anthy-unicode.el -- Anthy
 +;;; anthy-unicode.el -- Anthy  -*- lexical-binding: nil -*-

  ;; Copyright (C) 2001 - 2007 KMC(Kyoto University Micro Computer Club)
  ;; Copyright (C) 2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
 @@ -70,12 +70,73 @@
  (defvar anthy-agent-unicode-command-list '("anthy-agent-unicode")
    "anthy-agent-unicodeのPATH 名")

 +;; XEmacs にしか無い名前。anthy-xemacs が真のときしか呼ばないが、直接書くと
 +;; GNU Emacs の byte compiler が "not known to be defined" と言う。
 +(defvar anthy-event-matches-key-specifier-p-function
 +  'event-matches-key-specifier-p)
 +(defvar anthy-event-to-character-function 'event-to-character)
 +(defvar anthy-char-to-int-function 'char-to-int)
 +
 +;; Emacs 22.1 から。Emacs 20/21 と XEmacs は process-kill-without-query。
 +;; どちらも第二引数 nil で「終了時に問い合わせない」の意味になる。
 +(defvar anthy-set-process-no-query-function
 +  (if (fboundp 'set-process-query-on-exit-flag)
 +      'set-process-query-on-exit-flag
 +    'process-kill-without-query))
 +
 +;; Emacs 24.3 で inactivate-* から改名された。Emacs 20 から 23 と XEmacs は
 +;; 旧名しか持たない。
 +(defvar anthy-deactivate-input-method-function
 +  (if (fboundp 'deactivate-input-method)
 +      'deactivate-input-method
 +    'inactivate-input-method))
 +(defvar anthy-deactivate-current-input-method-variable
 +  (if (boundp 'deactivate-current-input-method-function)
 +      'deactivate-current-input-method-function
 +    'inactivate-current-input-method-function))
 +
 +;; Emacs 21 から。Emacs 20 と XEmacs は set-face-underline-p のみ。24.3 までは
 +;; -p の方が正で、こちらが obsolete。ここは top level なので、無い版では load
 +;; そのものが失敗する。
 +(defvar anthy-set-face-underline-function
 +  (if (fboundp 'set-face-underline)
 +      'set-face-underline
 +    'set-face-underline-p))
 +
 +;; Emacs 21 から。Emacs 20 には無く、anthy 9100h はこの行で mapcar だった。
 +;; 返り値は捨てるので、どちらでも同じ。
 +(defvar anthy-mapc-function
 +  (if (fboundp 'mapc)
 +      'mapc
 +    'mapcar))
 +
 +;; Emacs 20 と 21 の utf-8 は CJK を含まない (20 には utf-8 そのものが無い)。
 +;; XEmacs 21.4 にも utf-8 が無い。agent は UTF-8 でしか話さないので、
 +;; Mule-UCS があれば載せる。
 +(if (and (or (featurep 'xemacs)
 +	     (< emacs-major-version 22))
 +	 (not (featurep 'un-define)))
 +    (condition-case nil
 +	(require 'un-define)
 +      (error nil)))
 +
 +;; XEmacs の coding-system-p は symbol ではなく coding system オブジェクトを
 +;; 取るので、find-coding-system を通す。
 +(defvar anthy-agent-coding-system
 +  (if (featurep 'xemacs)
 +      (and (fboundp 'find-coding-system)
 +	   (find-coding-system 'utf-8-unix))
 +    (and (coding-system-p 'utf-8-unix)
 +	 'utf-8-unix)))
 +
  ;; face
  (defvar anthy-highlight-face nil)
  (defvar anthy-underline-face nil)
  (copy-face 'highlight 'anthy-highlight-face)
 +;(if (not (featurep 'xemacs))
 +;    (set-face-underline 'anthy-highlight-face t))
  (if (not (featurep 'xemacs))
 -    (set-face-underline 'anthy-highlight-face t))
 +    (funcall anthy-set-face-underline-function 'anthy-highlight-face t))
  (copy-face 'underline 'anthy-underline-face)

  ;;
 @@ -202,6 +263,9 @@
  (anthy-deflocalvar anthy-current-rkmap "hiragana")
  ; undo
  (anthy-deflocalvar anthy-buffer-undo-list-saved nil)
 +;; 待避した undo list そのもの。旗だけ buffer local で中身が global だったので、
 +;; buffer を二つ使うと片方の履歴がもう片方のもので上書きされていた。
 +(anthy-deflocalvar anthy-buffer-undo-list nil)

  ;;
  (defvar anthy-wide-space " " "スペースを押した時に出て来る文字")
 @@ -250,7 +314,8 @@
  	(delete-region start (+ start len))
  	(goto-char start)))
    (setq anthy-preedit "")
 -  (mapc 'delete-overlay anthy-preedit-overlays)
 +;  (mapc 'delete-overlay anthy-preedit-overlays)
 +  (funcall anthy-mapc-function 'delete-overlay anthy-preedit-overlays)
    (setq anthy-preedit-overlays nil))

  (defun anthy-select-face-by-attr (attr)
 @@ -546,14 +611,17 @@
  	  (char-to-string ch)
  	nil))))

 -(defun anthy-restore-undo-list (commit-str)
 -  (let* ((len (length commit-str))
 -	 (beginning (point))
 -	 (end (+ beginning len)))
 -    (setq buffer-undo-list
 -	  (cons (cons beginning end)
 -		(cons nil anthy-saved-buffer-undo-list)))
 -	 ))
 +;; 呼び出し側も、anthy-saved-buffer-undo-list を設定する二箇所も、元から
 +;; コメントアウトされている。この関数だけが生きていて、呼べば void-variable に
 +;; なる。同じように閉じておく。
 +;(defun anthy-restore-undo-list (commit-str)
 +;  (let* ((len (length commit-str))
 +;	 (beginning (point))
 +;	 (end (+ beginning len)))
 +;    (setq buffer-undo-list
 +;	  (cons (cons beginning end)
 +;		(cons nil anthy-saved-buffer-undo-list)))
 +;	 ))

  (defun anthy-proc-agent-reply (repl)
    (let*
 @@ -752,7 +820,13 @@
  	(if anthy-agent-unicode-process
  	    (kill-process anthy-agent-unicode-process))
  	(setq anthy-agent-unicode-process proc)
 -	(set-process-query-on-exit-flag proc nil)
 +;	(set-process-query-on-exit-flag proc nil)
 +	(funcall anthy-set-process-no-query-function proc nil)
 +;	(if (coding-system-p 'utf-8-unix)
 +;	    (set-process-coding-system proc 'utf-8-unix 'utf-8-unix))
 +	(if anthy-agent-coding-system
 +	    (set-process-coding-system proc anthy-agent-coding-system
 +				       anthy-agent-coding-system))
  ;;	(if anthy-xemacs
  ;;	    (if (coding-system-p (find-coding-system 'euc-japan))
  ;;		(set-process-coding-system proc 'euc-japan 'euc-japan))
 @@ -871,7 +945,9 @@
  ;; leim の activate
  ;;
  (defun anthy-unicode-leim-activate (&optional name)
 -  (setq deactivate-current-input-method-function 'anthy-unicode-leim-inactivate)
 +;  (setq deactivate-current-input-method-function 'anthy-unicode-leim-inactivate)
 +  (set anthy-deactivate-current-input-method-variable
 +       'anthy-unicode-leim-inactivate)
    (setq anthy-leim-active-p t)
    (anthy-update-mode)
    (when (eq (selected-window) (minibuffer-window))
 @@ -881,7 +957,8 @@
  ;; emacsのバグ避けらしいです
  ;;
  (defun anthy-unicode-leim-exit-from-minibuffer ()
 -  (deactivate-input-method)
 +;  (deactivate-input-method)
 +  (funcall anthy-deactivate-input-method-function)
    (when (<= (minibuffer-depth) 1)
      (remove-hook 'minibuffer-exit-hook 'anthy-unicode-leim-exit-from-minibuffer)))

 @@ -891,14 +968,24 @@
  ;;
  (defun anthy-last-command-char ()
    "最後の入力イベントを返す。XEmacs では int に変換する"
 +;  (if anthy-xemacs
 +;      (let ((event last-command-event))
 +;	(cond
 +;	 ((event-matches-key-specifier-p event 'left)      2)
 +;	 ((event-matches-key-specifier-p event 'right)     6)
 +;	 ((event-matches-key-specifier-p event 'backspace) 8)
 +;	 (t
 +;	  (char-to-int (event-to-character event)))))
 +;    last-command-event))
    (if anthy-xemacs
        (let ((event last-command-event))
  	(cond
 -	 ((event-matches-key-specifier-p event 'left)      2)
 -	 ((event-matches-key-specifier-p event 'right)     6)
 -	 ((event-matches-key-specifier-p event 'backspace) 8)
 +	 ((funcall anthy-event-matches-key-specifier-p-function event 'left)      2)
 +	 ((funcall anthy-event-matches-key-specifier-p-function event 'right)     6)
 +	 ((funcall anthy-event-matches-key-specifier-p-function event 'backspace) 8)
  	 (t
 -	  (char-to-int (event-to-character event)))))
 +	  (funcall anthy-char-to-int-function
 +		   (funcall anthy-event-to-character-function event)))))
      last-command-event))

  ;;

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Fri, 28 Aug 2026 11:31:36 +0000
State-Changed-Why:
Committed, thank you!


From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60647 CVS commit: pkgsrc/inputmethod/anthy-unicode
Date: Fri, 28 Aug 2026 11:30:25 +0000

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Fri Aug 28 11:30:25 UTC 2026

 Added Files:
 	pkgsrc/inputmethod/anthy-unicode: DESCR Makefile Makefile.common PLIST
 	    buildlink3.mk distinfo
 	pkgsrc/inputmethod/anthy-unicode/patches:
 	    patch-src-util_anthy-unicode.el

 Log Message:
 inputmethod/anthy-unicode: import anthy-unicode-1.0.0.20260213

 Provided by Showta Ishizaki in PR 60647.

 Anthy is a Japanese kana-kanji conversion engine.  anthy-unicode is the
 maintained fork of anthy 9100h, whose last release was in 2009.  It moves
 the internal encoding from EUC-JP to UTF-8, from which it takes its name,
 and installs everything under -unicode names so that it can be used
 alongside the original.


 To generate a diff of this commit:
 cvs rdiff -u -r0 -r1.1 pkgsrc/inputmethod/anthy-unicode/DESCR \
     pkgsrc/inputmethod/anthy-unicode/Makefile \
     pkgsrc/inputmethod/anthy-unicode/Makefile.common \
     pkgsrc/inputmethod/anthy-unicode/PLIST \
     pkgsrc/inputmethod/anthy-unicode/buildlink3.mk \
     pkgsrc/inputmethod/anthy-unicode/distinfo
 cvs rdiff -u -r0 -r1.1 \
     pkgsrc/inputmethod/anthy-unicode/patches/patch-src-util_anthy-unicode.el

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

From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60647 CVS commit: pkgsrc/inputmethod/anthy-unicode-elisp
Date: Fri, 28 Aug 2026 11:30:35 +0000

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Fri Aug 28 11:30:35 UTC 2026

 Added Files:
 	pkgsrc/inputmethod/anthy-unicode-elisp: DESCR Makefile PLIST

 Log Message:
 inputmethod/anthy-unicode-elisp: import anthy-unicode-elisp-1.0.0.20260213

 Provided by Showta Ishizaki in PR 60647.

 Emacs lisp files for anthy-unicode, the maintained Unicode fork of anthy.
 They install as anthy-unicode.el and friends and talk to
 anthy-agent-unicode, so they do not collide with inputmethod/anthy-elisp
 and both can be installed at once.


 To generate a diff of this commit:
 cvs rdiff -u -r0 -r1.1 pkgsrc/inputmethod/anthy-unicode-elisp/DESCR \
     pkgsrc/inputmethod/anthy-unicode-elisp/Makefile \
     pkgsrc/inputmethod/anthy-unicode-elisp/PLIST

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

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.