From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73431: Add `setf` support for `stream.el` in ELPA Date: Fri, 27 Sep 2024 12:14:08 -0400 Message-ID: References: <827cc7fc-10be-4b93-bd67-f275193e5d84@protonmail.com> <87ikultl1v.fsf@posteo.net> <2522160a-761c-4f23-a9c7-4740b49681f1@protonmail.com> <87o74bqy9g.fsf@posteo.net> <87jzexqgg8.fsf@posteo.net> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33246"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Okamsn , Nicolas Petton , 73431@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 27 18:14:49 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 1suDcH-0008VD-2s for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Sep 2024 18:14:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suDc4-0006O2-0K; Fri, 27 Sep 2024 12:14:36 -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 1suDc2-0006Ni-1d for bug-gnu-emacs@gnu.org; Fri, 27 Sep 2024 12:14:34 -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 1suDc1-0002qJ-OB for bug-gnu-emacs@gnu.org; Fri, 27 Sep 2024 12:14:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=VV4tgx/w4CKwZmrfrV5Vc/1cMPq5/7z4K4K4P8GqmzE=; b=qU/uECwRuTaj09ZVRJnWzjk9Flv2ZUD83J6oaok7UnBcTA5DBP0XyQXy4MK6QcvUKFkJa/R0USbTfYnIEJmwEV6Be7H+fMIGdTDuvDSx1YH6Q5c+9K+I03CGkMOpBmRlbLpCk4udhVMlMHPVpUHJju/ghU46CMZIyvzmqdmRDJVf602vJOrV3c0QwHtlwFFcnJ3XuJ8D7uy09n8o+A8O3bEIQxVvB6oP0HBHYNiVkWUE2aLC5p0nuFDQ/1dWU4ea/+XnedBp5aQfeayTr0RuXixXCbtgz2benQg3YY19PwSk5Dr3jkOdAAFWRc7iKEUcJQ6U3h4bZ6D59XYHdl7sMg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1suDcU-0006NQ-6r for bug-gnu-emacs@gnu.org; Fri, 27 Sep 2024 12:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Sep 2024 16:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73431 X-GNU-PR-Package: emacs Original-Received: via spool by 73431-submit@debbugs.gnu.org id=B73431.172745368924467 (code B ref 73431); Fri, 27 Sep 2024 16:15:02 +0000 Original-Received: (at 73431) by debbugs.gnu.org; 27 Sep 2024 16:14:49 +0000 Original-Received: from localhost ([127.0.0.1]:40901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suDcH-0006MZ-5v for submit@debbugs.gnu.org; Fri, 27 Sep 2024 12:14:49 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43915) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suDcF-0006MC-7U for 73431@debbugs.gnu.org; Fri, 27 Sep 2024 12:14:48 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4006A44192C; Fri, 27 Sep 2024 12:14:11 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1727453650; bh=S4bkAe9/5rq0GkDjeh869ySOx3Q4AbzWj5r1xVbcKHM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=leMplqgcZ68ASPvpwCHs6bZeB9qhGIAM8A2HOHnq8iRv7dKPelJ88W4DHKLEwleil W8V6LLoX3vdvB8kjunsZ5+3WIVY6GPQVOn5KAlo654HJWN8dNKrc5Wg0z/jmsnbcgi +lYF4k9urpiK2CKS3oGz2mviwA6Yv0OYrGXvxm5sjzwKAiCTW0c10dU9PlHuJMRiIQ 8iPijBXKhQcOkx/3OhL3qz/28pOtRkKRXvoF5hwIGRxnWzYYS0U8uwB8UaXUlgN3rF qC3TalqR8QXiauxSvVWpNDggQFwNdg668WRjOHgi/RibGqj/Yy7UTeZsYP0PpzSbX8 I7QuQ104XWT9w== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 37D6C4417B8; Fri, 27 Sep 2024 12:14:10 -0400 (EDT) Original-Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 142611203AB; Fri, 27 Sep 2024 12:14:10 -0400 (EDT) In-Reply-To: <87jzexqgg8.fsf@posteo.net> (Philip Kaludercic's message of "Fri, 27 Sep 2024 15:11:51 +0000") 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:292529 Archived-At: >>>> Sounds like a bug, indeed. But I'd rather fix it by making it fail >>>> cleanly, to preserve the (current) immutability of streams (at least >>>> until we decide that there's a good reason for streams to be mutable). >>> One exception to the immutability of stream might be buffers? >> >> Sorry, I don't follow. What do you mean by that? > > Using (stream (current-buffer)) i create a stream of things in the > current buffer. E.g. using > > (seq-find > (lambda (line) > (and line (string-match-p "seq" line))) > (stream (current-buffer) nil 'defun)) > > I can try to find the first top level definition that contains a > substring (the need to check if the value is non-nil is a bit annoying). > > Being able to modify the head of a buffer-stream using setf seems like > something that could be useful, and certainly more efficient than what > many people want to do with splitting the return value of > (buffer-string). Ah, I see. From afar I can see why that could make sense. But I can't see how it can fit into the current `stream.el` API and the proposed `setf`: there is no infrastructure I can see to make it possible to keep the stream object in sync with modifications made to the buffer, nor to keep the buffer in sync with modifications made to the stream. Stefan