GNU bug report logs -
#79136
[PATCH] Inhibit warning for missing lexbind cookie in kkc init file
Previous Next
Full log
Message #8 received at 79136 <at> debbugs.gnu.org (full text, mbox):
> From: Sean Devlin <spd <at> toadstyle.org>
> 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))
This bug report was last modified 13 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.