New answers tagged

1 vote

Lambda in `defun` Captures the Complete Lexical Environment, But in `let` It Doesn't

This answer is an extension of Phils answer. Your question shows the potential danger of locally binding special-declared variables. The convention of prefixing symbol names with library names ...
  • 31.7k
3 votes

Lambda in `defun` Captures the Complete Lexical Environment, But in `let` It Doesn't

A long comment instead of an answer. (SE limits the length of a comment.) Hi phils, this is my comment on your answer. potentially causing other functions, called later in the stack, to obtain an ...
  • 1,311
5 votes
Accepted

Lambda in `defun` Captures the Complete Lexical Environment, But in `let` It Doesn't

(defvar wtf 10) made wtf bound dynamically so the variable g would get a closure which captured nothing. This is correct. However, this cannot explain what (f 20) returned. It can if, under lexical ...
  • 46.2k
5 votes
Accepted

Is it faster to add an element at the beginning of a list with add-to-list than at the end?

No, it is always faster to add in the beginning (except that add-to-list has to scan the whole list anyway - as pointed out by @phils in a comment). However, performance is never an issue with add-to-...
  • 5,783
1 vote

the Term “Hash Notation“ in the Elisp Manual

It seems that the GNU Emacs Lisp Reference Manual has actually cleared up this misunderstanding. See Chapter 8 Hash Tables: Hash notation, the initial ‘#’ character used in the printed ...
  • 1,311
0 votes

Is there any way to run a hook function only once?

To achieve run "only once", you could using require. It allow you assure the code is executed only when the first time require, when you "provide" it in a file and add the contains ...
  • 3
1 vote

the term “constant” in Elisp

Does it have only one definition just mentioned in that section? You also won't like the other usage of "constant". defconst can be used to define an intended-to-be-constant variable, but ...
  • 46.2k
0 votes

the term “constant” in Elisp

Some other languages have adopted the term “literal” (such as a “string literal” or an “object literal”), but that doesn’t mean that Emacs Lisp should change the terminology it uses. After all, Emacs ...
  • 14.4k

Top 50 recent answers are included