Questions tagged [setf]
The setf tag has no usage guidance.
9 questions
1
vote
0
answers
74
views
Setf not expanding
I'm trying to modify a member of lsp--client after registration. So I have something like the following in use-package.
(message "%s %s" (symbol-function 'lsp--client-new-connection)
(...
0
votes
0
answers
73
views
Getting error in hook: Symbol’s function definition is void: \(setf\ ekg-note-tags\)
I'm writing a pre-save hook for ekg (emacs knowledge graph), and getting an error I don't know how to figure out.
The error is triples--with-transaction: Symbol’s function definition is void: \(setf\ ...
1
vote
1
answer
142
views
How to find if an Emacs lisp function is setf-able?
Emacs Lisp setf macro allows you to set generalized variables. You can, for example change the size of the current window with the following form:
(setf (window-height) 10)
The macro will translate ...
3
votes
2
answers
960
views
setf + alist-get but with "equal" instead of "eq"?
I got a suggestion to use setf to replace value in an alist: Replace element in a list / add in case of absence, with custom test/key functions
The example was provided, but it doesn't work if key is ...
2
votes
1
answer
48
views
`cl-incf` returns inconsistent values
(setq ali '())
>>> nil
(cl-incf (alist-get 'a ali 0))
>>> ((a . 1))
(setf (alist-get 'b ali) 0)
>>> ((b . 0) (a . 1))
(cl-incf (alist-get 'b ali 0))
>>> 1
As you ...
4
votes
1
answer
421
views
How can I make `setf` work with `plist-get`?
There's no built-in setter for plist-get. Example:
(let ((pl '(:what (one))))
(push 'two (plist-get pl :what))
pl)
Error: let*: Symbol’s function definition is void: \(setf\ plist-get\)
How can I ...
2
votes
0
answers
31
views
Is there a generalized setter for buffer-modified-p?
It is very simple to define a simple generalized setter for buffer-modified-p:
(gv-define-simple-setter buffer-modified-p set-buffer-modified-p)
That enables constructs like:
(with-current-buffer "...
0
votes
3
answers
142
views
How do I remove :width and :height from an image created with create-image?
I am trying to make jabber.el support images sent from e.g. Conversations.
I download the image using url-retrieve-synchonously and call create-image to get an image which I can then use with insert-...
7
votes
1
answer
472
views
Setf weird expansion
Trying to understand what setf can do, I called
(macroexpand '(setf (aref vec i) val))
⇒ (let* ((v vec) (v i)) (aset v v val))
This seems obviously wrong.
However I couldn't create an actual ...