Add lexical cookie to new init files
authorMattias Engdegård <mattiase@acm.org>
Thu, 2 May 2024 11:34:22 +0000 (13:34 +0200)
committerMattias Engdegård <mattiase@acm.org>
Thu, 2 May 2024 11:34:22 +0000 (13:34 +0200)
* lisp/cus-edit.el (custom-save-all):
Add lexical cookie if the file is empty.

lisp/cus-edit.el

index e7d0eaa921581b6d7e6a2ca9b29dd630809deebf..2c1ba9bb9d7dc03b87947986131d59f6149b5952 100644 (file)
@@ -4971,6 +4971,8 @@ if only the first line of the docstring is shown."))
             ;; readably.  (Bug#52554)
             (print-escape-control-characters t))
         (atomic-change-group
+          (when (eobp)
+            (insert ";;; -*- lexical-binding: t -*-\n"))
          (custom-save-variables)
          (custom-save-faces)
           (custom-save-icons)))