diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2016-10-30 08:31:21 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2016-10-30 08:31:21 (GMT) |
commit | 16dbe3f5a2b7a0f6257c7858899fd79395bbe3c5 (patch) | |
tree | 5b90fdc81afcbed854492b6a6a456ede133ab0fe /library | |
parent | de8e3be4921297dbd6b85d3f513223bd5c4cd7ed (diff) | |
parent | 7b989f031267ef7f4c20fed585ac4b40790360fe (diff) | |
download | tcl-16dbe3f5a2b7a0f6257c7858899fd79395bbe3c5.zip tcl-16dbe3f5a2b7a0f6257c7858899fd79395bbe3c5.tar.gz tcl-16dbe3f5a2b7a0f6257c7858899fd79395bbe3c5.tar.bz2 |
[1ae12987cb] Ensure that deleting the [history] command deletes its storage.
Diffstat (limited to 'library')
-rw-r--r-- | library/history.tcl | 24 |
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 |