> On Aug 2, 2025, at 4:08 AM, Eli Zaretskii wrote: > >> From: Sean Devlin >> Date: Thu, 31 Jul 2025 13:21:07 -0500 >> >> This change is to suppress a warning for a missing lexical-binding >> cookie in the kkcrc file used by the Japanese input method. Emacs >> generates this file, and AFAICT it is not meant to be edited by users. >> >> To reproduce the warning: >> >> 1. mkdir /tmp/emacs-kkcrc >> 2. HOME=/tmp/emacs-kkcrc emacs >> 3. q > Dismiss the start screen >> 4. C-\ japanese RET >> 5. nihongo SPC RET > Enter some Japanese text >> 6. C-x C-c >> 7. Repeat steps 2-5 >> >> On the second iteration of step 5, you should seen a warning message >> when Emacs loads the kkcrc file. >> >> I looked at how this was handled elsewhere and made the attached patch. > > Thanks. The patch you send was almost okay, but we want in addition > to make sure this file does have the cookie when written by Emacs 31 > and later. So please see if the alternative patch below gives good > results. > > diff --git a/lisp/international/kkc.el b/lisp/international/kkc.el > index 6d603cf..9abf35f 100644 > --- a/lisp/international/kkc.el > +++ b/lisp/international/kkc.el > @@ -64,9 +64,12 @@ kkc-save-init-file > (not (eq kkc-init-file-flag t))) > (let ((coding-system-for-write 'iso-2022-7bit) > (print-length nil)) > - (write-region (format "(setq kkc-lookup-cache '%S)\n" kkc-lookup-cache) > - nil > - kkc-init-file-name)))) > + (write-region > + (format > + "-*- lexical-binding: t; -*-\n\n(setq kkc-lookup-cache '%S)\n" > + kkc-lookup-cache) > + nil > + kkc-init-file-name)))) > > ;; Sequence of characters to be used for indexes for shown list. The > ;; Nth character is for the Nth conversion in the list currently shown. > @@ -178,7 +181,8 @@ kkc-lookup-key > (add-hook 'kill-emacs-hook 'kkc-save-init-file) > (if (file-readable-p kkc-init-file-name) > (condition-case nil > - (load-file kkc-init-file-name) > + (let ((warning-inhibit-types '((files missing-lexbind-cookie)))) > + (load-file kkc-init-file-name)) > (kkc-error "Invalid data in %s" kkc-init-file-name)))) > (or (and (nested-alist-p kkc-lookup-cache) > (eq (car kkc-lookup-cache) kkc-lookup-cache-tag)) Thanks Eli. I tried this patch, but there was an error reading the kkcrc file. The file-local property line is missing a comment at the beginning. See if the attached patch works. (I also split up the string formatting to make it more readable to me, but feel free to change it back if you prefer a single function call.) Cheers.