folding-mode hooks