5
votes
Accepted
Lambda in `defun` Captures the 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 ...
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-...
4
votes
the Term “Hash Notation“ in the Elisp Manual
Just for the second question:
The “Hash Notation” is just a kind of notation using “#”.
The mark “#” is named “hash mark”, so there is nothing to do with “hash function”.
4
votes
Is there any function that allows me to execute code on the run?
Normally for that style of work, there's the concept of inferior shells, where Emacs launches an inferior process (a.k.a. a subprocess) for an interpreter linked to a buffer that shows a REPL and ...
4
votes
Is there any function that allows me to execute code on the run?
Naturally shell-command-to-string cannot return a string until the
shell command in question has exited.
In Emacs you generally can and should work directly with buffers --
there is often no need to ...
4
votes
Lambda in `defun` Captures the 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 ...
3
votes
Advantages of setting variables with setq instead of custom.el?
Emacs 29 introduced a macro, setopt, for setting options outside of the customization interface. Like Drew explained, setq doesn't work right for options that use :set: for example try (setq show-...
3
votes
Accepted
“(equal a b)⇒t” whereas “(equal b a)⇒error”
Great question!
Emacs detects the circularity of a and reports it before it descends far enough into b to discover that they are equal.
The reason for the asymmetry is that Emacs only has to check for ...
2
votes
Why does lisp-interaction-mode exist, and do we ever need it?
Besides the differences mentioned in the other answers, there is a small but major difference between 'lisp-interaction-mode' and 'emacs-lisp-mode', which is that in 'lisp-interaction-mode' lexical ...
2
votes
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
vote
Lambda in `defun` Captures the 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 ...
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 ...
1
vote
Accepted
the Term “Hash Notation“ in the Elisp Manual
I’m not really sure that there is a widely–recognized name for these things in Emacs Lisp. The language has grown and changed over time, and things have been added to the language as needed. You could ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
elisp × 415elisp-macros × 25
functions × 23
org-mode × 18
hooks × 15
variables × 13
init-file × 12
regular-expressions × 9
files × 9
lexical-scoping × 9
key-bindings × 8
debugging × 8
string × 8
list × 7
text-properties × 7
quote × 7
symbols × 7
common-lisp × 7
buffers × 6
package × 6
window × 6
major-mode × 6
comment × 6
byte-compilation × 6
advice × 6