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