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 | 0fd35ed40dcf60d680dd8f063be7f6a66f531e20 (patch) | |
tree | 5b90fdc81afcbed854492b6a6a456ede133ab0fe /library | |
parent | 45a4c375a86403b18e66a8401235bf8a3a53f867 (diff) | |
parent | df54f23b9fdd17bc3eb02a15f3fd9513e6261b7e (diff) | |
download | tcl-0fd35ed40dcf60d680dd8f063be7f6a66f531e20.zip tcl-0fd35ed40dcf60d680dd8f063be7f6a66f531e20.tar.gz tcl-0fd35ed40dcf60d680dd8f063be7f6a66f531e20.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 |