Many corrections in Texinfo usage and English usage.
[bpt/emacs.git] / man / macos.texi
CommitLineData
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:
10multiple frames, colors, scroll bars, menu bars, use of the mouse,
11fontsets, international characters, input methods, coding systems, and
12synchronous subprocesses (@code{call-process}). Much of this works in
13the same way as on other platforms and is therefore documented in the
14rest of this manual. This section describes the peculiarities of using
15Emacs under the Mac OS.
16
17 The following features of Emacs are not yet supported on the Mac:
18unexec (@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.
ebc956ca
EZ
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,
24they 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),
305f719a
RS
45Emacs uses the @key{command} key as the @key{META} key. Otherwise it
46uses the @key{option} key as the @key{META} key.
ebc956ca
EZ
47
48 Most people should want to use the @key{command} key as the @key{META} key,
49so that dead-key processing with the @key{option} key will still work. This is
50useful for entering non-ASCII Latin characters directly from the Mac
51keyboard, for example.
52
53 Emacs recognizes the setting in the Keyboard control panel and
54supports international and alternative keyboard layouts (e.g., Dvorak).
55Selecting one of the layouts from the keyboard layout pull-down menu
56will 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
60be passed to Emacs.
61
62 The Mac keyboard ordinarily generates characters in the Mac Roman
63encoding. To use it for entering ISO Latin-1 characters directly, set
64the value of the variable @code{mac-keyboard-text-encoding} to
f8ca728a
AC
65@code{kTextEncodingISOLatin1}. Note that not all Mac Roman characters
66that can be entered at the keyboard can be converted to ISO Latin-1
67characters.
ebc956ca 68
1860d5c5 69 To enter ISO Latin-2 characters directly from the Mac keyboard, set
ebc956ca
EZ
70the value of @code{mac-keyboard-text-encoding} to
71@code{kTextEncodingISOLatin2}. Then let Emacs know that the keyboard
305f719a
RS
72generates Latin-2 codes, by typing @kbd{C-x @key{RET} k iso-latin-2
73@key{RET}}. To make this setting permanent, put this in your
74@file{.emacs} init file:
ebc956ca
EZ
75
76@lisp
b08fa67e 77(set-keyboard-coding-system 'iso-latin-2)
ebc956ca
EZ
78@end lisp
79
80@node Mac International
81@section International Character Set Support on the Mac
82@cindex Mac Roman coding system
4946337d 83@cindex clipboard support (Mac OS)
ebc956ca
EZ
84
85 The Mac uses a non-standard encoding for the upper 128 single-byte
305f719a
RS
86characters. It also deviates from the ISO 2022 standard by using
87character codes in the range 128-159. The coding system
88@code{mac-roman} is used to represent this Mac encoding. It is used
89for editing files stored in this native encoding, and for displaying
90file names in Dired mode.
ebc956ca
EZ
91
92 Any native (non-symbol) Mac font can be used to correctly display
93characters in the @code{mac-roman} coding system.
94
f8ca728a
AC
95 The fontset @code{fontset-mac} is created automatically when Emacs
96is run on the Mac. It displays characters in the @code{mac-roman}
97coding system using 12-point Monaco.
ebc956ca
EZ
98
99 To insert characters directly in the @code{mac-roman} coding system,
741c4ff9
DL
100type @kbd{C-x @key{RET} k mac-roman @key{RET}}, customize the option
101@code{keyboard-coding-system}, or put this in your init file:
ebc956ca
EZ
102
103@lisp
104(set-keyboard-coding-system 'mac-roman)
105@end lisp
106
107@noindent
108This is useful for editing documents in native Mac encoding.
109
110 You can use input methods provided either by LEIM (@pxref{Input
111Methods}) or the Mac OS to enter international characters.
112
113 To use the former, see the International Character Set Support section
741c4ff9 114of the manual (@pxref{International}).
ebc956ca
EZ
115
116 To use input methods provided by the Mac OS, set the keyboard coding
305f719a 117system accordingly using the @kbd{C-x @key{RET} k} command
ebc956ca 118(@code{set-keyboard-coding-system}). For example, for Traditional
414f9973 119Chinese, use @samp{chinese-big5} as keyboard coding system; for
ebc956ca
EZ
120Japanese, use @samp{sjis}, etc. Then select the desired input method in
121the keyboard layout pull-down menu.
122
123 The Mac clipboard and the Emacs kill ring (@pxref{Killing}) are
124connected as follows: the most recent kill is copied to the clipboard
125when Emacs is suspended and the contents of the clipboard is inserted
126into the kill ring when Emacs resumes. The result is that you can yank
127a piece of text and paste it into another Mac application, or cut or copy
128one in another Mac application and yank it into a Emacs buffer.
129
130 The encoding of text selections must be specified using the commands
305f719a
RS
131@kbd{C-x @key{RET} x} (@code{set-selection-coding-system}) or @kbd{C-x
132@key{RET} X} (@code{set-next-selection-coding-system}) (e.g., for
133Traditional Chinese, use @samp{chinese-big5-mac} and for Japanese,
ebc956ca
EZ
134@samp{sjis-mac}). @xref{Specify Coding}, for more details.
135
136
137@node Mac Environment Variables
138@section Environment Variables and Command Line Arguments.
4946337d 139@cindex environment variables (Mac OS)
ebc956ca
EZ
140
141 Environment variables and command line arguments for Emacs can be set
142by modifying the @samp{STR#} resources 128 and 129, respectively. A common
143environment variable that one may want to set is @samp{HOME}.
144
145 The way to set an environment variable is by adding a string of the
146form
147
148@example
149ENV_VAR=VALUE
150@end example
151
152@noindent
153to resource @samp{STR#} number 128 using @code{ResEdit}. To set up the
154program to use unibyte characters exclusively, for example, add the
155string
156
157@example
158EMACS_UNIBYTE=1
159@end example
160
161
162@node Mac Directories
163@section Volumes and Directories on the Mac
4946337d 164@cindex file names (Mac OS)
ebc956ca
EZ
165
166 The directory structure in the Mac OS is seen by Emacs as
167
168@example
b08fa67e 169/@var{volumename}/@var{filename}
ebc956ca
EZ
170@end example
171
b08fa67e 172So when Emacs requests a file name, doing file name completion on
ebc956ca
EZ
173@file{/} will display all volumes on the system. As in Unix, @file{..}
174can be used to go up a directory level.
175
176 To access files and folders on the desktop, look in the folder
177@file{Desktop Folder} in your boot volume (this folder is usually
178invisible in the Mac @code{Finder}).
179
180 Emacs creates the Mac folder @file{:Preferences:Emacs:} in the
181@file{System Folder} and uses it as the temporary directory. The Unix
182emulation code maps the Unix directory @file{/tmp} to it. Therefore it
183is best to avoid naming a volume @file{tmp}. If everything works
184correctly, the program should leave no files in it when it exits. You
185should be able to set the environment variable @code{TMPDIR} to use
186another directory but this folder will still be created.
187
188
189@node Mac Font Specs
190@section Specifying Fonts on the Mac
4946337d 191@cindex font names (Mac OS)
ebc956ca 192
305f719a
RS
193 It is rare that you need to specify a font name in Emacs; usually
194you specify face attributes instead. But when you do need to specify
195a font name in Emacs on the Mac, use a standard X font name:
ebc956ca 196
b08fa67e 197@smallexample
f8ca728a
AC
198-@var{maker}-@var{family}-@var{weight}-@var{slant}-@var{widthtype}-@var{style}@dots{}
199@dots{}-@var{pixels}-@var{height}-@var{horiz}-@var{vert}-@var{spacing}-@var{width}-@var{charset}
b08fa67e 200@end smallexample
ebc956ca 201
b08fa67e 202@noindent
305f719a 203@xref{Font X}. Wildcards are supported as they are on X.
ebc956ca 204
f8ca728a 205 Native Apple fonts in Mac Roman encoding has maker name @code{apple}
ebc956ca
EZ
206and charset @code{mac-roman}. For example 12-point Monaco can be
207specified by the name @samp{-apple-monaco-*-12-*-mac-roman}.
208
209 Native Apple Traditional Chinese, Simplified Chinese, Japanese, and
f8ca728a
AC
210Korean fonts have charsets @samp{big5-0}, @samp{gb2312.1980-0},
211@samp{jisx0208.1983-sjis}, and @samp{ksc5601.1989-0}, respectively.
ebc956ca
EZ
212
213 Single-byte fonts converted from GNU fonts in BDF format, which are not
214in the Mac Roman encoding, have foundry, family, and character sets
215encoded in the names of their font suitcases. E.g., the font suitcase
216@samp{ETL-Fixed-ISO8859-1} contains fonts which can be referred to by
217the name @samp{-ETL-fixed-*-iso8859-1}.
218
219
220@node Mac Functions
c44461ef 221@section Mac-Specific Lisp Functions
4946337d 222@cindex Lisp functions specific to Mac OS
ebc956ca
EZ
223
224@findex do-applescript
225 The function @code{do-applescript} takes a string argument,
226executes it as an AppleScript command, and returns the result as a
227string.
228
229@findex mac-filename-to-unix
230@findex unix-filename-to-mac
b08fa67e 231 The function @code{mac-filename-to-unix} takes a Mac file name and
ebc956ca
EZ
232returns the Unix equivalent. The function @code{unix-filename-to-mac}
233performs the opposite conversion. They are useful for constructing
234AppleScript commands to be passed to @code{do-applescript}.