In my .emacs
file I have code like this:
(setq default-frame-alist
(assq-delete-all 'width default-frame-alist))
(add-to-list 'default-frame-alist
(cons 'width new-width))
The first expression ensures that the second one does not introduce a "degenerate key" in the alist (IOW, multiple elements having the same car
).
That's a javaesque amount of machinery for what other languages achieve with something that looks very similar to this:
default_frame_list["width"] = new_width
Is there a simpler way?
PS: Of course, one could reply with "just get rid of the first expression" (IOW, "don't worry about degenerate keys"), but this does not answer my question.