diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2016-10-30 08:22:13 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2016-10-30 08:22:13 (GMT) |
commit | 7b989f031267ef7f4c20fed585ac4b40790360fe (patch) | |
tree | 9489c28b23fbc0776089d0eae84daa8addbd0f44 /library | |
parent | 994e1d80624825828c7ce3cc7c04d80a5335a89c (diff) | |
download | tcl-7b989f031267ef7f4c20fed585ac4b40790360fe.zip tcl-7b989f031267ef7f4c20fed585ac4b40790360fe.tar.gz tcl-7b989f031267ef7f4c20fed585ac4b40790360fe.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 |