To What Is C-h Bound?
In order to find the symbol that names the Help command, we can use C-h b, which invokes another command called describe-bindings. This is one of the Help system's many subcommands. It presents a window listing all the keybindings in effect. Looking through it for the C-h binding, we find this line:
C-h help-command
This tells us that help-command is the symbol that names the function that invokes Help.
Our Lisp example is almost complete, but we can't just write
(global-set-key "\M-?" help-command) ;almost right!This is wrong because of the way symbols are interpreted when they appear in Lisp expressions. If a symbol appears in the first position of a list, it's the name of a function to execute. If it appears elsewhere, it's a variable whose value needs to be retrieved. But when we run global-set-key as shown, we don't want the value contained in help-command, whatever that may be. The value we want is the symbol help-command itself. In short, we wish to prevent the symbol from being evaluated before it's passed to global-set-key. After all, as far as we know, help-command doesn't have a value as a variable.
The way to prevent a symbol (or any Lisp expression) from being evaluated is to quote it by preceding it with a single quote ('). It looks like this:
(global-set-key "\M-?" 'help-command)
Our Lisp example is now complete. If you place this line in your .emacs file, then M-? will invoke help-command the next time you run Emacs, and in all future Emacs sessions. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access