Over at techhub.social, lispwizard has a short post (or whatever techhub.social calls them) on saving window configurations to registers. He notes how easy it is to save multiple configurations and switch between them on the fly.
Saving window configurations and other data in registers is an extraordinarily powerful technique that all Emacs users should learn and master. There’s a problem, though, when you want to do this programmatically: which register should you use? How can you be sure that your choice won’t conflict with a register that the user has chosen manually for some other task? There are several situations in which I want to run an Emacs function in a single window—Elfeed is an example—and I do that by saving the current window configuration, deleting the other windows, running the required function, and then restoring the previous window configuration but how do I choose a “safe” register to save the window configuration in?
The answer is a trick I learned from Magnar Sveen years ago. Instead of using a letter to name the register, you use a symbol like :saved-windows. That works because when you name a register with a letter, Emacs uses a pointer to its symbol as the register name. Using a symbol name like :saved-windows works because the result is also a symbol pointer.
If you have the need to save something in a register programmatically, this is a good way of doing it. You don’t have to worry about conflicts because the user can not use symbol names for registers interactively.