Two places doing the same thing is enough to motivate me to extract this to a method :)
doc_auto_cfg
doc_cfg_hide