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