Tag Archives: lexical scoping

Emacs Lisp lexical binding gotchas and related best practices

Table of Contents 1. motivation 2. non-local variables and closures 3. gotchas and best practices 3.1. code as data 3.2. invasion of special variable 3.3. – – – 3.4. mixing iteration, closures, and asynchronous programming together 4. testing tools 4.1. … Continue reading

Posted in Emacs, Lisp | Tagged , , , | Leave a comment

how to enable Unicode encoding, lexical scope, and CL functions in an Emacs Lisp file

Table of Contents 1. how to enable UTF-8 encoding 2. how to enable lexical scope 3. how to use CL functions I recommend Emacs beginners to enable at least three things in their elisp files (such as dotemacs files, a.k.a. … Continue reading

Posted in Emacs | Tagged , , , | 4 Comments

Differences between Common Lisp and Emacs Lisp

Table of Contents Motivation Comprehensive? first sight differences data types buffer local variables lexical scope and dynamic scope namespace call by sharing Three equality operators: eq, equal, eql functions that use the three equality operators The cl-lib package other functions … Continue reading

Posted in Emacs, Lisp | Tagged , , | 5 Comments

lexical scoping and dynamic scoping in Emacs Lisp

In this article, I demonstrate: difference between dynamic scoping and lexical scoping in Emacs Lisp what to watch out for with dynamic scoping what you can do with lexical scoping and lexical closures what happens when you mix lexical scoping … Continue reading

Posted in Emacs | Tagged , , , , | 16 Comments

how to check dynamically if lexical scoping is active in Emacs Lisp

The variable lexical-binding specifies whether to use lexical scoping when evaluating code in the current buffer or el file. But checking the value of this variable at a point of code is not a reliable way to check if lexical … Continue reading

Posted in Emacs | Tagged , , | 1 Comment