Reversible glycosylation of nuclear and cytoplasmic proteins is an important regulatory mechanism across metazoans. One enzyme, O-linked N-acetylglucosamine transferase (OGT), is responsible for all nucleocytoplasmic protein glycosylation and there is a well-known need for potent, cell-permeable inhibitors to interrogate OGT function. Here we report the structure-based evolution of OGT inhibitors culminating in compounds with low nanomolar inhibitory potency and on-target cellular activity. The structures we report provide insight into how to inhibit glycosyltransferases, a family of enzymes that has been notoriously refractory to inhibitor development. Intron detention in precursor RNAs serves to regulate expression of a substantial fraction of genes in eukaryotic genomes. How detained intron (DI) splicing is controlled is poorly understood. Here we show that O-GlcNAc, which is thought to integrate signaling pathways as nutrient conditions fluctuate, controls detained intron splicing. Using specific inhibitors of OGT and the enzyme that removes O-GlcNAc (OGA), we first show that O-GlcNAc regulates splicing of the highly conserved detained introns in OGT and OGA to control mRNA abundance in order to buffer O-GlcNAc changes. We show that OGT and OGA represent two distinct paradigms for how DI splicing can control gene expression. We also show that when DI splicing of the O-GlcNAc-cycling genes fails to restore O-GlcNAc homeostasis, there is a global change in detained intron levels. Strikingly, almost all detained introns are spliced more efficiently when O-GlcNAc levels are low, yet other alternative splicing pathways change minimally. Our results demonstrate that O-GlcNAc controls detained intron splicing to tune system-wide gene expression, providing a means to couple nutrient conditions to the cell’s transcriptional regime.