Hacker News (curated)new | past | comments | ask | show | jobs| show hidden

It's just a Lisp dialect at the end of the day and not much more complicated to learn than Javascript. The only unusual aspect is its prevalent use of dynamic scoping, although nowadays lexical scoping is also available and encouraged AFAIK.


emacs 31+ started emiting this warning for my custom Lisp files:

Warning (files): Missing ‘lexical-binding’ cookie in "~/.emacs.d/custom.el". You can add one with ‘M-x elisp-enable-lexical-binding RET’. See ‘(elisp)Selecting Lisp Dialect’ and ‘(elisp)Converting to Lexical Binding’ for more information.

I am still trying to figure out what to do! The manual is quite verbose and I haven't had the patience to go through it yet.


If you open the file and execute:

  M-x elisp-enable-lexical-binding RET
It will add a cookie (lexical-binding) to the top of the file. If you want to do it manually put this:

  ;; -*- lexical-binding: nil; -*-
or this:

  ;; -*- lexical-binding: t; -*-
at the top of your custom.el file. They want it to be explicit now because eventually lexical will be the default. If you put in the former then when lexical becomes the default, the file will still use the current dynamic bindings. And if you use the latter, if there are issues you'll discover them now before the default changes and you're surprised by it.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact | github