为什么 `(assoc-delete-all "C" org-src-lang-modes)` 删不掉 org-src-lang-modes 中的 item?

我一直认为 assoc-delete-all 的效果是会原地修改 alist, 但是今天试了下 (assoc-delete-all "C" org-src-lang-modes), 发现 org-src-lang-modes 并没有被修改, 写成 (setq org-src-lang-modes (assoc-delete-all "C" org-src-lang-modes)) 才可以. 用 emacs -q 也是这样. 很困惑, 是我对 assoc-delete-all 理解有问题还是 org-src-lang-modes 有什么特别之处?

我为什么会认为 assoc-delete-all 会原地修改:

(setq xx
      '(("aa" . 23)
        ("bb" . 24)
        ))
(assoc-delete-all "bb" xx)
(princ (format "xx: %s" (prin1-to-string xx)))

它执行的结果是:

xx: (("aa" . 23))

这里 “bb” 就被删除了.

这种时候你应该先确认一下你的理解来自哪儿,来源有啥问题。C-h f assoc-delete-all一没说原地修改,二明确说了返回修改后的alist。

assoc-delete-all is a native-compiled Lisp function in ‘subr.el’.

(assoc-delete-all KEY ALIST &optional TEST)

Delete from ALIST all elements whose car is KEY.
Compare keys with TEST.  Defaults to ‘equal’.
Return the modified alist.
Elements of ALIST that are not conses are ignored.

  Other relevant functions are documented in the list and alist
  groups.
  Probably introduced at or before Emacs version 21.1.