[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces
From: |
Okamsn |
Subject: |
bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces |
Date: |
Tue, 23 Apr 2024 02:10:42 +0000 |
Hello,
Currently, the use
(let ((arr (vector 0 1 2 3 4 5 6)))
(setf (map-elt (cl-subseq arr 3) 0)
27)
arr)
expands to
(let ((arr (vector 0 1 2 3 4 5 6)))
(let* ((v arr))
(condition-case nil
(with-no-warnings
(map-put! (cl-subseq v 3) 0 27 nil))
(map-not-inplace
(let* ((new (map-insert (cl-subseq v 3) 0 27)))
(progn
(cl-replace v new :start1 3 :end1 nil)
new))
27)))
arr)
which does not modify the original variable `arr` due to how `map-put!`
is being used. With the attached patch, it would expand to
(let ((arr (vector 0 1 2 3 4 5 6)))
(let* ((v arr))
(condition-case nil
(with-no-warnings
(let* ((m (cl-subseq v 3)))
(progn
(map-put! m 0 27 nil)
(let* ((new m))
(progn
(cl-replace v new :start1 3 :end1 nil)
new))
27)))
(map-not-inplace
(let* ((new (map-insert (cl-subseq v 3) 0 27)))
(progn
(cl-replace v new :start1 3 :end1 nil)
new))
27)))
arr)
which correctly sets the value using `cl-replace` as the setter for
`cl-subseq`.
Thank you.
0001-Make-setf-with-map-elt-work-with-subplaces.patch
Description: Text Data
- bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces,
Okamsn <=
- bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces, Michael Heerdegen, 2024/04/24
- bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces, Stefan Monnier, 2024/04/24
- bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces, okamsn, 2024/04/24
- bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces, Augusto Stoffel, 2024/04/25
- bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces, Michael Heerdegen, 2024/04/26
- bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces, okamsn, 2024/04/28
- bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces, Stefan Monnier, 2024/04/28
- bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces, Michael Heerdegen, 2024/04/30
bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces, Augusto Stoffel, 2024/04/25