summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-04-26 15:32:45 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-04-26 15:34:26 +0200
commit756b7cf5d9a817503437b3e8a9e8d912b7ee6c75 (patch)
treee39078ffa303d5e1b51ba9e9868b0826fb5ddcaf /lisp/emacs-lisp
parent0936bfcd77a671b8dce4ebcdc3e916622d68a865 (diff)
downloademacs-756b7cf5d9a817503437b3e8a9e8d912b7ee6c75.tar.gz
emacs-756b7cf5d9a817503437b3e8a9e8d912b7ee6c75.tar.bz2
emacs-756b7cf5d9a817503437b3e8a9e8d912b7ee6c75.zip
Mention caveats in the map-delete doc string
* lisp/emacs-lisp/map.el (map-delete): Mention how this has to be used for lists (bug#25929).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/map.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index c53f253f87f..8c67d7c7a25 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -175,7 +175,17 @@ MAP can be an alist, plist, hash-table, or array."
(cl-defgeneric map-delete (map key)
"Delete KEY in-place from MAP and return MAP.
-Keys not present in MAP are ignored.")
+Keys not present in MAP are ignored.
+
+Note that if MAP is a list (either alist or plist), and you're
+deleting the final element in the list, the list isn't actually
+destructively modified (but the return value will reflect the
+deletion). So if you're using this method on a list, you have to
+say
+
+ (setq map (map-delete map key))
+
+for this to work reliably.")
(cl-defmethod map-delete ((map list) key)
;; FIXME: Signal map-not-inplace i.s.o returning a different list?