TransWikia.com

How to globally disable and re-enable Echo?

Mathematica Asked on March 3, 2021

I have Echo’s buried in code all over my notebook, I’d like a flag to turn them all on or off globally.

  • Sure Unprotect[Echo];Echo=Identity would disable them, but then you can’t re-enable them
  • A solution that works for all the various types of Echos (EchoName, EchoEvaluation, …) would be nice
  • QuietEcho doesn’t work because I’d have to write it add it around every blob of code

One Answer

Echo has an autoload, so you need to make sure the symbol is autoloaded before you modify its values:

DisableEcho[] := (Unprotect[Echo]; Echo; Echo = #&; Protect[Echo];)

EnableEcho[] := (Unprotect[Echo]; Echo=.; Protect[Echo];)

Test:

DisableEcho[]

Echo[3]

EnableEcho[]

Echo[3, "EchoLabel"]

3

EchoLabel 3

3

Correct answer by Carl Woll on March 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP