From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Okamsn via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70524: [PATCH] Fix `map-elt` with `setf` for subplaces Date: Tue, 23 Apr 2024 02:10:42 +0000 Message-ID: Reply-To: Okamsn Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="b1_mEdZrw8tdZDEdt6hXfg7OSynWeQY3nEXp0RPG4GR9c" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23780"; mail-complaints-to="usenet@ciao.gmane.io" To: 70524@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 23 04:12:16 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rz5do-00063W-1m for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Apr 2024 04:12:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rz5dO-0000Wt-N2; Mon, 22 Apr 2024 22:11:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rz5dM-0000WV-J1 for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 22:11:48 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rz5dL-0000ff-Fs for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 22:11:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rz5db-0002lO-Dw for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 22:12:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Okamsn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Apr 2024 02:12:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70524 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.171383828510322 (code B ref -1); Tue, 23 Apr 2024 02:12:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Apr 2024 02:11:25 +0000 Original-Received: from localhost ([127.0.0.1]:49121 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rz5cw-0002g6-Fo for submit@debbugs.gnu.org; Mon, 22 Apr 2024 22:11:25 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:41416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rz5cq-0002fA-Qj for submit@debbugs.gnu.org; Mon, 22 Apr 2024 22:11:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rz5cV-0000T6-04 for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 22:10:55 -0400 Original-Received: from mail-4322.protonmail.ch ([185.70.43.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rz5cS-0000bG-UD for bug-gnu-emacs@gnu.org; Mon, 22 Apr 2024 22:10:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1713838249; x=1714097449; bh=g2HmWwIGdW3dgPgQGM9e93WbhSBaRBJU5uHsv6fslms=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=PF8Zi4AmbzsLp9cSxhBMErqzovey50uy6/d/3DbeDJOrrvOdqFEL1HQ4IkaCz9g7h +PkYpqBRSCtc9zBMfHuAxbow0qzESgizMgUAHTKOjDXY4+RXJJwbmPSvyuaEz2J9SA qzJAjyrG+ek+pypyh2m4CSrIeAUrDYAQ3PzoVKmu6wVnd0VdFB3Gdnh9rMiwtIDRQ2 SqOJw6emuVmzHVoMdCO9wwz4ECfb25O5dhf93psJH8VANp9ATn1LL1tT+ClmZ3tQUu 0/T73+BJ3oHg1WcesLabzZKnhiKRVaGIuvA8D41xlyYQsloarjBQMtD/HqprAxd9NC rq+qcZ7ESf54w== Feedback-ID: 25935600:user:proton X-Pm-Message-ID: ffd85a7cf8bcef56506f39471b78cb88e56e3cca Received-SPF: pass client-ip=185.70.43.22; envelope-from=okamsn@protonmail.com; helo=mail-4322.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283857 Archived-At: This is a multi-part message in MIME format. --b1_mEdZrw8tdZDEdt6hXfg7OSynWeQY3nEXp0RPG4GR9c Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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!`=20 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=20 `cl-subseq`. Thank you. --b1_mEdZrw8tdZDEdt6hXfg7OSynWeQY3nEXp0RPG4GR9c Content-Type: text/x-patch; charset=UTF-8; name=0001-Make-setf-with-map-elt-work-with-subplaces.patch Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=0001-Make-setf-with-map-elt-work-with-subplaces.patch RnJvbSAxYWM2NTg1OGRjMmYyNDE5NzVkZjg2MjBhYzc5Yzk3M2ZjYzZkYWQ0IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBFYXJsIEh5YXR0IDxva2Ftc25AcHJvdG9ubWFpbC5jb20+CkRh dGU6IE1vbiwgMjIgQXByIDIwMjQgMjE6N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gMSBkZWxldGlvbigtKQoKZGlmZiAtLWdpdCBhL2xpc3AvZW1hY3Mt bGlzcC9tYXAuZWwgYi9saXNwL2VtYWNzLWxpc3AvbWFwLmVsCmluZGV4IGQzZDcxYTM2ZWU0Li5m YWNmZGQ4ZGU3YiAxMDA2NDQKLS0tIGEvbGlzcC9lbWFjcy1saXNwL21hcC5lbAorKysgYi9saXNw L2VtYWNzLWxpc3AvbWFwLmVsCkBAIC0xNjcsNyArMTY3LDExIEBAIG1hcC1lbHQKICAgICAgICAg ICAgICAgICAgICAgICAgYChjb25kaXRpb24tY2FzZSBuaWwKICAgICAgICAgICAgICAgICAgICAg ICAgICAgICA7OyBTaWxlbmNlIHdhcm5pbmdzIGFib3V0IHRoZSBoaWRkZW4gNHRoIGFyZy4KICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAod2l0aC1uby13YXJuaW5ncwotICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgKG1hcC1wdXQhICxtZ2V0dGVyICxrZXkgLHYgLHRlc3RmbikpCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsKG1hY3JvZXhwLWxldDIgbmlsIG0gbWdldHRl cgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYChwcm9nbgorICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgKG1hcC1wdXQhICxtICxrZXkgLHYgLHRlc3RmbikKKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICwoZnVuY2FsbCBtc2V0dGVyIG0pCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAsdikpKQogICAgICAgICAgICAgICAg ICAgICAgICAgICAobWFwLW5vdC1pbnBsYWNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAs KGZ1bmNhbGwgbXNldHRlcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGAo bWFwLWluc2VydCAsbWdldHRlciAsa2V5ICx2KSkKZGlmZiAtLWdpdCBhL3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