[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replacement for `aput' from obsolete assoc.el?

From: Vitalie Spinu
Subject: Re: Replacement for `aput' from obsolete assoc.el?
Date: Fri, 08 Jun 2012 09:57:00 +0200
User-agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/23.3 (gnu/linux)

  > 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 

  >> >> 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

Doesn't this make sense as a base emacs functionality?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]