From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Mutating existing persistent data Date: Tue, 07 Dec 2021 06:08:43 +0100 Message-ID: <87v901huhw.fsf@gnus.org> References: <87tufmjyai.fsf@gnus.org> <875ys2lyt0.fsf@yahoo.com> <87wnkhlxb9.fsf@yahoo.com> <2FD7D920-D92C-480B-B2AC-91A17F0397C4@mit.edu> <87zgpdi0rk.fsf@gnus.org> <878rwxje1x.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1441"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Qiantan Hong , John Yates , Stefan Monnier , Arthur Miller , "emacs-devel@gnu.org" To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 07 06:09:53 2021 Return-path: Envelope-to: ged-emacs-devel@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 1muSjg-000AcM-PM for ged-emacs-devel@m.gmane-mx.org; Tue, 07 Dec 2021 06:09:52 +0100 Original-Received: from localhost ([::1]:41140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muSjf-0003a8-Mp for ged-emacs-devel@m.gmane-mx.org; Tue, 07 Dec 2021 00:09:51 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muSiq-0002ts-19 for emacs-devel@gnu.org; Tue, 07 Dec 2021 00:09:00 -0500 Original-Received: from [2a01:4f9:2b:f0f::2] (port=34546 helo=quimby.gnus.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muSio-00016B-3e for emacs-devel@gnu.org; Tue, 07 Dec 2021 00:08:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=MWyclIfMj87otS/uMIgAe5YhgBDYuVeqkBiMHGqHjjc=; b=RlUtg6+2ayaKGQU4BEZHwLOokY zNrUa8lchqsoY1U1cNaJG1FlhYFZ1fNkHVzicIBSgMddp9AuPRujKOVlBjQqwCkQUyDsWZDdZrBq7 8SGnkoX5nC5gabB9ClJ4wADWJI62jG57ykG1qXP33piRdy+Aa9fyAk8hzIpLxcDBFBK0=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muSif-0003bx-5T; Tue, 07 Dec 2021 06:08:51 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEX38d7Uy6mmoZXE uqCJg3n99axtaWT///95LnurAAAAAWJLR0QHFmGI6wAAAAd0SU1FB+UMBwUBMZx0BrkAAAGqSURB VDjLdZTBcuMgDIa9yWzPFdR7riXCeTHrnBtCfceue1/X6/d/hBVxExPb0QUN3/wI/WjIsoch9gZO m0BJSVv7ZK2R0hheOCEjY8JAdmmE/LK0K9A+AuW3cAWw21aE4gFoHwFxaL6uYH9Xu1JP71sKrPD4 bwMEzHfj+8Z1W+yeRUxgqbBw4kUKswCWzj87MKWR9yBQ4QnY3GVxgaVg62FV3HKAyVe3amxZorm5 O3feEBpbbdgu0cTz1yZSCaKaH0pc919qsjLfeEGnejLdfNS1eOPU2HcJEGEq+Om8O6cAOYjZ0Q14 uJnzDRCLzqdgUigXRYP3Kk+BmyRY14PrtsCf0Z+6+1tJjMep0TtKi+/iDDDBY+9qntCQgAvpcdRY e85snnQu0KF23o849TVb8oGoh957V8iS20oA305rP0x2JYqG21ReOwoLdxulSuzV72y/r+4VHgNq PGfZr4FfeQatJx7dXlU/FiBcDPH6IHQ/HbUzEmLUXwHgA4tm/AsQP4AXkhZ4LnkGLQAWnABcpp09 IJ5AJJLG4uvtLwFjZPxLwMiyIPV23f8PN+77+ilAzYQAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjEt MTItMDdUMDU6MDE6NDkrMDA6MDAUoVT0AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIxLTEyLTA3VDA1 OjAxOjQ5KzAwOjAwZfzsSAAAAABJRU5ErkJggg== X-Now-Playing: Soft Cell's _Tainted Love_: "Tainted Dub" In-Reply-To: <878rwxje1x.fsf@yahoo.com> (Po Lu's message of "Tue, 07 Dec 2021 11:20:58 +0800") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a01:4f9:2b:f0f::2 (failed) Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 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, RCVD_IN_DNSWL_MED=-2.3, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:281200 Archived-At: Po Lu writes: > Does this really have to be a generalized variable? > > Why not use something like `set-persistent-value' and > `get-persistent-value'? I think we're moving away from get/set pairs. We could have gone even more magical -- reader macros! Anyway, this is now working, I think, but of course the most difficult bit, naming, is left to last. So basically: (define-sticky-variable foo 'bar) This defines a sticky wicket foo, I mean object, and `bar' is the default value if there isn't one already stored. We access it like this: (sticky-value foo) =3D> zot There was apparently a stored value, so we got that back instead of the initial value. (setf (sticky-value foo) 'gazonk) (sticky-value foo) =3D> gazonk These sticky values can be either synchronised or not. If they're synchronised, `(sticky-value foo)' will check whether the value has been updated externally (i.e., from a different Emacs session) and return that value. If not, it returns the local value. (push 'gazonk (sticky-value list-foo)) if `list-foo' is synchronised, will possibly read in the value from the db first, prepend `gazonk' to it, and then write it back out again. (So the other Emacs will get that value next time it accesses (sticky-value list-foo). RPC!!! =F0=9F=98=B1 But we should call this something other than "sticky", because that's kinda sticky. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no