2026-10-05 Emacs Lock mode

Today I only have a short tip. Sometimes you may have an important Emacs buffer you don’t want to kill accidentally. (For example, it might be an Eshell buffer with a long-running process, or a scratch buffer not associated with any file where you have some notes – although that is obviously asking for trouble.) Well, you can say M-x emacs-lock-mode, and Emacs won’t let you kill that buffer (nor quit). You can also provide a prefix argument and decide whether you want to lock killing the buffer, quitting Emacs or both.

And now the fun part. You might think that since you’ve never heard about it (or did you?), it’s some kind of a new feature. Well… no. The kill-or-quit-lock feature was introduced in 2011, and the first, very crude version of the “buffer locking” feature (which only prevented you from accidentally quitting Emacs if at least one buffer is locked) was committed by RMS himself in 1994! I wonder how many more hidden gems like this there are in Emacs…

CategoryEnglish, CategoryBlog, CategoryEmacs