"Fossies" - the Fresh Open Source Software Archive

Member "emacs-25.3/doc/emacs/macos.texi" (14 Apr 2017, 9775 Bytes) of package /linux/misc/emacs-25.3.tar.xz:


Caution: As a special service "Fossies" has tried to format the requested Texinfo source page into HTML format but that may be not always succeeeded perfectly. Alternatively you can here view or download the uninterpreted Texinfo source code. A member file download can also be achieved by clicking within a package contents listing on the according byte size field. See also the last Fossies "Diffs" side-by-side code changes report for "macos.texi": 25.1_vs_25.2.

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Appendix A Emacs and Mac OS / GNUstep

This section describes the peculiarities of using Emacs built with the GNUstep libraries on GNU/Linux or other operating systems, or on macOS with native window system support. On macOS, Emacs can be built either without window system support, with X11, or with the Cocoa interface; this section only applies to the Cocoa build. This does not support versions before Mac OS X 10.6.

For various historical and technical reasons, Emacs uses the term ‘Nextstep’ internally, instead of “Cocoa” or “macOS”; for instance, most of the commands and variables described in this section begin with ‘ns-’, which is short for ‘Nextstep’. NeXTstep was an application interface released by NeXT Inc during the 1980s, of which Cocoa is a direct descendant. Apart from Cocoa, there is another NeXTstep-style system: GNUstep, which is free software. As of this writing, Emacs GNUstep support is alpha status (see section GNUstep Support), but we hope to improve it in the future.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.1 Basic Emacs usage under Mac OS and GNUstep

By default, the <alt> and <option> keys are the same as <Meta>. The Mac <Cmd> key is the same as <Super>, and Emacs provides a set of key bindings using this modifier key that mimic other Mac / GNUstep applications (see section Windowing System Events under Mac OS / GNUstep). You can change these bindings in the usual way (@pxref{Key Bindings}).

The variable ns-right-alternate-modifier controls the behavior of the right <alt> and <option> keys. These keys behave like the left-hand keys if the value is left (the default). A value of control, meta, alt, super, or hyper makes them behave like the corresponding modifier keys; a value to left means be the same key as ns-alternate-modifier; a value of none tells Emacs to ignore them.

S-mouse-1 adjusts the region to the click position, just like mouse-3 (mouse-save-then-kill); it does not pop up a menu for changing the default face, as S-mouse-1 normally does (@pxref{Text Scale}). This change makes Emacs behave more like other Mac / GNUstep applications.

When you open or save files using the menus, or using the Cmd-o and Cmd-S bindings, Emacs uses graphical file dialogs to read file names. However, if you use the regular Emacs key sequences, such as C-x C-f, Emacs uses the minibuffer to read file names.

On GNUstep, in an X-windows environment you need to use Cmd-c instead of one of the C-w or M-w commands to transfer text to the X primary selection; otherwise, Emacs will use the clipboard selection. Likewise, Cmd-y (instead of C-y) yanks from the X primary selection instead of the kill-ring or clipboard.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.1.1 Grabbing environment variables

Many programs which may run under Emacs, like latex or man, depend on the settings of environment variables. If Emacs is launched from the shell, it will automatically inherit these environment variables and its subprocesses will inherit them from it. But if Emacs is launched from the Finder it is not a descendant of any shell, so its environment variables haven’t been set, which often causes the subprocesses it launches to behave differently than they would when launched from the shell.

For the PATH and MANPATH variables, a system-wide method of setting PATH is recommended on macOS, using the ‘/etc/paths’ files and the ‘/etc/paths.d’ directory.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.2 Mac / GNUstep Customization

There are a few customization options that are specific to the Nextstep port. For example, they affect things such as the modifier keys and the fullscreen behavior. To see all such options, use M-x customize-group <RET> ns <RET>.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.2.1 Font and Color Panels

The standard Mac / GNUstep font and color panels are accessible via Lisp commands. The Font Panel may be accessed with M-x ns-popup-font-panel. It will set the default font in the frame most recently used or clicked on.

You can bring up a color panel with M-x ns-popup-color-panel and drag the color you want over the Emacs face you want to change. Normal dragging will alter the foreground color. Shift dragging will alter the background color. To discard the settings, create a new frame and close the altered one.

Useful in this context is the listing of all faces obtained by M-x list-faces-display.

In macOS, Emacs uses a Core Text based font backend by default. If you prefer the older font style, enter the following at the command-line before starting Emacs:

% defaults write org.gnu.Emacs FontBackend ns

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.3 Windowing System Events under Mac OS / GNUstep

Nextstep applications receive a number of special events which have no X equivalent. These are sent as specially defined key events, which do not correspond to any sequence of keystrokes. Under Emacs, these key events can be bound to functions just like ordinary keystrokes. Here is a list of these events.

<ns-open-file>

This event occurs when another Nextstep application requests that Emacs open a file. A typical reason for this would be a user double-clicking a file in the Finder application. By default, Emacs responds to this event by opening a new frame and visiting the file in that frame (ns-find-file). As an exception, if the selected buffer is the ‘*scratch*’ buffer, Emacs visits the file in the selected frame.

You can change how Emacs responds to a ns-open-file event by changing the variable ns-pop-up-frames. Its default value, ‘fresh’, is what we have just described. A value of t means to always visit the file in a new frame. A value of nil means to always visit the file in an existing frame.

<ns-open-temp-file>

This event occurs when another application requests that Emacs open a temporary file. By default, this is handled by just generating a ns-open-file event, the results of which are described above.

<ns-open-file-line>

Some applications, such as ProjectBuilder and gdb, request not only a particular file, but also a particular line or sequence of lines in the file. Emacs handles this by visiting that file and highlighting the requested line (ns-open-file-select-line).

<ns-drag-file>

This event occurs when a user drags files from another application into an Emacs frame. The default behavior is to insert the contents of all the dragged files into the current buffer (ns-insert-files). The list of dragged files is stored in the variable ns-input-file.

<ns-drag-color>

This event occurs when a user drags a color from the color well (or some other source) into an Emacs frame. The default behavior is to alter the foreground color of the area the color was dragged onto (ns-set-foreground-at-mouse). If this event is issued with a <Shift> modifier, Emacs changes the background color instead (ns-set-background-at-mouse). The name of the dragged color is stored in the variable ns-input-color.

<ns-change-font>

This event occurs when the user selects a font in a Nextstep font panel (which can be opened with Cmd-t). The default behavior is to adjust the font of the selected frame (ns-respond-to-changefont). The name and size of the selected font are stored in the variables ns-input-font and ns-input-fontsize, respectively.

<ns-power-off>

This event occurs when the user logs out and Emacs is still running, or when “Quit Emacs” is chosen from the application menu. The default behavior is to save all file-visiting buffers.

Emacs also allows users to make use of Nextstep services, via a set of commands whose names begin with ‘ns-service-’ and end with the name of the service. Type M-x ns-service-<TAB> to see a list of these commands. These functions either operate on marked text (replacing it with the result) or take a string argument and return the result as a string. You can also use the Lisp function ns-perform-service to pass arbitrary strings to arbitrary services and receive the results back. Note that you may need to restart Emacs to access newly-available services.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

A.4 GNUstep Support

Emacs can be built and run under GNUstep, but there are still issues to be addressed. Interested developers should contact the emacs-devel mailing list.


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on October 14, 2017 using texi2html.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on October 14, 2017 using texi2html.