opensubscriber
   Find in this group all groups
 
Unknown more information…

e : emacs-devel@gnu.org 5 June 2012 • 11:27AM -0400

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

REPLY TO AUTHOR
 
REPLY TO GROUP




Michael Heerdegen <michael_heerdegen@web....> writes:

> But I wonder if there is a simple replacement for `aput' in vanilla
> Emacs?  I don't think so, but maybe I have overseen something.
>
> If not, can we add a new function `assoc-delete-all' to subr.el (which
> would be like `assq-delete-all', but would compare keys with `equal'
> instead of `eq')?  Dunno why this function does not exist yet, but it
> would ease handling alists e.g. if its keys are strings.

You can use the Common Lisp subset provided by cl.*\.el.

    (push '(key . emacs) alist)
    (setf (cdr (assoc 'key alist)) 'rms)
    (setf alist (delete* 'key alist :test 'equal :key 'car))

Starting with GNU Emacs 24.2 you are allowed to use the cl functions in
end-user code.  See <jwvehpvtdnb.fsf-monnier+emacs@gnu....> for more
information.

        Christopher


Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

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