From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add an option to not reduce vocabulary of the Japanese Date: Sat, 04 Jun 2022 11:38:43 +0300 Message-ID: <83ee04bz70.fsf@gnu.org> References: <87r146o2rt.fsf@taiju.info> <8335gme0ml.fsf@gnu.org> <87a6auz1p4.fsf@taiju.info> <83pmjqc89p.fsf@gnu.org> <87sfolwyzj.fsf@taiju.info> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39211"; mail-complaints-to="usenet@ciao.gmane.io" Cc: handa@gnu.org, emacs-devel@gnu.org To: Taiju HIGASHI Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 04 10:40:24 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nxPKZ-000A43-Je for ged-emacs-devel@m.gmane-mx.org; Sat, 04 Jun 2022 10:40:23 +0200 Original-Received: from localhost ([::1]:49792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nxPKY-0004hj-Nj for ged-emacs-devel@m.gmane-mx.org; Sat, 04 Jun 2022 04:40:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxPJ3-0003Fb-FJ for emacs-devel@gnu.org; Sat, 04 Jun 2022 04:38:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47324) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxPJ3-0004Ap-6B; Sat, 04 Jun 2022 04:38:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=DYC+Kag6DfUOlaBxzmlfnRAt1GlMaHNpfJPO/MsvA2Q=; b=rkGTfS7CnIIR k0UwlfYj27RoBoPGaKCcCpNkAgM5hlLvWYlrqsdxRXLDlcp5RQt3GgljUc9IA07tp71rPWgPHpY00 loGj3kszu1xVBUq62TU3JsrqYUt24Z+6rMM3trkMWj+GeGa660Cc9zJvl3oSuARCITJW093JIZCUF rnuGSLL3sCMwpbnyfAaeZTJ1B4zmYFevLsr6YKY+0Ja/ajCxzxm/Z4MMSrbr1p0KxBSR6aeo+KYeD VkBWuy6OgEdC0zeG7qvSPkr1h9KLIlKArsrPmivhtxYQv3YD2oM12jFwwiwGEOSqSwKNS3ozH0ju4 hbFziiBI/IM9ZidQHr6DtQ==; Original-Received: from [87.69.77.57] (port=1822 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nxPJ2-0005xz-Lo; Sat, 04 Jun 2022 04:38:48 -0400 In-Reply-To: <87sfolwyzj.fsf@taiju.info> (message from Taiju HIGASHI on Sat, 04 Jun 2022 00:25:20 +0900) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:290644 Archived-At: [Please use Reply All when replying, to keep the mailing list and other people on the CC list.] > From: Taiju HIGASHI > Date: Sat, 04 Jun 2022 00:25:20 +0900 > > > Thanks, I sent the form off-list. > > Thank you, I sent an email to assign@gnu.org. > > I created a v2 patch. > > > >From 42932432cac237f3f32aac05377636af4c97da22 Mon Sep 17 00:00:00 2001 > From: Taiju HIGASHI > Date: Thu, 2 Jun 2022 23:24:13 +0900 > Subject: [PATCH v2] Add an option to not reduce vocabulary of the Japanese > dictionary. > > * configure.ac: Add "without-ja-dic-reduction" configure option. > * leim/Makefile.in (generate-ja-dic-without-reduction): Add rule. > (generate-ja-dic): Always rerun even if the target file is generated. > (${leimdir}/ja-dic/ja-dic.el): Do not reduce dictionary vocabulary if > The --without-ja-dic-reduction configure option is specified. > * lisp/Makefile.in (generate-ja-dic): Change the make target in the > leim directory. > * lisp/international/ja-dic-cnv.el (skkdic-convert-okuri-nasi): Add > "no-reduction" argument. > (skkdic-convert): Add "no-reduction" optional argument. > (batch-skkdic-convert): Add "--no-reduction" command line argument. > --- > configure.ac | 5 +++++ > leim/Makefile.in | 21 ++++++++++++++++++--- > lisp/Makefile.in | 2 +- > lisp/international/ja-dic-cnv.el | 26 ++++++++++++++++++-------- > 4 files changed, 42 insertions(+), 12 deletions(-) > > diff --git a/configure.ac b/configure.ac > index ed8ec890ac..43af4416d3 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -491,6 +491,7 @@ OPTION_DEFAULT_ON([threads],[don't compile with elisp threading support]) > OPTION_DEFAULT_OFF([native-compilation],[compile with Emacs Lisp native compiler support]) > OPTION_DEFAULT_OFF([cygwin32-native-compilation],[use native compilation on 32-bit Cygwin]) > OPTION_DEFAULT_ON([xinput2],[don't use version 2 of the X Input Extension for input]) > +OPTION_DEFAULT_ON([ja-dic-reduction],[don't reduce the Japanese dictionary]) > > AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB], > [use a file notification library (LIB one of: yes, inotify, kqueue, gfile, w32, no)])], > @@ -6491,6 +6492,7 @@ AS_ECHO([" Does Emacs use -lXaw3d? ${HAVE_XAW3D > Which dumping strategy does Emacs use? ${with_dumping} > Does Emacs have native lisp compiler? ${HAVE_NATIVE_COMP} > Does Emacs use version 2 of the the X Input Extension? ${HAVE_XINPUT2} > + Should Emacs reduce Japanese dictionary vocabulary? ${with_ja_dic_reduction} > "]) > > if test -n "${EMACSDATA}"; then > @@ -6589,6 +6591,9 @@ SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e > > AC_SUBST(SUBDIR_MAKEFILES_IN) > > +JA_DIC_REDUCTION=$with_ja_dic_reduction > +AC_SUBST(JA_DIC_REDUCTION) > + > dnl You might wonder (I did) why epaths.h is generated by running make, > dnl rather than just letting configure generate it from epaths.in. > dnl One reason is that the various paths are not fully expanded (see above); > diff --git a/leim/Makefile.in b/leim/Makefile.in > index 3b4216c0b8..c59f32c765 100644 > --- a/leim/Makefile.in > +++ b/leim/Makefile.in > @@ -32,6 +32,12 @@ leimdir = ${srcdir}/../lisp/leim > > EXEEXT = @EXEEXT@ > > +JA_DIC_REDUCTION = @JA_DIC_REDUCTION@ > +JA_DIC_NO_REDUCTION_OPTION = > +ifeq ($(JA_DIC_REDUCTION), no) > + JA_DIC_NO_REDUCTION_OPTION = --no-reduction > +endif > + > -include ${top_builddir}/src/verbose.mk > > # Prevent any settings in the user environment causing problems. > @@ -129,13 +135,22 @@ ${leimdir}/leim-list.el: ${srcdir}/leim-ext.el ${TIT_MISC} > > ${leimdir}/ja-dic/ja-dic.el: | $(leimdir)/ja-dic > > -.PHONY: generate-ja-dic > -generate-ja-dic: ${leimdir}/ja-dic/ja-dic.el > -${leimdir}/ja-dic/ja-dic.el: $(srcdir)/SKK-DIC/SKK-JISYO.L > +.PHONY: generate-ja-dic generate-ja-dic-without-reduction > +generate-ja-dic: $(srcdir)/SKK-DIC/SKK-JISYO.L $(leimdir)/ja-dic > $(AM_V_GEN)$(RUN_EMACS) -batch -l ja-dic-cnv \ > --eval "(setq max-specpdl-size 5000)" \ > -f batch-skkdic-convert -dir "$(leimdir)/ja-dic" "$<" > > +generate-ja-dic-without-reduction: $(srcdir)/SKK-DIC/SKK-JISYO.L $(leimdir)/ja-dic > + $(AM_V_GEN)$(RUN_EMACS) -batch -l ja-dic-cnv \ > + --eval "(setq max-specpdl-size 5000)" \ > + -f batch-skkdic-convert -dir "$(leimdir)/ja-dic" --no-reduction "$<" > + > +${leimdir}/ja-dic/ja-dic.el: $(srcdir)/SKK-DIC/SKK-JISYO.L > + $(AM_V_GEN)$(RUN_EMACS) -batch -l ja-dic-cnv \ > + --eval "(setq max-specpdl-size 5000)" \ > + -f batch-skkdic-convert -dir "$(leimdir)/ja-dic" $(JA_DIC_NO_REDUCTION_OPTION) "$<" > + > ${srcdir}/../lisp/language/pinyin.el: ${srcdir}/MISC-DIC/pinyin.map > $(AM_V_GEN)${RUN_EMACS} -l titdic-cnv -f pinyin-convert $< $@ > > diff --git a/lisp/Makefile.in b/lisp/Makefile.in > index 8728467977..191f022a84 100644 > --- a/lisp/Makefile.in > +++ b/lisp/Makefile.in > @@ -162,7 +162,7 @@ $(lisp)/finder-inf.el: > > # This is the OKURO-NASI compilation trigger. > generate-ja-dic: main-first > - $(AM_V_at)$(MAKE) -C ../leim generate-ja-dic EMACS="$(EMACS)" > + $(AM_V_at)$(MAKE) -C ../leim ${srcdir}/../lisp/leim/ja-dic/ja-dic.el EMACS="$(EMACS)" > $(AM_V_at)$(MAKE) compile-targets TARGETS="./leim/ja-dic/ja-dic.elc" > > org-manuals: main-first > diff --git a/lisp/international/ja-dic-cnv.el b/lisp/international/ja-dic-cnv.el > index 704f1a1ae6..7d3103fd8d 100644 > --- a/lisp/international/ja-dic-cnv.el > +++ b/lisp/international/ja-dic-cnv.el > @@ -295,7 +295,7 @@ > (setq skkdic-okuri-nasi-entries-count (length skkdic-okuri-nasi-entries)) > (progress-reporter-done progress)))) > > -(defun skkdic-convert-okuri-nasi (skkbuf buf) > +(defun skkdic-convert-okuri-nasi (skkbuf buf no-reduction) > (with-current-buffer buf > (insert ";; Setting okuri-nasi entries.\n" > "(skkdic-set-okuri-nasi\n") > @@ -311,7 +311,9 @@ > (setq count (1+ count)) > (progress-reporter-update progress count) > (if (setq candidates > - (skkdic-reduced-candidates skkbuf kana candidates)) > + (if no-reduction > + candidates > + (skkdic-reduced-candidates skkbuf kana candidates))) > (progn > (insert "\"" kana) > (while candidates > @@ -322,10 +324,12 @@ > (progress-reporter-done progress)) > (insert ")\n\n"))) > > -(defun skkdic-convert (filename &optional dirname) > +(defun skkdic-convert (filename &optional dirname no-reduction) > "Generate Emacs Lisp file from Japanese dictionary file FILENAME. > The format of the dictionary file should be the same as SKK dictionaries. > -Saves the output as `ja-dic-filename', in directory DIRNAME (if specified)." > +Saves the output as `ja-dic-filename', in directory DIRNAME (if specified). > +When NO-REDUCTION is t, then the dictionary is not reduced. > +" > (interactive "FSKK dictionary file: ") > (let* ((skkbuf (get-buffer-create " *skkdic-unannotated*")) > (buf (get-buffer-create "*skkdic-work*"))) > @@ -389,7 +393,7 @@ Saves the output as `ja-dic-filename', in directory DIRNAME (if specified)." > (skkdic-collect-okuri-nasi) > > ;; Convert okuri-nasi general entries. > - (skkdic-convert-okuri-nasi skkbuf buf) > + (skkdic-convert-okuri-nasi skkbuf buf no-reduction) > > ;; Postfix > (with-current-buffer buf > @@ -427,15 +431,21 @@ To get complete usage, invoke: > (message "To convert SKK-JISYO.L into skkdic.el:") > (message " %% emacs -batch -l ja-dic-cnv -f batch-skkdic-convert SKK-JISYO.L") > (message "To convert SKK-JISYO.L into DIR/ja-dic.el:") > - (message " %% emacs -batch -l ja-dic-cnv -f batch-skkdic-convert -dir DIR SKK-JISYO.L")) > - (let (targetdir filename) > + (message " %% emacs -batch -l ja-dic-cnv -f batch-skkdic-convert -dir DIR SKK-JISYO.L") > + (message "To convert SKK-JISYO.L into skkdic.el without reduction:") > + (message " %% emacs -batch -l ja-dic-cnv -f batch-skkdic-convert SKK-JISYO.L --no-reduction")) > + (let (targetdir filename no-reduction) > (if (string= (car command-line-args-left) "-dir") > (progn > (setq command-line-args-left (cdr command-line-args-left)) > (setq targetdir (expand-file-name (car command-line-args-left))) > (setq command-line-args-left (cdr command-line-args-left)))) > + (if (string= (car command-line-args-left) "--no-reduction") > + (progn > + (setq no-reduction t) > + (setq command-line-args-left (cdr command-line-args-left)))) > (setq filename (expand-file-name (car command-line-args-left))) > - (skkdic-convert filename targetdir))) > + (skkdic-convert filename targetdir no-reduction))) > (kill-emacs 0)) > > > -- > 2.36.1 > > > I had a little trouble in creating the new rules, so please point out > any problems. > > I implemented with the following policy. > > 1. When re-running make from the project root, skip dictionary > generation if it has already been generated > 2. In the Makefile in the leim directory, allow re-runs to regenerate > the dictionary. > > It was difficult for me personally to distinguish between using > leim/Makefile and lisp/Makefile. > > Since leim/Makefile seems to be executed via lisp/Makefile, I modified > leim/Makefile for convenience of dictionary generation and lisp/Makefile > for convenience when make is executed in the project root. I thought no changes were needed, because one could already say something like make ja-dic.el JA_DIC_REDUCTION='' Wouldn't that work? Perhaps in lisp/Makefile.in one should make sure the JA_DIC_REDUCTION value was propagated to the sub-make running in leim/, but that's all. Am I missing something? Thanks.