GNU bug report logs - #77679
[PATCH] recentf, abbrev: insert a lexical-binding cookie

Previous Next

Package: emacs;

Reported by: Arsen Arsenović <arsen <at> aarsen.me>

Date: Wed, 9 Apr 2025 12:24:02 UTC

Severity: normal

Tags: notabug, patch, wontfix

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Arsen Arsenović <arsen <at> aarsen.me>
To: bug-gnu-emacs <at> gnu.org
Cc: Arsen Arsenović <arsen <at> aarsen.me>
Subject: [PATCH] recentf, abbrev: insert a lexical-binding cookie
Date: Wed,  9 Apr 2025 14:21:06 +0200
* lisp/recentf.el (recentf-save-file-header): Change default
header to include a lexical-binding cookie.
* lisp/abbrev.el (write-abbrev-file): Insert a lexical-binding
cookie into abbrev files.
---
This fixes a few lexical-binding warnings I noticed when updating Emacs
today.

 lisp/abbrev.el  | 3 ++-
 lisp/recentf.el | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 93eb086da7a..2868919283a 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -270,7 +270,8 @@ write-abbrev-file
       (when (unencodable-char-position (point-min) (point-max) 'utf-8)
 	(setq coding-system-for-write 'utf-8-emacs))
       (goto-char (point-min))
-      (insert (format ";;-*-coding: %s;-*-\n" coding-system-for-write))
+      (insert (format ";;-*-coding: %s; lexical-binding: t;-*-\n"
+                      coding-system-for-write))
       (write-region nil nil file nil (and (not verbose) 0)))))
 
 (defun abbrev-edit-save-to-file (file)
diff --git a/lisp/recentf.el b/lisp/recentf.el
index 172ce704d93..c58964959e8 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -1316,7 +1316,8 @@ recentf-open-most-recent-file
 ;;; Save/load/cleanup the recent list
 ;;
 (defconst recentf-save-file-header
-  ";;; Automatically generated by `recentf' on %s.  -*- mode: lisp-data -*-\n"
+  ";;; Automatically generated by `recentf' on %s.  \
+-*- mode: lisp-data; lexical-binding: t; -*-\n"
   "Header to be written into the `recentf-save-file'.")
 
 (defconst recentf-save-file-coding-system
-- 
2.49.0





This bug report was last modified 101 days ago.

Previous Next


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