From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vitalie Spinu Newsgroups: gmane.emacs.devel Subject: Re: Replacement for `aput' from obsolete assoc.el? Date: Fri, 08 Jun 2012 09:57:00 +0200 Organization: EUR Message-ID: <871ulq44oj.fsf@gmail.com> References: <87txyrnhxi.fsf@web.de> <87oboytp45@ch.ristopher.com> <87haupwo6b.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1339142241 31731 80.91.229.3 (8 Jun 2012 07:57:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Jun 2012 07:57:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 08 09:57:19 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Scu4N-0006Vd-3j for ged-emacs-devel@m.gmane.org; Fri, 08 Jun 2012 09:57:19 +0200 Original-Received: from localhost ([::1]:58935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Scu4M-0008Oz-RK for ged-emacs-devel@m.gmane.org; Fri, 08 Jun 2012 03:57:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Scu4G-0008O5-SO for emacs-devel@gnu.org; Fri, 08 Jun 2012 03:57:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Scu4A-0008LL-Om for emacs-devel@gnu.org; Fri, 08 Jun 2012 03:57:12 -0400 Original-Received: from mail-ee0-f41.google.com ([74.125.83.41]:47290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Scu4A-0008LC-Fk for emacs-devel@gnu.org; Fri, 08 Jun 2012 03:57:06 -0400 Original-Received: by eekb47 with SMTP id b47so1010400eek.0 for ; Fri, 08 Jun 2012 00:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=7oGgRzMVx7DPoqRaLNGkD7W1Ey1LqQ+5N0SDWrIRVeY=; b=N4TWTKhtE0o14N68+aRfbdQZCCZdBFGIXNfCJhhkCk0s7SURf7kcDYDW3es6plB7IH RC7KWGL5qg98Lm8g+tdCXPvPBdp5VHe9vUBWJtTWkESlA7bTcogQORA57GqVPThISk+z IP8Aag6pKEEoIDYlkSo0bpUa9HSqRUpO96RM8yBLEDfYnAyxa8qLe0aa9mq46Uhefv+I ImNneHmdf4pbW5sxnZzeBrfye9khZw3rHYoTuaOFgZz/5VouTxR7CNrNFUHaqZfwyTNh MxS/ZT09bP0n2FerLYs2UDhnHWsG7sUA7DCFPnRkDmbeuhotca/cqdC7Y4vr6wWNz2Z8 Ex1g== Original-Received: by 10.14.100.130 with SMTP id z2mr1228499eef.16.1339142223341; Fri, 08 Jun 2012 00:57:03 -0700 (PDT) Original-Received: from localhost (i108036.upc-i.chello.nl. [62.195.108.36]) by mx.google.com with ESMTPS id fo7sm6612981wib.9.2012.06.08.00.57.00 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Jun 2012 00:57:01 -0700 (PDT) In-Reply-To: <87haupwo6b.fsf@web.de> (Michael Heerdegen's message of "Tue, 05 Jun 2012 21:31:40 +0200") User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.83.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:150826 Archived-At: > So I think I want something like that: > (defun my-aput (alist-sym key val) > (let ((cons (assoc key (symbol-value alist-sym)))) > (if cons (setcdr cons val) (push (cons key val) (symbol-value alist-sym))))) >> >> instead of `eq')? Dunno why this function does not exist yet, but it >> >> would ease handling alists e.g. if its keys are strings. >> >> Using side-effects on alists is often a bad idea. > Why? I do this very often in my .emacs. For example: This is essential. A lot of packages store settings in alists, and there is no handy function to alter the values inside those. I wish for a `setq-within': (setq-within object name1 value1 name2 value2 ... ) where OBJECT is any dict-like container - alist, plist or hash-table. Doesn't this make sense as a base emacs functionality? Thanks, Vitalie.