From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.help Subject: Re: plist-put modification by side effect Date: Sat, 31 Jan 2009 23:46:58 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233451112 12446 80.91.229.12 (1 Feb 2009 01:18:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Feb 2009 01:18:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 01 02:19:47 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LTQzw-0000qw-NQ for geh-help-gnu-emacs@m.gmane.org; Sun, 01 Feb 2009 02:19:44 +0100 Original-Received: from localhost ([127.0.0.1]:36019 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTQyd-0006EX-WB for geh-help-gnu-emacs@m.gmane.org; Sat, 31 Jan 2009 20:18:24 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.kpnqwest.it!news.kpnqwest.it.POSTED!not-for-mail Original-NNTP-Posting-Date: Sat, 31 Jan 2009 16:46:41 -0600 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:R7Ua5p6xYjX/TmUCxwWz19y2uAM= Original-Lines: 28 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 195.254.226.95 Original-X-Trace: sv3-kzINncHUJvKn3/e598lBGNoLtn/m0QFonW1TiCkjNTdQc/ITOBTPoAoAwLHDE61jjJI8CkqkKtYzCyc!YZEcCkc7jn//M+v0aTQPsG0YOJ3hu8ov2Vap6rAMY0SI/jdhdoMMm31qpcXh0WE= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Original-Xref: news.stanford.edu gnu.emacs.help:166490 X-Mailman-Approved-At: Sat, 31 Jan 2009 20:17:22 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61811 Archived-At: * Dan Davison [2009-01-31 22:06+0100] writes: > ,----[C-h f plist-put] > | plist-put is a built-in function in `C source code'. > | (plist-put plist prop val) > | > | Change value in plist of prop to val. > | plist is a property list, which is a list of the form > | (PROP1 VALUE1 PROP2 VALUE2 ...). prop is a symbol and val is any object. > | If prop is already a property on the list, its value is set to val, > | otherwise the new prop val pair is added. The new plist is returned; > | use `(setq x (plist-put x prop val))' to be sure to use the new value. > | The plist is modified by side effects. > | > `---- > > I don't get this. It says the plist is altered by side effects. So > what's with the "but just to be extra careful use (setq ...)" advice? > I think I've seen a similar statemenmt in other docstrings, but I > can't remember which. Is there some subtlety that means you can't > actually rely on the side effect? Surely not? If the list is nil, there is nothing to be modified and plist-put allocates a new list instead. In this case you must assign the returned value. The same situation occurs with the delete function when the list would be empty after the removing all elements. Helmut.