Mercurial > emacs
comparison man/custom.texi @ 76814:3d822097244e
(Non-ASCII Rebinding): Node deleted. Material moved to Init Non-ASCII.
(Init Rebinding, Init Syntax): Link to Init Non-ASCII instead.
(Init Non-ASCII): New node.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Fri, 30 Mar 2007 23:43:16 +0000 |
parents | 547345eaed8e |
children | a878a3923330 |
comparison
equal
deleted
inserted
replaced
76813:88564445165d | 76814:3d822097244e |
---|---|
1274 * Minibuffer Maps:: The minibuffer uses its own local keymaps. | 1274 * Minibuffer Maps:: The minibuffer uses its own local keymaps. |
1275 * Rebinding:: How to redefine one key's meaning conveniently. | 1275 * Rebinding:: How to redefine one key's meaning conveniently. |
1276 * Init Rebinding:: Rebinding keys with your init file, @file{.emacs}. | 1276 * Init Rebinding:: Rebinding keys with your init file, @file{.emacs}. |
1277 * Function Keys:: Rebinding terminal function keys. | 1277 * Function Keys:: Rebinding terminal function keys. |
1278 * Named ASCII Chars:: Distinguishing @key{TAB} from @kbd{C-i}, and so on. | 1278 * Named ASCII Chars:: Distinguishing @key{TAB} from @kbd{C-i}, and so on. |
1279 * Non-ASCII Rebinding:: Rebinding non-@acronym{ASCII} characters such as Latin-1. | |
1280 * Mouse Buttons:: Rebinding mouse buttons in Emacs. | 1279 * Mouse Buttons:: Rebinding mouse buttons in Emacs. |
1281 * Disabling:: Disabling a command means confirmation is required | 1280 * Disabling:: Disabling a command means confirmation is required |
1282 before it can be executed. This is done to protect | 1281 before it can be executed. This is done to protect |
1283 beginners from surprises. | 1282 beginners from surprises. |
1284 @end menu | 1283 @end menu |
1674 As you see, you represent a multi-character key sequence with a vector | 1673 As you see, you represent a multi-character key sequence with a vector |
1675 by listing all of the characters, in order, within the square brackets | 1674 by listing all of the characters, in order, within the square brackets |
1676 that delimit the vector. | 1675 that delimit the vector. |
1677 | 1676 |
1678 Language and coding systems can cause problems with key bindings | 1677 Language and coding systems can cause problems with key bindings |
1679 for non-@acronym{ASCII} characters. @xref{Non-ASCII Rebinding}. | 1678 for non-@acronym{ASCII} characters. @xref{Init Non-ASCII}. |
1680 | 1679 |
1681 @node Function Keys | 1680 @node Function Keys |
1682 @subsection Rebinding Function Keys | 1681 @subsection Rebinding Function Keys |
1683 | 1682 |
1684 Key sequences can contain function keys as well as ordinary | 1683 Key sequences can contain function keys as well as ordinary |
1814 this @acronym{ASCII} character, and another for the ``function key'' @code{tab}. | 1813 this @acronym{ASCII} character, and another for the ``function key'' @code{tab}. |
1815 | 1814 |
1816 With an ordinary @acronym{ASCII} terminal, there is no way to distinguish | 1815 With an ordinary @acronym{ASCII} terminal, there is no way to distinguish |
1817 between @key{TAB} and @kbd{C-i} (and likewise for other such pairs), | 1816 between @key{TAB} and @kbd{C-i} (and likewise for other such pairs), |
1818 because the terminal sends the same character in both cases. | 1817 because the terminal sends the same character in both cases. |
1819 | |
1820 @node Non-ASCII Rebinding | |
1821 @subsection Non-@acronym{ASCII} Characters on the Keyboard | |
1822 @cindex rebinding non-@acronym{ASCII} keys | |
1823 @cindex non-@acronym{ASCII} keys, binding | |
1824 | |
1825 If your keyboard has keys that send non-@acronym{ASCII} | |
1826 characters, such as accented letters, rebinding these keys | |
1827 must be done by using a vector like this@footnote{You must | |
1828 avoid the string syntax for binding | |
1829 non-@acronym{ASCII} characters, since they will be | |
1830 interpreted as meta keys. @xref{Strings of Events,,,elisp, | |
1831 The Emacs Lisp Reference Manual}.}: | |
1832 | |
1833 @example | |
1834 (global-set-key [?@var{char}] 'some-function) | |
1835 @end example | |
1836 | |
1837 @noindent | |
1838 Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}. | |
1839 | |
1840 Since this puts a non-@acronym{ASCII} character in the @file{.emacs}, | |
1841 you should specify a coding system for that file that supports the | |
1842 character in question. @xref{Init Non-ASCII}. | |
1843 | |
1844 @strong{Warning:} if you change the keyboard encoding, or change | |
1845 between multibyte and unibyte mode, or anything that would alter which | |
1846 code @kbd{C-q} would insert for that character, you'll need to edit | |
1847 the Lisp expression accordingly, to use the character code generated | |
1848 by @kbd{C-q} in the new mode. | |
1849 | 1818 |
1850 @node Mouse Buttons | 1819 @node Mouse Buttons |
1851 @subsection Rebinding Mouse Buttons | 1820 @subsection Rebinding Mouse Buttons |
1852 @cindex mouse button events | 1821 @cindex mouse button events |
1853 @cindex rebinding mouse buttons | 1822 @cindex rebinding mouse buttons |
2124 @menu | 2093 @menu |
2125 * Init Syntax:: Syntax of constants in Emacs Lisp. | 2094 * Init Syntax:: Syntax of constants in Emacs Lisp. |
2126 * Init Examples:: How to do some things with an init file. | 2095 * Init Examples:: How to do some things with an init file. |
2127 * Terminal Init:: Each terminal type can have an init file. | 2096 * Terminal Init:: Each terminal type can have an init file. |
2128 * Find Init:: How Emacs finds the init file. | 2097 * Find Init:: How Emacs finds the init file. |
2098 * Init Non-ASCII:: Using non-ASCII characters in an init file. | |
2129 @end menu | 2099 @end menu |
2130 | 2100 |
2131 @node Init Syntax | 2101 @node Init Syntax |
2132 @subsection Init File Syntax | 2102 @subsection Init File Syntax |
2133 | 2103 |
2174 @samp{\C-} can be used as a prefix for a control character, as in | 2144 @samp{\C-} can be used as a prefix for a control character, as in |
2175 @samp{\C-s} for @acronym{ASCII} control-S, and @samp{\M-} can be used as a prefix for | 2145 @samp{\C-s} for @acronym{ASCII} control-S, and @samp{\M-} can be used as a prefix for |
2176 a Meta character, as in @samp{\M-a} for @kbd{Meta-A} or @samp{\M-\C-a} for | 2146 a Meta character, as in @samp{\M-a} for @kbd{Meta-A} or @samp{\M-\C-a} for |
2177 @kbd{Control-Meta-A}.@refill | 2147 @kbd{Control-Meta-A}.@refill |
2178 | 2148 |
2179 @cindex international characters in @file{.emacs} | 2149 @xref{Init Non-ASCII}, for information about including |
2180 @cindex non-@acronym{ASCII} characters in @file{.emacs} | 2150 non-@acronym{ASCII} in your init file. |
2181 @anchor{Init Non-ASCII}If you want to include non-@acronym{ASCII} | |
2182 characters in strings in your init | |
2183 file, you should consider putting a @w{@samp{-*-coding: | |
2184 @var{coding-system}-*-}} tag on the first line which states the coding | |
2185 system used to save your @file{.emacs}, as explained in @ref{Recognize | |
2186 Coding}. This is because the defaults for decoding non-@acronym{ASCII} text might | |
2187 not yet be set up by the time Emacs reads those parts of your init file | |
2188 which use such strings, possibly leading Emacs to decode those strings | |
2189 incorrectly. | |
2190 | 2151 |
2191 @item Characters: | 2152 @item Characters: |
2192 Lisp character constant syntax consists of a @samp{?} followed by | 2153 Lisp character constant syntax consists of a @samp{?} followed by |
2193 either a character or an escape sequence starting with @samp{\}. | 2154 either a character or an escape sequence starting with @samp{\}. |
2194 Examples: @code{?x}, @code{?\n}, @code{?\"}, @code{?\)}. Note that | 2155 Examples: @code{?x}, @code{?\n}, @code{?\"}, @code{?\)}. Note that |
2195 strings and characters are not interchangeable in Lisp; some contexts | 2156 strings and characters are not interchangeable in Lisp; some contexts |
2196 require one and some contexts require the other. | 2157 require one and some contexts require the other. |
2197 | 2158 |
2198 @xref{Non-ASCII Rebinding}, for information about binding commands to | 2159 @xref{Init Non-ASCII}, for information about binding commands to |
2199 keys which send non-@acronym{ASCII} characters. | 2160 keys which send non-@acronym{ASCII} characters. |
2200 | 2161 |
2201 @item True: | 2162 @item True: |
2202 @code{t} stands for `true'. | 2163 @code{t} stands for `true'. |
2203 | 2164 |
2502 If that user name matches the real user-ID, then Emacs uses @env{HOME}; | 2463 If that user name matches the real user-ID, then Emacs uses @env{HOME}; |
2503 otherwise, it looks up the home directory corresponding to that user | 2464 otherwise, it looks up the home directory corresponding to that user |
2504 name in the system's data base of users. | 2465 name in the system's data base of users. |
2505 @c LocalWords: backtab | 2466 @c LocalWords: backtab |
2506 | 2467 |
2468 @node Init Non-ASCII | |
2469 @subsection Non-ASCII Characters in Init Files | |
2470 @cindex international characters in @file{.emacs} | |
2471 @cindex non-@acronym{ASCII} characters in @file{.emacs} | |
2472 @cindex non-@acronym{ASCII} keys, binding | |
2473 @cindex rebinding non-@acronym{ASCII} keys | |
2474 | |
2475 Language and coding systems may cause problems if your init file | |
2476 contains non-@acronym{ASCII} characters, such as accented letters, in | |
2477 strings or key bindings. | |
2478 | |
2479 If you want to use non-@acronym{ASCII} characters in your init file, | |
2480 you should put a @w{@samp{-*-coding: @var{coding-system}-*-}} tag on | |
2481 the first line of the init file, and specify a coding system that | |
2482 supports the character(s) in question. @xref{Recognize Coding}. This | |
2483 is because the defaults for decoding non-@acronym{ASCII} text might | |
2484 not yet be set up by the time Emacs reads those parts of your init | |
2485 file which use such strings, possibly leading Emacs to decode those | |
2486 strings incorrectly. You should then avoid adding Emacs Lisp code | |
2487 that modifies the coding system in other ways, such as calls to | |
2488 @code{set-language-environment}. | |
2489 | |
2490 To bind non-@acronym{ASCII} keys, you must use a vector (@pxref{Init | |
2491 Rebinding}). The string syntax cannot be used, since the | |
2492 non-@acronym{ASCII} characters will be interpreted as meta keys. For | |
2493 instance: | |
2494 | |
2495 @example | |
2496 (global-set-key [?@var{char}] 'some-function) | |
2497 @end example | |
2498 | |
2499 @noindent | |
2500 Type @kbd{C-q}, followed by the key you want to bind, to insert @var{char}. | |
2501 | |
2502 @strong{Warning:} if you change the keyboard encoding, or change | |
2503 between multibyte and unibyte mode, or anything that would alter which | |
2504 code @kbd{C-q} would insert for that character, this keybinding may | |
2505 stop working. It is therefore advisable to use one and only one | |
2506 coding system, for your init file as well as the files you edit. For | |
2507 example, don't mix the @samp{latin-1} and @samp{latin-9} coding | |
2508 systems. | |
2509 | |
2507 @ignore | 2510 @ignore |
2508 arch-tag: c68abddb-4410-4fb5-925f-63394e971d93 | 2511 arch-tag: c68abddb-4410-4fb5-925f-63394e971d93 |
2509 @end ignore | 2512 @end ignore |