2018-09-03 Emacs obsolete commands

In one of my previous posts I mentioned that the Info-edit command is obsolete. You might be wondering what that means exactly. (I was, for sure.) Well, here’s the story.

As the Elisp reference manual says:
You can mark a named function as “obsolete”, meaning that it may be removed at some point in the future. This causes Emacs to warn that the function is obsolete whenever it byte-compiles code containing that function, and whenever it displays the documentation for that function. In all other respects, an obsolete function behaves like any other function.

This is not the whole truth, however: it turns out that marking a command obsolete makes it harder to run it with M-x (which makes sense). This is documented in the Emacs manual:
When ‘M-x’ completes on commands, it ignores the commands that are declared “obsolete”; for these, you will have to type their full name. Obsolete commands are those for which newer, better alternatives exist, and which are slated for removal in some future Emacs release.
This is quite neat.

And to learn how Emacs marks functions as obsolete, let us look at an example:

(make-obsolete 'Info-edit
	       "editing Info nodes by hand is not recommended." "24.4")

You may type C-h f Info-edit RET to see how this works. Consult the Elisp reference to learn more about making functions (and variables) obsolete.

CategoryEnglish, CategoryBlog, CategoryEmacs