Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 23: Binding Keys and Creating Menus

Previous HourNext Hour

Sections in this Hour:

 

Q&A

Q How do you know whether a command interprets the C-u argument as raw C-u '(4) or the number 4?

A You don't. The implementation is transparent to the user. Only if the documentation of the command mentions specifically key C-u, you know that passing Esc 4 is differentiated from the C-u keypress. If there is no mention about the C-u key, you can safely assume that C-u is interpreted as any other numeric argument.

Q You said that I can't print four dashes with key sequence C-u, because the dash is interpreted as a negative prefix. Ho do you know that?

A See the global map C-h b and find the line that reads "C-- negative-argument". Note: The notation C-- means that C- starts a key sequence and is followed by dash. Pay attention to digit-argument lines that mean numeric prefix values that can be passed to commands.

Q Do you know when you would use ?\a or plain a syntax in keybinding commands

A The normal ASCII codes that you can print to the screen don't usually need the escaped notation, but in practice you should escape all characters that are nonalphanumeric. For example, although parentheses are normally printable characters, the parentheses are heavily used in Lisp; if you write [(meta ?) )], it won't be parsed correctly and you'll have to use ?\). Ctrl characters must also be defined with syntaxes ?\C-c and ?\t.

Q I have seen the binding \C-i. What's that?

A It's your Tab key, which can be written as \t or \C-i.

Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 23: Binding Keys and Creating Menus

Previous HourNext Hour

Sections in this Hour: