Hi all,

Emacs 30 now emits a warning when it loads an .el file without the
lexical-binding cookie (commits 81bad84a6 and 1121f17d7c).  This is the
entry from Emacs NEWS:

    *** Warn about missing 'lexical-binding' directive.
    The compiler now warns if an Elisp file lacks the standard
    '-*- lexical-binding: ... -*-' cookie on the first line.
    This line typically looks something like

        ;;; My little pony mode  -*- lexical-binding: t -*-

    It is needed to inform the compiler about which dialect of ELisp
    your code is using: the modern dialect with lexical binding or
    the old dialect with only dynamic binding.

    Lexical binding avoids some name conflicts and allows the compiler to
    detect more mistakes and generate more efficient code, so it is
    recommended.  For how to adapt your code to lexical binding, see the
    manual section "(elisp) Converting to Lexical Binding".

    If your code cannot be converted to lexical binding, you can insert
    the line

        ;;; -*- lexical-binding: nil -*-

    first in the file to declare that it uses the old dialect.

This change affects all auto-parsed style files when AUCTeX loads them.
I suggest the following change to `TeX-auto-store' in tex.el:

--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index cda1d7f6..32cfd21e 100644
--- a/tex.el
+++ b/tex.el
@@ -4267,6 +4267,8 @@ If TEX is a directory, generate style files for all files 
in the directory."
         (TeX-unload-style style)
         (with-current-buffer (generate-new-buffer file)
           (erase-buffer)
+          (insert (concat ";;" (make-string 40 ?\s)
+                          "-*- lexical-binding: t; -*-\n\n"))
           (insert "(TeX-add-style-hook\n \""
                   style "\"\n (lambda ()")
           (unless (string= tex-cmd-opts "")
--8<---------------cut here---------------end--------------->8---

Any comments welcome.

Best, Arash



_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to