From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: plist-put: destructive? Date: Sat, 21 Jan 2017 08:41:53 -0800 Message-ID: <8737gcxt4e.fsf@ericabrahamsen.net> References: <87mvelzgrr.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1485017774 28405 195.159.176.226 (21 Jan 2017 16:56:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 21 Jan 2017 16:56:14 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/26.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 21 17:56:10 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUyxL-0006H0-DT for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Jan 2017 17:55:59 +0100 Original-Received: from localhost ([::1]:60728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUyxQ-0004jo-C7 for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Jan 2017 11:56:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUykE-0000Cw-9M for help-gnu-emacs@gnu.org; Sat, 21 Jan 2017 11:42:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUykA-00020U-8w for help-gnu-emacs@gnu.org; Sat, 21 Jan 2017 11:42:26 -0500 Original-Received: from [195.159.176.226] (port=53351 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUykA-0001yz-0H for help-gnu-emacs@gnu.org; Sat, 21 Jan 2017 11:42:22 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cUyjx-0006PA-2i for help-gnu-emacs@gnu.org; Sat, 21 Jan 2017 17:42:09 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 20 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:AmfNgGmk3drNzFvQqF9vzvK4DJ4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-Mailman-Approved-At: Sat, 21 Jan 2017 11:55:39 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112137 Archived-At: Stefan Monnier writes: >> So what's the ambiguity? Are there circumstances where a simple >> plist-put isn't going to modify the original plist? > > Yes, when the plist is empty. Thanks to you both. I'm working with existing plists, so I'll drop the setqs, that's a relief. > BTW, in recent Emacsen, you can use > > (setf (alist-get K AL) V) > > and it works even when the alist is nil (but it requires AL to be > a valid *place* rather than an arbitrary expression). You could make > something similar for plist-get. Making something similar would just be the `gv-define-simple-setter' call I had in the original message, right?