opensubscriber
   Find in this group all groups
 
Unknown more information…

e : emacs-devel@gnu.org 8 June 2012 • 3:57PM -0400

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

REPLY TO AUTHOR
 
REPLY TO GROUP





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


Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.