Bump version to 24.3.92
[bpt/emacs.git] / doc / emacs / macos.texi
CommitLineData
ebc956ca 1@c This is part of the Emacs manual.
ba318903 2@c Copyright (C) 2000-2014 Free Software Foundation, Inc.
ebc956ca 3@c See file emacs.texi for copying conditions.
abb9615e 4@node Mac OS / GNUstep
e93bc142
AR
5@appendix Emacs and Mac OS / GNUstep
6@cindex Mac OS X
ebc956ca 7@cindex Macintosh
e93bc142
AR
8@cindex GNUstep
9
ec8a6295
CY
10 This section describes the peculiarities of using Emacs built with
11the GNUstep libraries on GNU/Linux or other operating systems, or on
12Mac OS X with native window system support. On Mac OS X, Emacs can be
13built either without window system support, with X11, or with the
40ace058
GM
14Cocoa interface; this section only applies to the Cocoa build. This
15does not support versions of Mac OS X earlier than 10.4.
ec8a6295
CY
16
17 For various historical and technical reasons, Emacs uses the term
18@samp{Nextstep} internally, instead of ``Cocoa'' or ``Mac OS X''; for
19instance, most of the commands and variables described in this section
20begin with @samp{ns-}, which is short for @samp{Nextstep}. NeXTstep
21was an application interface released by NeXT Inc during the 1980s, of
22which Cocoa is a direct descendant. Apart from Cocoa, there is
23another NeXTstep-style system: GNUstep, which is free software. As of
40ace058 24this writing, Emacs GNUstep support is alpha status (@pxref{GNUstep
ec8a6295 25Support}), but we hope to improve it in the future.
ebc956ca
EZ
26
27@menu
e93bc142
AR
28* Mac / GNUstep Basics:: Basic Emacs usage under GNUstep or Mac OS.
29* Mac / GNUstep Customization:: Customizations under GNUstep or Mac OS.
30* Mac / GNUstep Events:: How window system events are handled.
a6936c4b 31* GNUstep Support:: Details on status of GNUstep support.
ebc956ca
EZ
32@end menu
33
abb9615e 34@node Mac / GNUstep Basics
e93bc142 35@section Basic Emacs usage under Mac OS and GNUstep
8be76823
CY
36
37 By default, the @key{alt} and @key{option} keys are the same as
ec8a6295 38@key{Meta}. The Mac @key{Cmd} key is the same as @key{Super}, and
e7a3ff06 39Emacs provides a set of key bindings using this modifier key that mimic
ec8a6295
CY
40other Mac / GNUstep applications (@pxref{Mac / GNUstep Events}). You
41can change these bindings in the usual way (@pxref{Key Bindings}).
42
8fd6e60a
XF
43@vindex ns-alternate-modifier
44@vindex ns-right-alternate-modifier
ec8a6295
CY
45 The variable @code{ns-right-alternate-modifier} controls the
46behavior of the right @key{alt} and @key{option} keys. These keys
47behave like the left-hand keys if the value is @code{left} (the
48default). A value of @code{control}, @code{meta}, @code{alt},
49@code{super}, or @code{hyper} makes them behave like the corresponding
8fd6e60a
XF
50modifier keys; a value to @code{left} means be the same key as
51@code{ns-alternate-modifier}; a value of @code{none} tells Emacs to
52ignore them.
ec8a6295 53
40ace058
GM
54 @kbd{S-Mouse-1} adjusts the region to the click position,
55just like @kbd{Mouse-3} (@code{mouse-save-then-kill}); it does not pop
56up a menu for changing the default face, as @kbd{S-Mouse-1} normally
d366bd53
CY
57does (@pxref{Text Scale}). This change makes Emacs behave more like
58other Mac / GNUstep applications.
8be76823 59
ec8a6295 60 When you open or save files using the menus, or using the
40ace058 61@kbd{Cmd-o} and @kbd{Cmd-S} bindings, Emacs uses graphical file
8be76823 62dialogs to read file names. However, if you use the regular Emacs key
40ace058 63sequences, such as @kbd{C-x C-f}, Emacs uses the minibuffer to read
8be76823
CY
64file names.
65
40ace058
GM
66 On GNUstep, in an X-windows environment you need to use @kbd{Cmd-c}
67instead of one of the @kbd{C-w} or @kbd{M-w} commands to transfer text
8be76823 68to the X primary selection; otherwise, Emacs will use the
40ace058 69``clipboard'' selection. Likewise, @kbd{Cmd-y} (instead of @kbd{C-y})
8be76823
CY
70yanks from the X primary selection instead of the kill-ring or
71clipboard.
72
8be76823 73
a71703d3 74@subsection Grabbing environment variables
8be76823 75
a6936c4b
GM
76@c How is this any different to launching from a window manager menu
77@c in GNU/Linux? These are sometimes not login shells either.
78Many programs which may run under Emacs, like latex or man, depend on the
a71703d3
AR
79settings of environment variables. If Emacs is launched from the shell, it
80will automatically inherit these environment variables and its subprocesses
e93bc142 81will inherit them from it. But if Emacs is launched from the Finder it
a71703d3 82is not a descendant of any shell, so its environment variables haven't been
a6936c4b 83set, which often causes the subprocesses it launches to behave differently than
a71703d3 84they would when launched from the shell.
8be76823 85
a6936c4b 86For the PATH and MANPATH variables, a system-wide method
271736fc
DR
87of setting PATH is recommended on Mac OS X 10.5 and later, using the
88@file{/etc/paths} files and the @file{/etc/paths.d} directory.
8be76823 89
abb9615e 90@node Mac / GNUstep Customization
e93bc142 91@section Mac / GNUstep Customization
8be76823 92
6dc6521e
GM
93There are a few customization options that are specific to the
94Nextstep port. For example, they affect things such as the modifier
95keys and the fullscreen behavior. To see all such options, use
96@kbd{M-x customize-group @key{RET} ns @key{RET}}.
8be76823 97
a71703d3
AR
98@subsection Font and Color Panels
99
40ace058
GM
100The standard Mac / GNUstep font and color panels are accessible via
101Lisp commands. The Font Panel may be accessed with @kbd{M-x
102ns-popup-font-panel}. It will set the default font in the frame most
103recently used or clicked on.
a00c191c
DR
104
105@c To make the setting permanent, use @samp{Save Options} in the
106@c Options menu, or run @code{menu-bar-options-save}.
a71703d3 107
40ace058
GM
108You can bring up a color panel with @kbd{M-x ns-popup-color-panel} and
109drag the color you want over the Emacs face you want to change. Normal
a71703d3 110dragging will alter the foreground color. Shift dragging will alter the
40ace058
GM
111background color. To discard the settings, create a new frame and
112close the altered one.
a00c191c
DR
113
114@c To make the changes permanent select the "Save Options"
ec8a6295 115@c item in the "Options" menu, or run @code{menu-bar-options-save}.
a00c191c 116
40ace058
GM
117Useful in this context is the listing of all faces obtained by
118@kbd{M-x list-faces-display}.
a71703d3 119
c7f8fb28
GM
120@cindex Core Text, on Mac OS X
121In Mac OS X 10.5 and later, Emacs uses a Core Text based font backend
122by default. If you prefer the older font style, enter the following
123at the command-line before starting Emacs:
124
125@example
126% defaults write org.gnu.Emacs FontBackend ns
127@end example
128
1f5e1a16 129
abb9615e 130@node Mac / GNUstep Events
e93bc142 131@section Windowing System Events under Mac OS / GNUstep
a71703d3
AR
132
133 Nextstep applications receive a number of special events which have
134no X equivalent. These are sent as specially defined ``keys'', which
135do not correspond to any sequence of keystrokes. Under Emacs, these
136``key'' events can be bound to functions just like ordinary
137keystrokes. Here is a list of these events.
138
139@table @key
140@item ns-open-file
141@vindex ns-pop-up-frames
142This event occurs when another Nextstep application requests that
143Emacs open a file. A typical reason for this would be a user
144double-clicking a file in the Finder application. By default, Emacs
145responds to this event by opening a new frame and visiting the file in
a6936c4b 146that frame (@code{ns-find-file}). As an exception, if the selected
1c64e6ed 147buffer is the @file{*scratch*} buffer, Emacs visits the file in the
6be93a16 148selected frame.
a71703d3 149
40ace058
GM
150You can change how Emacs responds to a @code{ns-open-file} event by
151changing the variable @code{ns-pop-up-frames}. Its default value,
152@samp{fresh}, is what we have just described. A value of @code{t}
a71703d3
AR
153means to always visit the file in a new frame. A value of @code{nil}
154means to always visit the file in an existing frame.
155
156@item ns-open-temp-file
157This event occurs when another application requests that Emacs open a
158temporary file. By default, this is handled by just generating a
159@code{ns-open-file} event, the results of which are described above.
160
a71703d3
AR
161@item ns-open-file-line
162Some applications, such as ProjectBuilder and gdb, request not only a
163particular file, but also a particular line or sequence of lines in
164the file. Emacs handles this by visiting that file and highlighting
165the requested line (@code{ns-open-file-select-line}).
166
167@item ns-drag-file
168This event occurs when a user drags files from another application
169into an Emacs frame. The default behavior is to insert the contents
170of all the dragged files into the current buffer
171(@code{ns-insert-files}). The list of dragged files is stored in the
172variable @code{ns-input-file}.
173
174@item ns-drag-color
175This event occurs when a user drags a color from the color well (or
176some other source) into an Emacs frame. The default behavior is to
177alter the foreground color of the area the color was dragged onto
178(@code{ns-set-foreground-at-mouse}). If this event is issued with a
179@key{Shift} modifier, Emacs changes the background color instead
180(@code{ns-set-background-at-mouse}). The name of the dragged color is
181stored in the variable @code{ns-input-color}.
182
183@item ns-change-font
184This event occurs when the user selects a font in a Nextstep font
185panel (which can be opened with @kbd{Cmd-t}). The default behavior is
186to adjust the font of the selected frame
187(@code{ns-respond-to-changefont}). The name and size of the selected
188font are stored in the variables @code{ns-input-font} and
a6936c4b 189@code{ns-input-fontsize}, respectively.
a71703d3
AR
190
191@item ns-power-off
ec8a6295 192This event occurs when the user logs out and Emacs is still running, or when
959d68bd
DR
193`Quit Emacs' is chosen from the application menu.
194The default behavior is to save all file-visiting buffers.
a71703d3
AR
195@end table
196
197 Emacs also allows users to make use of Nextstep services, via a set
198of commands whose names begin with @samp{ns-service-} and end with the
40ace058 199name of the service. Type @kbd{M-x ns-service-@key{TAB}} to
a71703d3
AR
200see a list of these commands. These functions either operate on
201marked text (replacing it with the result) or take a string argument
202and return the result as a string. You can also use the Lisp function
203@code{ns-perform-service} to pass arbitrary strings to arbitrary
204services and receive the results back. Note that you may need to
205restart Emacs to access newly-available services.
206
abb9615e 207@node GNUstep Support
e93bc142
AR
208@section GNUstep Support
209
40ace058 210Emacs can be built and run under GNUstep, but there are still
a6936c4b 211issues to be addressed. Interested developers should contact
2f3ac208 212@ifnothtml
a6936c4b 213@email{emacs-devel@@gnu.org}.
2f3ac208
GM
214@end ifnothtml
215@ifhtml
216@url{http://lists.gnu.org/mailman/listinfo/emacs-devel, the
217emacs-devel mailing list}.
218@end ifhtml