Commit | Line | Data |
---|---|---|
ebc956ca EZ |
1 | @c This is part of the Emacs manual. |
2 | @c Copyright (C) 2000 Free Software Foundation, Inc. | |
3 | @c See file emacs.texi for copying conditions. | |
4 | @node Mac OS, MS-DOS, Antinews, Top | |
5 | @appendix Emacs and the Mac OS | |
6 | @cindex Mac OS | |
7 | @cindex Macintosh | |
8 | ||
9 | Emacs built on the Mac OS supports many of its major features: | |
10 | multiple frames, colors, scroll bars, menu bars, use of the mouse, | |
11 | fontsets, international characters, input methods, coding systems, and | |
12 | synchronous subprocesses (@code{call-process}). Much of this works in | |
13 | the same way as on other platforms and is therefore documented in the | |
14 | rest of this manual. This section describes the peculiarities of using | |
15 | Emacs under the Mac OS. | |
16 | ||
17 | The following features of Emacs are not yet supported on the Mac: | |
18 | unexec (@code{dump-emacs}), asynchronous subprocesses | |
19 | (@code{start-process}), and networking (@code{open-network-connection}). | |
20 | As a result, packages such as Gnus, Ispell, and Comint do not work. | |
21 | ||
22 | Since external Unix programs to handle commands such as | |
23 | @code{print-buffer} and @code{diff} are not available on the Mac OS, | |
24 | they are not supported in the Mac OS version. | |
25 | ||
26 | @menu | |
b08fa67e RS |
27 | * Input: Mac Input. Keyboard input on the Mac. |
28 | * Intl: Mac International. International character sets on the Mac. | |
29 | * Env: Mac Environment Variables. Setting environment variables for Emacs. | |
30 | * Directories: Mac Directories. Volumes and directories on the Mac. | |
31 | * Font: Mac Font Specs. Specifying fonts on the Mac. | |
32 | * Functions: Mac Functions. Mac-specific Lisp functions. | |
ebc956ca EZ |
33 | @end menu |
34 | ||
ebc956ca EZ |
35 | @node Mac Input |
36 | @section Keyboard Input on the Mac | |
4946337d EZ |
37 | @cindex Meta (Mac OS) |
38 | @cindex keyboard coding (Mac OS) | |
ebc956ca EZ |
39 | @vindex mac-command-key-is-meta |
40 | @vindex mac-keyboard-text-encoding | |
41 | ||
42 | On the Mac, Emacs can use either the @key{option} key or the | |
43 | @key{command} key as the @key{META} key. If the value of the variable | |
44 | @code{mac-command-key-is-meta} is non-@code{nil} (its default value), | |
45 | Emacs uses the @key{command} key as the @key{META} key. Otherwise it uses the | |
46 | @key{option} key as the @key{META} key. | |
47 | ||
48 | Most people should want to use the @key{command} key as the @key{META} key, | |
49 | so that dead-key processing with the @key{option} key will still work. This is | |
50 | useful for entering non-ASCII Latin characters directly from the Mac | |
51 | keyboard, for example. | |
52 | ||
53 | Emacs recognizes the setting in the Keyboard control panel and | |
54 | supports international and alternative keyboard layouts (e.g., Dvorak). | |
55 | Selecting one of the layouts from the keyboard layout pull-down menu | |
56 | will affect how the keys typed on the keyboard are interpreted. | |
57 | ||
58 | The Mac OS intercepts and handles certain key combinations (e.g., | |
59 | @key{command}-@key{SPC} for switching input languages). These will not | |
60 | be passed to Emacs. | |
61 | ||
62 | The Mac keyboard ordinarily generates characters in the Mac Roman | |
63 | encoding. To use it for entering ISO Latin-1 characters directly, set | |
64 | the value of the variable @code{mac-keyboard-text-encoding} to | |
65 | @code{kTextEncodingISOLatin1}. Note that that not all Mac Roman | |
66 | characters that can be entered at the keyboard can be converted to ISO | |
67 | Latin-1 characters. | |
68 | ||
69 | To enter ISO Latin-2 characters directly from the Mac keyboard. Set | |
70 | the value of @code{mac-keyboard-text-encoding} to | |
71 | @code{kTextEncodingISOLatin2}. Then let Emacs know that the keyboard | |
72 | generates Latin-2 codes by typink @kbd{C-x RET k iso-latin-2 RET}. To | |
73 | make this setting permanent, put this in your @file{.emacs} init file: | |
74 | ||
75 | @lisp | |
b08fa67e | 76 | (set-keyboard-coding-system 'iso-latin-2) |
ebc956ca EZ |
77 | @end lisp |
78 | ||
79 | @node Mac International | |
80 | @section International Character Set Support on the Mac | |
81 | @cindex Mac Roman coding system | |
4946337d | 82 | @cindex clipboard support (Mac OS) |
ebc956ca EZ |
83 | |
84 | The Mac uses a non-standard encoding for the upper 128 single-byte | |
85 | characters. It also deviates from the ISO 2022 standard by using code | |
86 | points in the range 128-159. The coding system @code{mac-roman} is used | |
87 | to represent this Mac encoding. It is used for editing files stored in | |
b08fa67e | 88 | this native encoding, and for displaying file names in Dired mode. |
ebc956ca EZ |
89 | |
90 | Any native (non-symbol) Mac font can be used to correctly display | |
91 | characters in the @code{mac-roman} coding system. | |
92 | ||
93 | The fontset @code{fontset-mac} is created automatically when Emacs is | |
94 | run on the Mac by the following expression. It displays characters in | |
95 | the @code{mac-roman} coding system using 12-point Monaco. | |
96 | ||
97 | To insert characters directly in the @code{mac-roman} coding system, | |
98 | type @kbd{C-x RET k mac-roman RET}, or put this in your @file{.emacs} | |
99 | init file: | |
100 | ||
101 | @lisp | |
102 | (set-keyboard-coding-system 'mac-roman) | |
103 | @end lisp | |
104 | ||
105 | @noindent | |
106 | This is useful for editing documents in native Mac encoding. | |
107 | ||
108 | You can use input methods provided either by LEIM (@pxref{Input | |
109 | Methods}) or the Mac OS to enter international characters. | |
110 | ||
111 | To use the former, see the International Character Set Support section | |
112 | of the manual. | |
113 | ||
114 | To use input methods provided by the Mac OS, set the keyboard coding | |
115 | system accordingly using the @kbd{C-x RET k} command | |
116 | (@code{set-keyboard-coding-system}). For example, for Traditional | |
414f9973 | 117 | Chinese, use @samp{chinese-big5} as keyboard coding system; for |
ebc956ca EZ |
118 | Japanese, use @samp{sjis}, etc. Then select the desired input method in |
119 | the keyboard layout pull-down menu. | |
120 | ||
121 | The Mac clipboard and the Emacs kill ring (@pxref{Killing}) are | |
122 | connected as follows: the most recent kill is copied to the clipboard | |
123 | when Emacs is suspended and the contents of the clipboard is inserted | |
124 | into the kill ring when Emacs resumes. The result is that you can yank | |
125 | a piece of text and paste it into another Mac application, or cut or copy | |
126 | one in another Mac application and yank it into a Emacs buffer. | |
127 | ||
128 | The encoding of text selections must be specified using the commands | |
129 | @kbd{C-x RET x} (@code{set-selection-coding-system}) or @kbd{C-x RET X} | |
130 | (@code{set-next-selection-coding-system}) (e.g., for Traditional | |
414f9973 | 131 | Chinese, use @samp{chinese-big5-mac} and for Japanese, |
ebc956ca EZ |
132 | @samp{sjis-mac}). @xref{Specify Coding}, for more details. |
133 | ||
134 | ||
135 | @node Mac Environment Variables | |
136 | @section Environment Variables and Command Line Arguments. | |
4946337d | 137 | @cindex environment variables (Mac OS) |
ebc956ca EZ |
138 | |
139 | Environment variables and command line arguments for Emacs can be set | |
140 | by modifying the @samp{STR#} resources 128 and 129, respectively. A common | |
141 | environment variable that one may want to set is @samp{HOME}. | |
142 | ||
143 | The way to set an environment variable is by adding a string of the | |
144 | form | |
145 | ||
146 | @example | |
147 | ENV_VAR=VALUE | |
148 | @end example | |
149 | ||
150 | @noindent | |
151 | to resource @samp{STR#} number 128 using @code{ResEdit}. To set up the | |
152 | program to use unibyte characters exclusively, for example, add the | |
153 | string | |
154 | ||
155 | @example | |
156 | EMACS_UNIBYTE=1 | |
157 | @end example | |
158 | ||
159 | ||
160 | @node Mac Directories | |
161 | @section Volumes and Directories on the Mac | |
4946337d | 162 | @cindex file names (Mac OS) |
ebc956ca EZ |
163 | |
164 | The directory structure in the Mac OS is seen by Emacs as | |
165 | ||
166 | @example | |
b08fa67e | 167 | /@var{volumename}/@var{filename} |
ebc956ca EZ |
168 | @end example |
169 | ||
b08fa67e | 170 | So when Emacs requests a file name, doing file name completion on |
ebc956ca EZ |
171 | @file{/} will display all volumes on the system. As in Unix, @file{..} |
172 | can be used to go up a directory level. | |
173 | ||
174 | To access files and folders on the desktop, look in the folder | |
175 | @file{Desktop Folder} in your boot volume (this folder is usually | |
176 | invisible in the Mac @code{Finder}). | |
177 | ||
178 | Emacs creates the Mac folder @file{:Preferences:Emacs:} in the | |
179 | @file{System Folder} and uses it as the temporary directory. The Unix | |
180 | emulation code maps the Unix directory @file{/tmp} to it. Therefore it | |
181 | is best to avoid naming a volume @file{tmp}. If everything works | |
182 | correctly, the program should leave no files in it when it exits. You | |
183 | should be able to set the environment variable @code{TMPDIR} to use | |
184 | another directory but this folder will still be created. | |
185 | ||
186 | ||
187 | @node Mac Font Specs | |
188 | @section Specifying Fonts on the Mac | |
4946337d | 189 | @cindex font names (Mac OS) |
ebc956ca EZ |
190 | |
191 | Fonts are specified to Emacs on the Mac in the form of a standard X | |
192 | font name. I.e., | |
193 | ||
b08fa67e RS |
194 | @smallexample |
195 | -@var{foundry}-@var{family}-@var{weight}-@var{slant}-@var{width}--@var{pixels}-@var{points}-@var{hres}-@var{vres}-@var{spacing}-@var{avewidth}-@var{charset} | |
196 | @end smallexample | |
ebc956ca | 197 | |
b08fa67e | 198 | @noindent |
ebc956ca | 199 | where the fields refer to foundry, font family, weight, slant, width, |
b08fa67e RS |
200 | pixels, point size, horizontal resolution, vertical resolution, |
201 | spacing, average width, and character set, respectively. Wildcards | |
202 | are supported as they are on X. | |
ebc956ca EZ |
203 | |
204 | Native Apple fonts in Mac Roman encoding has foundry name @code{apple} | |
205 | and charset @code{mac-roman}. For example 12-point Monaco can be | |
206 | specified by the name @samp{-apple-monaco-*-12-*-mac-roman}. | |
207 | ||
208 | Native Apple Traditional Chinese, Simplified Chinese, Japanese, and | |
209 | Korean fonts have charsets @samp{big5-0}, @samp{gb2312-0}, | |
210 | @samp{jisx0208.1983-sjis}, and @samp{ksc5601-1}, respectively. | |
211 | ||
212 | Single-byte fonts converted from GNU fonts in BDF format, which are not | |
213 | in the Mac Roman encoding, have foundry, family, and character sets | |
214 | encoded in the names of their font suitcases. E.g., the font suitcase | |
215 | @samp{ETL-Fixed-ISO8859-1} contains fonts which can be referred to by | |
216 | the name @samp{-ETL-fixed-*-iso8859-1}. | |
217 | ||
218 | ||
219 | @node Mac Functions | |
c44461ef | 220 | @section Mac-Specific Lisp Functions |
4946337d | 221 | @cindex Lisp functions specific to Mac OS |
ebc956ca EZ |
222 | |
223 | @findex do-applescript | |
224 | The function @code{do-applescript} takes a string argument, | |
225 | executes it as an AppleScript command, and returns the result as a | |
226 | string. | |
227 | ||
228 | @findex mac-filename-to-unix | |
229 | @findex unix-filename-to-mac | |
b08fa67e | 230 | The function @code{mac-filename-to-unix} takes a Mac file name and |
ebc956ca EZ |
231 | returns the Unix equivalent. The function @code{unix-filename-to-mac} |
232 | performs the opposite conversion. They are useful for constructing | |
233 | AppleScript commands to be passed to @code{do-applescript}. |