comparison man/custom.texi @ 52979:3649390c0f91

Replace @sc{ascii} and ASCII with @acronym{ASCII}.
author Eli Zaretskii <eliz@gnu.org>
date Sun, 02 Nov 2003 07:01:19 +0000
parents 695cf19ef79e
children 326aa7651bd6
comparison
equal deleted inserted replaced
52978:1a5c50faf357 52979:3649390c0f91
1079 * Minibuffer Maps:: The minibuffer uses its own local keymaps. 1079 * Minibuffer Maps:: The minibuffer uses its own local keymaps.
1080 * Rebinding:: How to redefine one key's meaning conveniently. 1080 * Rebinding:: How to redefine one key's meaning conveniently.
1081 * Init Rebinding:: Rebinding keys with your init file, @file{.emacs}. 1081 * Init Rebinding:: Rebinding keys with your init file, @file{.emacs}.
1082 * Function Keys:: Rebinding terminal function keys. 1082 * Function Keys:: Rebinding terminal function keys.
1083 * Named ASCII Chars:: Distinguishing @key{TAB} from @kbd{C-i}, and so on. 1083 * Named ASCII Chars:: Distinguishing @key{TAB} from @kbd{C-i}, and so on.
1084 * Non-ASCII Rebinding:: Rebinding non-ASCII characters such as Latin-1. 1084 * Non-ASCII Rebinding:: Rebinding non-@acronym{ASCII} characters such as Latin-1.
1085 * Mouse Buttons:: Rebinding mouse buttons in Emacs. 1085 * Mouse Buttons:: Rebinding mouse buttons in Emacs.
1086 * Disabling:: Disabling a command means confirmation is required 1086 * Disabling:: Disabling a command means confirmation is required
1087 before it can be executed. This is done to protect 1087 before it can be executed. This is done to protect
1088 beginners from surprises. 1088 beginners from surprises.
1089 @end menu 1089 @end menu
1403 1403
1404 If you have a set of key bindings that you like to use all the time, 1404 If you have a set of key bindings that you like to use all the time,
1405 you can specify them in your @file{.emacs} file by using their Lisp 1405 you can specify them in your @file{.emacs} file by using their Lisp
1406 syntax. (@xref{Init File}.) 1406 syntax. (@xref{Init File}.)
1407 1407
1408 The simplest method for doing this works for ASCII characters and 1408 The simplest method for doing this works for @acronym{ASCII} characters and
1409 Meta-modified ASCII characters only. This method uses a string to 1409 Meta-modified @acronym{ASCII} characters only. This method uses a string to
1410 represent the key sequence you want to rebind. For example, here's how 1410 represent the key sequence you want to rebind. For example, here's how
1411 to bind @kbd{C-z} to @code{shell}: 1411 to bind @kbd{C-z} to @code{shell}:
1412 1412
1413 @example 1413 @example
1414 (global-set-key "\C-z" 'shell) 1414 (global-set-key "\C-z" 'shell)
1434 1434
1435 @example 1435 @example
1436 (global-set-key "\C-x\t" 'indent-rigidly) 1436 (global-set-key "\C-x\t" 'indent-rigidly)
1437 @end example 1437 @end example
1438 1438
1439 These examples show how to write some other special ASCII characters 1439 These examples show how to write some other special @acronym{ASCII} characters
1440 in strings for key bindings: 1440 in strings for key bindings:
1441 1441
1442 @example 1442 @example
1443 (global-set-key "\r" 'newline) ;; @key{RET} 1443 (global-set-key "\r" 'newline) ;; @key{RET}
1444 (global-set-key "\d" 'delete-backward-char) ;; @key{DEL} 1444 (global-set-key "\d" 'delete-backward-char) ;; @key{DEL}
1445 (global-set-key "\C-x\e\e" 'repeat-complex-command) ;; @key{ESC} 1445 (global-set-key "\C-x\e\e" 'repeat-complex-command) ;; @key{ESC}
1446 @end example 1446 @end example
1447 1447
1448 When the key sequence includes function keys or mouse button events, 1448 When the key sequence includes function keys or mouse button events,
1449 or non-ASCII characters such as @code{C-=} or @code{H-a}, you must use 1449 or non-@acronym{ASCII} characters such as @code{C-=} or @code{H-a}, you must use
1450 the more general method of rebinding, which uses a vector to specify the 1450 the more general method of rebinding, which uses a vector to specify the
1451 key sequence. 1451 key sequence.
1452 1452
1453 The way to write a vector in Emacs Lisp is with square brackets around 1453 The way to write a vector in Emacs Lisp is with square brackets around
1454 the vector elements. Use spaces to separate the elements. If an 1454 the vector elements. Use spaces to separate the elements. If an
1456 delimiters or punctuation are needed. If a vector element is a 1456 delimiters or punctuation are needed. If a vector element is a
1457 character, write it as a Lisp character constant: @samp{?} followed by 1457 character, write it as a Lisp character constant: @samp{?} followed by
1458 the character as it would appear in a string. 1458 the character as it would appear in a string.
1459 1459
1460 Here are examples of using vectors to rebind @kbd{C-=} (a control 1460 Here are examples of using vectors to rebind @kbd{C-=} (a control
1461 character not in ASCII), @kbd{C-M-=} (not in ASCII because @kbd{C-=} 1461 character not in @acronym{ASCII}), @kbd{C-M-=} (not in @acronym{ASCII} because @kbd{C-=}
1462 is not), @kbd{H-a} (a Hyper character; ASCII doesn't have Hyper at 1462 is not), @kbd{H-a} (a Hyper character; @acronym{ASCII} doesn't have Hyper at
1463 all), @key{F7} (a function key), and @kbd{C-Mouse-1} (a 1463 all), @key{F7} (a function key), and @kbd{C-Mouse-1} (a
1464 keyboard-modified mouse button): 1464 keyboard-modified mouse button):
1465 1465
1466 @example 1466 @example
1467 (global-set-key [?\C-=] 'make-symbolic-link) 1467 (global-set-key [?\C-=] 'make-symbolic-link)
1488 As you see, you represent a multi-character key sequence with a vector 1488 As you see, you represent a multi-character key sequence with a vector
1489 by listing each of the characters within the square brackets that 1489 by listing each of the characters within the square brackets that
1490 delimit the vector. 1490 delimit the vector.
1491 1491
1492 Language and coding systems can cause problems with key bindings 1492 Language and coding systems can cause problems with key bindings
1493 for non-ASCII characters. @xref{Non-ASCII Rebinding}. 1493 for non-@acronym{ASCII} characters. @xref{Non-ASCII Rebinding}.
1494 1494
1495 @node Function Keys 1495 @node Function Keys
1496 @subsection Rebinding Function Keys 1496 @subsection Rebinding Function Keys
1497 1497
1498 Key sequences can contain function keys as well as ordinary 1498 Key sequences can contain function keys as well as ordinary
1533 X) may use different names. To make certain what symbol is used for a 1533 X) may use different names. To make certain what symbol is used for a
1534 given function key on your terminal, type @kbd{C-h c} followed by that 1534 given function key on your terminal, type @kbd{C-h c} followed by that
1535 key. 1535 key.
1536 1536
1537 A key sequence which contains function key symbols (or anything but 1537 A key sequence which contains function key symbols (or anything but
1538 ASCII characters) must be a vector rather than a string. The vector 1538 @acronym{ASCII} characters) must be a vector rather than a string. The vector
1539 syntax uses spaces between the elements, and square brackets around the 1539 syntax uses spaces between the elements, and square brackets around the
1540 whole vector. Thus, to bind function key @samp{f1} to the command 1540 whole vector. Thus, to bind function key @samp{f1} to the command
1541 @code{rmail}, write the following: 1541 @code{rmail}, write the following:
1542 1542
1543 @example 1543 @example
1581 @example 1581 @example
1582 (global-set-key [H-M-right] 'forward-word) 1582 (global-set-key [H-M-right] 'forward-word)
1583 @end example 1583 @end example
1584 1584
1585 @node Named ASCII Chars 1585 @node Named ASCII Chars
1586 @subsection Named ASCII Control Characters 1586 @subsection Named @acronym{ASCII} Control Characters
1587 1587
1588 @key{TAB}, @key{RET}, @key{BS}, @key{LFD}, @key{ESC} and @key{DEL} 1588 @key{TAB}, @key{RET}, @key{BS}, @key{LFD}, @key{ESC} and @key{DEL}
1589 started out as names for certain ASCII control characters, used so often 1589 started out as names for certain @acronym{ASCII} control characters, used so often
1590 that they have special keys of their own. Later, users found it 1590 that they have special keys of their own. Later, users found it
1591 convenient to distinguish in Emacs between these keys and the ``same'' 1591 convenient to distinguish in Emacs between these keys and the ``same''
1592 control characters typed with the @key{CTRL} key. 1592 control characters typed with the @key{CTRL} key.
1593 1593
1594 Emacs distinguishes these two kinds of input, when the keyboard 1594 Emacs distinguishes these two kinds of input, when the keyboard
1595 reports these keys to Emacs. It treats the ``special'' keys as function 1595 reports these keys to Emacs. It treats the ``special'' keys as function
1596 keys named @code{tab}, @code{return}, @code{backspace}, @code{linefeed}, 1596 keys named @code{tab}, @code{return}, @code{backspace}, @code{linefeed},
1597 @code{escape}, and @code{delete}. These function keys translate 1597 @code{escape}, and @code{delete}. These function keys translate
1598 automatically into the corresponding ASCII characters @emph{if} they 1598 automatically into the corresponding @acronym{ASCII} characters @emph{if} they
1599 have no bindings of their own. As a result, neither users nor Lisp 1599 have no bindings of their own. As a result, neither users nor Lisp
1600 programs need to pay attention to the distinction unless they care to. 1600 programs need to pay attention to the distinction unless they care to.
1601 1601
1602 If you do not want to distinguish between (for example) @key{TAB} and 1602 If you do not want to distinguish between (for example) @key{TAB} and
1603 @kbd{C-i}, make just one binding, for the ASCII character @key{TAB} 1603 @kbd{C-i}, make just one binding, for the @acronym{ASCII} character @key{TAB}
1604 (octal code 011). If you do want to distinguish, make one binding for 1604 (octal code 011). If you do want to distinguish, make one binding for
1605 this ASCII character, and another for the ``function key'' @code{tab}. 1605 this @acronym{ASCII} character, and another for the ``function key'' @code{tab}.
1606 1606
1607 With an ordinary ASCII terminal, there is no way to distinguish 1607 With an ordinary @acronym{ASCII} terminal, there is no way to distinguish
1608 between @key{TAB} and @kbd{C-i} (and likewise for other such pairs), 1608 between @key{TAB} and @kbd{C-i} (and likewise for other such pairs),
1609 because the terminal sends the same character in both cases. 1609 because the terminal sends the same character in both cases.
1610 1610
1611 @node Non-ASCII Rebinding 1611 @node Non-ASCII Rebinding
1612 @subsection Non-ASCII Characters on the Keyboard 1612 @subsection Non-@acronym{ASCII} Characters on the Keyboard
1613 @cindex rebinding non-ASCII keys 1613 @cindex rebinding non-@acronym{ASCII} keys
1614 @cindex non-ASCII keys, binding 1614 @cindex non-@acronym{ASCII} keys, binding
1615 1615
1616 If your keyboard has keys that send non-ASCII characters, such as 1616 If your keyboard has keys that send non-@acronym{ASCII} characters, such as
1617 accented letters, rebinding these keys is a bit tricky. There are two 1617 accented letters, rebinding these keys is a bit tricky. There are two
1618 solutions you can use. One is to specify a keyboard coding system, 1618 solutions you can use. One is to specify a keyboard coding system,
1619 using @code{set-keyboard-coding-system} (@pxref{Specify Coding}). 1619 using @code{set-keyboard-coding-system} (@pxref{Specify Coding}).
1620 Then you can bind these keys in the usual way@footnote{Note that you 1620 Then you can bind these keys in the usual way@footnote{Note that you
1621 should avoid the string syntax for binding 8-bit characters, since 1621 should avoid the string syntax for binding 8-bit characters, since
1627 @end example 1627 @end example
1628 1628
1629 @noindent 1629 @noindent
1630 Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}. 1630 Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}.
1631 1631
1632 Since this puts a non-ASCII character in the @file{.emacs}, you should 1632 Since this puts a non-@acronym{ASCII} character in the @file{.emacs}, you should
1633 specify the proper coding system for that file. @xref{Init Syntax}. 1633 specify the proper coding system for that file. @xref{Init Syntax}.
1634 Specify the same coding system for the file that you use for your 1634 Specify the same coding system for the file that you use for your
1635 keyboard. 1635 keyboard.
1636 1636
1637 If you don't specify a keyboard coding system, that approach won't 1637 If you don't specify a keyboard coding system, that approach won't
1866 the terminal. Keyboard translations take place at the lowest level of 1866 the terminal. Keyboard translations take place at the lowest level of
1867 input processing; the keys that are looked up in keymaps contain the 1867 input processing; the keys that are looked up in keymaps contain the
1868 characters that result from keyboard translation. 1868 characters that result from keyboard translation.
1869 1869
1870 On a window system, the keyboard key named @key{DELETE} is a function 1870 On a window system, the keyboard key named @key{DELETE} is a function
1871 key and is distinct from the ASCII character named @key{DEL}. 1871 key and is distinct from the @acronym{ASCII} character named @key{DEL}.
1872 @xref{Named ASCII Chars}. Keyboard translations affect only ASCII 1872 @xref{Named ASCII Chars}. Keyboard translations affect only @acronym{ASCII}
1873 character input, not function keys; thus, the above example used on a 1873 character input, not function keys; thus, the above example used on a
1874 window system does not affect the @key{DELETE} key. However, the 1874 window system does not affect the @key{DELETE} key. However, the
1875 translation above isn't necessary on window systems, because Emacs can 1875 translation above isn't necessary on window systems, because Emacs can
1876 also distinguish between the @key{BACKSPACE} key and @kbd{C-h}; and it 1876 also distinguish between the @key{BACKSPACE} key and @kbd{C-h}; and it
1877 normally treats @key{BACKSPACE} as @key{DEL}. 1877 normally treats @key{BACKSPACE} as @key{DEL}.
2000 @samp{\@var{ooo}} for the character whose octal code is @var{ooo}. 2000 @samp{\@var{ooo}} for the character whose octal code is @var{ooo}.
2001 Backslash and double-quote are the only characters for which backslash 2001 Backslash and double-quote are the only characters for which backslash
2002 sequences are mandatory. 2002 sequences are mandatory.
2003 2003
2004 @samp{\C-} can be used as a prefix for a control character, as in 2004 @samp{\C-} can be used as a prefix for a control character, as in
2005 @samp{\C-s} for ASCII control-S, and @samp{\M-} can be used as a prefix for 2005 @samp{\C-s} for @acronym{ASCII} control-S, and @samp{\M-} can be used as a prefix for
2006 a Meta character, as in @samp{\M-a} for @kbd{Meta-A} or @samp{\M-\C-a} for 2006 a Meta character, as in @samp{\M-a} for @kbd{Meta-A} or @samp{\M-\C-a} for
2007 @kbd{Control-Meta-A}.@refill 2007 @kbd{Control-Meta-A}.@refill
2008 2008
2009 @cindex international characters in @file{.emacs} 2009 @cindex international characters in @file{.emacs}
2010 @cindex non-ASCII characters in @file{.emacs} 2010 @cindex non-@acronym{ASCII} characters in @file{.emacs}
2011 If you want to include non-ASCII characters in strings in your init 2011 If you want to include non-@acronym{ASCII} characters in strings in your init
2012 file, you should consider putting a @w{@samp{-*-coding: 2012 file, you should consider putting a @w{@samp{-*-coding:
2013 @var{coding-system}-*-}} tag on the first line which states the coding 2013 @var{coding-system}-*-}} tag on the first line which states the coding
2014 system used to save your @file{.emacs}, as explained in @ref{Recognize 2014 system used to save your @file{.emacs}, as explained in @ref{Recognize
2015 Coding}. This is because the defaults for decoding non-ASCII text might 2015 Coding}. This is because the defaults for decoding non-@acronym{ASCII} text might
2016 not yet be set up by the time Emacs reads those parts of your init file 2016 not yet be set up by the time Emacs reads those parts of your init file
2017 which use such strings, possibly leading Emacs to decode those strings 2017 which use such strings, possibly leading Emacs to decode those strings
2018 incorrectly. 2018 incorrectly.
2019 2019
2020 @item Characters: 2020 @item Characters:
2023 Examples: @code{?x}, @code{?\n}, @code{?\"}, @code{?\)}. Note that 2023 Examples: @code{?x}, @code{?\n}, @code{?\"}, @code{?\)}. Note that
2024 strings and characters are not interchangeable in Lisp; some contexts 2024 strings and characters are not interchangeable in Lisp; some contexts
2025 require one and some contexts require the other. 2025 require one and some contexts require the other.
2026 2026
2027 @xref{Non-ASCII Rebinding}, for information about binding commands to 2027 @xref{Non-ASCII Rebinding}, for information about binding commands to
2028 keys which send non-ASCII characters. 2028 keys which send non-@acronym{ASCII} characters.
2029 2029
2030 @item True: 2030 @item True:
2031 @code{t} stands for `true'. 2031 @code{t} stands for `true'.
2032 2032
2033 @item False: 2033 @item False: