GNU bug report logs - #34215
27.0.50; Provide elisp access to Chinese pinyin-to-character mapping

Previous Next

Package: emacs;

Reported by: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Date: Sun, 27 Jan 2019 05:44:01 UTC

Severity: wishlist

Found in version 27.0.50

Done: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Bug is archived. No further changes may be made.

Full log


Message #29 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#34215: 27.0.50;
 Provide elisp access to Chinese pinyin-to-character mapping
Date: Wed, 30 Jan 2019 12:33:56 -0800
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
>> Date: Tue, 29 Jan 2019 09:48:30 -0800
>> 
>> I've attached a diff adding the conversion function itself, but I'm not
>> familiar with makefiles and so far haven't been able to figure out how
>> to call it. It looks like the invocation I want will look like:
>> 
>> $(AM_V_GEN)${RUN_EMACS} -l titdic-cnv -f pinyin-convert \
>>   ${srcdir}/MISC-DIC/pinyin.map ${srcdir}/../lisp/language/pinyin.el
>> 
>> Where ${srcdir} is the leim directory, but I don't actually know how to
>> get this code called by make...
>
> Add a target that is the file produced by this command, then make the
> above command the recipe of that target.  Similar to the
> ${leimdir}/ja-dic/ja-dic.el target.
>
> But if the above doesn't help, someone else could do this part for
> you.

I've attached this as a commit patch -- it seems to work fine but I
would appreciate it if you'd check it.

>> > I understand, but I wonder if someone could try that for a while and
>> > see if it makes better input method(s), before we decide to import it.
>> 
>> FWIW, that mapping is used by the pyim package, which I believe is the
>> most popular pinyin-based Chinese input method out there. I also use it
>> via the system-wide input framework fcitx, and it works very well.
>
> Then I guess we will be fine importing the new version.

Cool -- I'll file another report for this in a bit.

>> +(defun pinyin-convert ()
>> +  "Convert text file pinyin.map into an elisp library.
>> +The library is named pinyin.el, and contains the constant
>> +`pinyin-character-map'."
>
> This writes out a .el file, but does it encode that file in UTF-8,
> even if the locale's codeset is something other than UTF-8?  If not,
> you need to bind coding-system-for-write to UTF-8.
>
>> +      (insert ";; This file is automatically generated from pinyin.map,\
>> + by the function pinyin-convert.")
>
> This line is too long, suggest to break it in two.
>
>> +      (insert ")\n\"An alist holding correspondences between pinyin syllables\
>> + and Chinese characters.\")\n")
>
> Likewise here.

Okay, I've fixed all of the above. Thanks for the pointers.

Eric
[0001-Make-pinyin-to-Chinese-character-mapping-available-t.patch (text/x-patch, attachment)]

This bug report was last modified 6 years and 82 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.