From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#73431: Add `setf` support for `stream.el` in ELPA Date: Fri, 27 Sep 2024 20:08:11 +0000 Message-ID: <87tte0q2qc.fsf@posteo.net> 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14956"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Okamsn , Nicolas Petton , 73431@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 27 23:11:38 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 1suIFV-0003jn-PF for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Sep 2024 23:11:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1suIEb-0004UD-5Q; Fri, 27 Sep 2024 17:10:41 -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 1suIEV-0004T0-I9 for bug-gnu-emacs@gnu.org; Fri, 27 Sep 2024 17:10:36 -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 1suIEU-0008J1-6i for bug-gnu-emacs@gnu.org; Fri, 27 Sep 2024 17:10:35 -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=kgr8P/tQQGwaf65hTsdUvHyFKofHXuiSSjGIA7fQQrc=; b=QF425l/EIyRtrT/vYQULvqJ0hA7HexZPfi1Lsf6gAm5rwY/zLzYGxKnC5qudbeKuPehzK++k+XxqvVUKtiYB4s9ercW0oTymNod6O/qUj4WmBTyMcm8AFu51370FyfLS8Hz2fvMOs8LvOnnKCzDS25gX51xEN40R/Z+bexsot2F7kScNtLogmedO7I3MzxnseLOlie4goQezoxazfWnpNc4GMwuGStxNlbdL0AhFrzGPF6X8cH2LWjmGuTQWTEVYzaUmu/9IDo+h0qq7CbEmhIclvmq771+N0hi3Qgf1FyAA28OR/zKzehg/pHrXoOV3HgHK5pgR12jIjm/52WSBUA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1suIEw-0002NN-4t for bug-gnu-emacs@gnu.org; Fri, 27 Sep 2024 17:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Sep 2024 21:11: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.17274714198493 (code B ref 73431); Fri, 27 Sep 2024 21:11:02 +0000 Original-Received: (at 73431) by debbugs.gnu.org; 27 Sep 2024 21:10:19 +0000 Original-Received: from localhost ([127.0.0.1]:56842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suIEE-0002Ct-R9 for submit@debbugs.gnu.org; Fri, 27 Sep 2024 17:10:19 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:45297) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1suHXa-0007NM-Ep for 73431@debbugs.gnu.org; Fri, 27 Sep 2024 16:26:15 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 9AB7A240101 for <73431@debbugs.gnu.org>; Fri, 27 Sep 2024 22:08:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1727467693; bh=Cc1ZOfyEtAKpHLNT9HLxmRrobU5neQkCM/yhQlJRc2o=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:From; b=H5lGFcsjmwzHzXqssVZioBo5S0xx2rOUblEdJuY5XHv03I7PfgeHQf3xaG/eaFEB4 0v64Tu9i9ayypZ0nUydvsxYGX52wUod+2cMY7STIs1DC7081cmpPOPBHlXOLmb2RTN hwUkJOusth/cZg0BSMyb9O6/mFDUTy6rwrNZcoHclzyBER2xmSTkOoMsMe7hCC5fE4 MsuFjqWyyhCuaaVx09XP6RR/VUFfASc/JrqhMIeUhPbj6EVZ4v9FDeFfg8XzR6/bKl I+wRI5Fxo8dEsFBnyRHHvLHC4sZu14iE1f/bIRVmF+jJPEk29aYhY63wYPQIP7Qo5+ B93lNfmIu242g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4XFhNX3Kpcz6tvn; Fri, 27 Sep 2024 22:08:12 +0200 (CEST) In-Reply-To: (Stefan Monnier's message of "Fri, 27 Sep 2024 12:14:08 -0400") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt 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:292536 Archived-At: Stefan Monnier writes: >>>>> 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. Yeah, looking at it again, I don't see an easy way around that either, so just disregard my comment. Returning back to the bug report, that means that we should probably just always handle setf'ing any element in a stream as an error, right? > > Stefan > -- Philip Kaludercic on siskin