From 3348b627bc1ad8d0d187a0c8bd0ce45f6a769d33 Mon Sep 17 00:00:00 2001 From: Thuna Date: Sat, 2 Jul 2022 00:03:38 +0300 Subject: [PATCH 2/2] Fix `tabulated-list-format' sharing list structures * tabulated-list.el (tabulated-list-hide-current-column tabulated-list-make-column-visible): Copy tabulated-list-format recursively before mutating it. --- lisp/emacs-lisp/tabulated-list.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index 868ed141ec..4e0b3b9e95 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el @@ -780,6 +780,9 @@ tabulated-list-hide-current-column (interactive) (let ((col-nb (tabulated-list--column-number (tabulated-list-get-column)))) + ;; `tabulated-list-format' may be a constant (sharing list + ;; structures), so copy it before mutating. + (setq tabulated-list-format (copy-tree tabulated-list-format t)) (setf (nthcdr 3 (aref tabulated-list-format col-nb)) (plist-put (nthcdr 3 (aref tabulated-list-format col-nb)) :hidden t))) @@ -798,6 +801,9 @@ tabulated-list-make-column-visible (plist-get (nthcdr 3 col) :hidden)) t))) (let ((col-nb (tabulated-list--column-number name))) + ;; `tabulated-list-format' may be a constant (sharing list + ;; structures), so copy it before mutating. + (setq tabulated-list-format (copy-tree tabulated-list-format t)) (setf (nthcdr 3 (aref tabulated-list-format col-nb)) (plist-put (nthcdr 3 (aref tabulated-list-format col-nb)) :hidden nil))) -- 2.35.1