Questions tagged [mutability]
4 questions
9
votes
2 answers
Proper reinitialization of a list? What is happening under the hood?
I'm teaching myself some more elisp and have encountered the following problem:
If I want to reset a list variable it won't get updated after the first evaluation. Here is some example code:
(defun initilize ()
(setq example '(3)))
(defun modify…

clemera
- 3,401
- 13
- 40
5
votes
2 answers
“A mutable object stops being mutable if it is part of an expression that is evaluated.”
GNU Emacs Lisp Reference Manual, section 2.9 Mutability:
A mutable object stops being mutable if it is part of an expression that is evaluated. For example:
(let* ((x (list 0.5))
(y (eval (list 'quote x))))
(setcar x 1.5) ;; The program…

shynur
- 4,065
- 1
- 3
- 23
3
votes
1 answer
Why is this function not pure
I just spent a significant amount of time debugging an issue that boils down to the following:
(defun my-new-alist ()
`((x . nil)))
(setq a (my-new-alist))
(setq b (my-new-alist))
(push 1 (alist-get 'x a))
b ;; ((x . 1))
I expected a and b to…

Clément
- 3,924
- 1
- 22
- 37
2
votes
1 answer
Run an external shell command to mutate text
I would like to run par or fmt to format my .md file.
In vim this would be %!fmt (for the whole buffer) or 13,16!fmt (for line 13 - line 16).
What's the "emacs way" to achieve something like this
PS: I am aware of evil-mode(If I wanted vi…

Benjamin Philip
- 59
- 4