summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2016-10-30 08:22:13 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2016-10-30 08:22:13 (GMT)
commitdf54f23b9fdd17bc3eb02a15f3fd9513e6261b7e (patch)
tree9489c28b23fbc0776089d0eae84daa8addbd0f44 /library
parent4ebcee3015caa6c14ae484220d113c943bc1f736 (diff)
downloadtcl-df54f23b9fdd17bc3eb02a15f3fd9513e6261b7e.zip
tcl-df54f23b9fdd17bc3eb02a15f3fd9513e6261b7e.tar.gz
tcl-df54f23b9fdd17bc3eb02a15f3fd9513e6261b7e.tar.bz2
[1ae12987cb] Ensure that deleting the [history] command deletes its storage.
Diffstat (limited to 'library')
-rw-r--r--library/history.tcl24
1 files changed, 24 insertions, 0 deletions
diff --git a/library/history.tcl b/library/history.tcl
index 51d2404..ef9099b 100644
--- a/library/history.tcl
+++ b/library/history.tcl
@@ -56,6 +56,30 @@ proc ::history {args} {
tailcall apply {arglist {tailcall history {*}$arglist} ::tcl} $args
}
+# (unnamed) --
+#
+# Callback when [::history] is destroyed. Destroys the implementation.
+#
+# Parameters:
+# oldName what the command was called.
+# newName what the command is now called (an empty string).
+# op the operation (= delete).
+#
+# Results:
+# none
+#
+# Side Effects:
+# The implementation of the [::history] command ceases to exist.
+
+trace add command ::history delete [list apply {{oldName newName op} {
+ variable history
+ unset -nocomplain history
+ foreach c [info procs ::tcl::Hist*] {
+ rename $c {}
+ }
+ rename ::tcl::history {}
+} ::tcl}]
+
# tcl::HistAdd --
#
# Add an item to the history, and optionally eval it at the global scope