[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
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.
- Replacement for `aput' from obsolete assoc.el?, Michael Heerdegen, 2012/06/04
- Re: Replacement for `aput' from obsolete assoc.el?, Christopher Schmidt, 2012/06/04
- Re: Replacement for `aput' from obsolete assoc.el?, Stefan Monnier, 2012/06/05
- Re: Replacement for `aput' from obsolete assoc.el?, Michael Heerdegen, 2012/06/05
- Re: Replacement for `aput' from obsolete assoc.el?, Stefan Monnier, 2012/06/05
- Re: Replacement for `aput' from obsolete assoc.el?,
Vitalie Spinu <=
- Re: Replacement for `aput' from obsolete assoc.el?, Stephen J. Turnbull, 2012/06/08
- Re: Replacement for `aput' from obsolete assoc.el?, Stefan Monnier, 2012/06/08
- Re: Replacement for `aput' from obsolete assoc.el?, Stephen J. Turnbull, 2012/06/09
- Re: Replacement for `aput' from obsolete assoc.el?, Andreas Schwab, 2012/06/09
- Re: Replacement for `aput' from obsolete assoc.el?, Thien-Thi Nguyen, 2012/06/09
- Re: Replacement for `aput' from obsolete assoc.el?, Stephen J. Turnbull, 2012/06/10
- RE: Replacement for `aput' from obsolete assoc.el?, Drew Adams, 2012/06/09
- RE: Replacement for `aput' from obsolete assoc.el?, Drew Adams, 2012/06/09
- Re: Replacement for `aput' from obsolete assoc.el?, Vitalie Spinu, 2012/06/09
- Re: Replacement for `aput' from obsolete assoc.el?, Stephen J. Turnbull, 2012/06/10