Category Archives: Lisp

Lisp lists and destructive functions

Table of Contents 1. nil and non-nil 2. cons cell 3. cons cells in diagrams 4. lists 5. improper lists and proper lists 6. check for empty list, non-empty list, list 7. sequence 8. literal list 9. shared structure 10. … Continue reading

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

Names and things (reference semantics) vs. boxes and things (value semantics)

Table of Contents 1. Motivation 2. Alfie Bobbie thought experiment 3. The aa bb experiment (back to Snippet 20) 4. Boxes containing object references 5. Two different meanings of change 6. Pass by value or pass by reference 7. With … Continue reading

Posted in Emacs, Lisp, Python | Tagged , , | 1 Comment

It is not hard to edit Lisp code

Table of Contents 1. Intro 2. Which editor or IDE to use 3. The three phases 4. Always indent. 5. Evaluate! 6. One liners 7. Breaking lines 8. Joining lines 9. Placement of close parens 10. The “No red tape” … Continue reading

Posted in Emacs, Lisp | Tagged | 2 Comments

It is not hard to read Lisp code

Table of Contents 1. Intro 2. Tree view 3. Terminology 3.1. Emacs Lisp note 3.2. Common Lisp note 4. Variations 5. How to find where the expression ends. 6. Some difference from Python 7. Tools 8. Logical operators being used … Continue reading

Posted in Emacs, Lisp | Tagged , | 4 Comments

Checking Windows version with Emacs Lisp

elisp code example for programmatically checking the version of Microsoft Windows on which Emacs is running: (when (eq system-type ‘windows-nt) (print “Hello, MS Windows.”) (let ((winversion (when (string-match (rx “nt” (group (+ digit)) “.” (group (+ digit)) “.” (+ digit) … Continue reading

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

how to list emacs package dependencies

Table of Contents 1. how to see one-level dependencies of a package 2. how to programmatically collect the names of all the required packages for a given set of packages For now there is no command or function that recursively … Continue reading

Posted in Emacs, Lisp | Tagged , | 3 Comments

default argument in Python and Lisp

Table of Contents the Python mutable default argument gotcha how to give default arguments in Lisp comparing Lisp and Python the None trick and the nil trick further reading optional reading more on the Python gotcha the gotcha will get … Continue reading

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

emacs lisp and static variable

Table of Contents for a toggle function simply using global variables let over lambda optional reading symbol properties This post is part of the Living with Emacs Lisp series and is about the following question. How does one emulate static … Continue reading

Posted in Emacs, Lisp | Leave a comment

immutable objects and object identity

Table of Contents 1. Meaning of object in Python, Lisp, JavaScript 1.1. in JavaScript 1.2. in Python 1.3. In Common Lisp 1.4. in Emacs Lisp 1.5. value 1.6. JS objects 2. immutable objects and object identity 2.1. what is object … Continue reading

Posted in JavaScript, Lisp, Python | Tagged | Leave a comment

threading macros from dash for Emacs Lisp

Table of Contents 1. what are threading macros? where do they come from? 2. how to use the dash library 3. thread-first nesting and the thread-first macro 4. example uses of the thread-first macro 5. side note on fear of … Continue reading

Posted in Emacs, Lisp | Tagged , | 1 Comment