diff options
| author | Richard M. Stallman | 2001-09-06 19:37:04 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2001-09-06 19:37:04 +0000 |
| commit | ce3bd809e3fd16e535477e938a6f77e480cbc60d (patch) | |
| tree | aea25a7d3a8b40b9adb9c2517a82cafdd0c6af01 | |
| parent | f76e03683e1e34fea4aadcc890b762541f50efd8 (diff) | |
| download | emacs-ce3bd809e3fd16e535477e938a6f77e480cbc60d.tar.gz emacs-ce3bd809e3fd16e535477e938a6f77e480cbc60d.zip | |
Show how to put more special ASCII characters
in strings and vectors.
| -rw-r--r-- | man/custom.texi | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/man/custom.texi b/man/custom.texi index ae9b2be8901..2811c4caa3c 100644 --- a/man/custom.texi +++ b/man/custom.texi | |||
| @@ -1621,6 +1621,15 @@ string, you can use the Emacs Lisp escape sequences, @samp{\t}, | |||
| 1621 | (global-set-key "\C-x\t" 'indent-rigidly) | 1621 | (global-set-key "\C-x\t" 'indent-rigidly) |
| 1622 | @end example | 1622 | @end example |
| 1623 | 1623 | ||
| 1624 | These examples show how to write some other special ASCII characters | ||
| 1625 | in strings for key bindings: | ||
| 1626 | |||
| 1627 | @example | ||
| 1628 | (global-set-key "\r" 'newline) ;; @key{RET} | ||
| 1629 | (global-set-key "\d" 'delete-backward-char) ;; @key{DEL} | ||
| 1630 | (global-set-key "\C-x\e\e" 'repeat-complex-command) ;; @key{ESC} | ||
| 1631 | @end example | ||
| 1632 | |||
| 1624 | When the key sequence includes function keys or mouse button events, | 1633 | When the key sequence includes function keys or mouse button events, |
| 1625 | or non-ASCII characters such as @code{C-=} or @code{H-a}, you must use | 1634 | or non-ASCII characters such as @code{C-=} or @code{H-a}, you must use |
| 1626 | the more general method of rebinding, which uses a vector to specify the | 1635 | the more general method of rebinding, which uses a vector to specify the |
| @@ -1647,15 +1656,24 @@ keyboard-modified mouse button): | |||
| 1647 | (global-set-key [C-mouse-1] 'make-symbolic-link) | 1656 | (global-set-key [C-mouse-1] 'make-symbolic-link) |
| 1648 | @end example | 1657 | @end example |
| 1649 | 1658 | ||
| 1650 | You can use a vector for the simple cases too. Here's how to rewrite | 1659 | You can use a vector for the simple cases too. Here's how to |
| 1651 | the first three examples, above, using vectors: | 1660 | rewrite the first three examples above, using vectors to bind |
| 1661 | @kbd{C-z}, @kbd{C-x l}, and @kbd{C-x @key{TAB}}: | ||
| 1652 | 1662 | ||
| 1653 | @example | 1663 | @example |
| 1654 | (global-set-key [?\C-z] 'shell) | 1664 | (global-set-key [?\C-z] 'shell) |
| 1655 | (global-set-key [?\C-x ?l] 'make-symbolic-link) | 1665 | (global-set-key [?\C-x ?l] 'make-symbolic-link) |
| 1656 | (global-set-key [?\C-x ?\t] 'indent-rigidly) | 1666 | (global-set-key [?\C-x ?\t] 'indent-rigidly) |
| 1667 | (global-set-key [?\r] 'newline) | ||
| 1668 | (global-set-key [?\d] 'delete-backward-char) | ||
| 1669 | (global-set-key [?\C-x ?\e ?\e] 'repeat-complex-command) | ||
| 1657 | @end example | 1670 | @end example |
| 1658 | 1671 | ||
| 1672 | @noindent | ||
| 1673 | As you see, you represent a multi-character key sequence with a vector | ||
| 1674 | by listing each of the characters within the square brackets that | ||
| 1675 | delimit the vector. | ||
| 1676 | |||
| 1659 | @node Function Keys | 1677 | @node Function Keys |
| 1660 | @subsection Rebinding Function Keys | 1678 | @subsection Rebinding Function Keys |
| 1661 | 1679 | ||