Subject: bug#25203: [cjk] Fwd: HELP with emacs 25.1 and cjk-enc.el

From: Hin-Tak Leung <[email-masked]>
Date: Fri, 16 Dec 2016 14:18:21 +0000 (UTC)

--------------------------------------------
On Fri, 16/12/16, Eli Zaretskii <[email-masked]> wrote:
 
> Sorry, I don't understand the question. 
 Can you elaborate?
 
It is not a question - it is a follow-up correction to a proposed (wrong) bug fix to cjk-enc.el.

This thread was started because cjk-enc.el broke with emacs 25. So I was close
enough - and made it worse to crash with two new mesage()'s. The crash surprisingly helps, in the end.
The initial breakage was because there was already a message() (for progress reporting, which
has worked for 10+ years until 24.5) a few lines above the two new ones I added. 

The relevant change in emacs 25 is, as you suggested, this:
http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=c63246628461f748d66a8a07ba008de2e00fd33a
'Obey coding-system-for-write when writing stdout/stderr in batch'

There seems to be another breakage of cjk-enc.el - somehow, `write-region in emacs 25 for big5 input
is calling cjk-encode (pre-write-conversion) more than once, and the 2nd time wrongly. This only
happens with emacs 25 and only with big5 input (i.e. not with earlier emacs nor thai/mule input).
So there is another recursion somewhere - still looking...

I added a (backtrace) to cjk-encode and the 2nd+ calls are also from write-region - so definitely needs
C-level debugging to look further  ( https://debbugs.gnu.org/cgi/bugreport.cgi?bug=8108 )

Yes, the issue with crash with message() in pre-write-conversion is well-understood now,
and thanks a lot for all the help. Bug 25203 can close.