Pro Tip: Set Emacs 24 smex-history-length to a sane value

A few days ago I was tweaking my Emacs configuration and I decided to bump the smex-history-length variable really high to 4096. Everything was fine for about a week, and then in the last couple of days I noticed that the M-x chord was taking a really long time to respond. So I was really scratching my head for a few hours, trying to figure out why it wouldn't respond promptly and also why I would sometimes get this really weird error from smex itself (wrong-type-argument number-or-marker-p nil).

Eventually, it occurred to me that the reason for the slowness and the error is that I had set that history variable to a really insane value. The problem was not apparent immediately because it took a little while to build that smex history list. But once it was big enough, smex spent a ton of time ranking the list every time I hit the M-x chord on the keyboard. I bumped it back down to 16 now and the problems immediately went away. Beware!


Comments powered by Disqus