aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-11-14 20:46:29 +0000
committerChong Yidong2008-11-14 20:46:29 +0000
commit52e688075d41c469d43ba9eb66cfb675f357305e (patch)
tree0de4600069cd6ea1b2ab7c94401c34a01cde92aa
parent642abf591137e72fc9ff21fc2970cd0f10042116 (diff)
downloademacs-52e688075d41c469d43ba9eb66cfb675f357305e.tar.gz
emacs-52e688075d41c469d43ba9eb66cfb675f357305e.zip
Remove ns-emacs.texi; contents moved into macos.texi (and some credits
moved into nextstep/AUTHORS).
-rw-r--r--doc/misc/ns-emacs.texi1026
1 files changed, 0 insertions, 1026 deletions
diff --git a/doc/misc/ns-emacs.texi b/doc/misc/ns-emacs.texi
deleted file mode 100644
index cd44928aaab..00000000000
--- a/doc/misc/ns-emacs.texi
+++ /dev/null
@@ -1,1026 +0,0 @@
1\input texinfo @c -*-texinfo-*-
2
3@setfilename ../../info/ns-emacs
4@settitle Emacs.app
5
6@dircategory Emacs
7@direntry
8* NS-Emacs: (ns-emacs). Emacs.app for GNUstep and MacOS X.
9@end direntry
10
11@iftex
12@finalout
13@end iftex
14
15@c Easier to update automatically.
16@set VER 23.0.60
17
18@copying
19This document describes Emacs.app for GNUstep and MacOS X.
20
21Copyright @copyright{} 1994, 1997, 2001, 2005, 2006, 2007, 2008 Free Software
22Foundation, Inc.
23
24Copyright @copyright{} 1997 Christian Limpach.
25
26@quotation
27Permission is granted to copy, distribute and/or modify this document
28under the terms of the GNU Free Documentation License, Version 1.2 or
29any later version published by the Free Software Foundation; with no
30Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
31and with the Back-Cover Texts as in (a) below. A copy of the license
32is included in the section entitled ``GNU Free Documentation License''.
33
34(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
35modify this GNU manual. Buying copies from the FSF supports it in
36developing GNU and promoting software freedom.''
37@end quotation
38@end copying
39
40
41@titlepage
42@sp 10
43@center @titlefont{Emacs.app}
44
45@center (@value{VER}, November, 2007)
46
47@sp 2
48@center Carl Edman
49@sp 2
50@center Christian Limpach
51@sp 2
52@center Scott Bender
53@sp 2
54@center Christophe de Dinechin
55@sp 2
56@center Adrian Robert
57@sp 2
58
59@end titlepage
60
61@ignore
62@menu
63* Introduction::
64* Events::
65* Preferences Panel::
66* Preferences::
67* Tips and Tricks::
68* Thanks::
69@end menu
70@end ignore
71
72@node Top, Introduction, (dir), (dir)
73@top Emacs.app
74
75Emacs.app for GNUstep and MacOS X (http://emacs-app.sf.net) is a version of
76GNU Emacs which adds support for the GNUstep and MacOS X systems via the
77OpenStep APIs (referred to as "Cocoa" under OS X). For support for
78NeXTstep, OpenStep, and Rhapsody systems, try the older "Emacs-on-Aqua",
79available at http://emacs-on-aqua.sf.net.
80
81This port leaves most of the core functions of Emacs unchanged and is
82fully-compatible with all Emacs Lisp packages, however it has a number of
83step-ish features which do not have any equivalent in Emacs's X11 interface.
84The design aim was to make it look as similar as possible to an X application
85to Emacs Lisp programs and to make it look like a normal GNUstep or MacOS X
86application to users.
87
88(From here on out we refer to this port as "Emacs.app", and the systems
89supported by this port as "NeXTstep", "NS", or "OpenStep", because saying
90GNUstep / MacOS X is too clumsy. Both systems were derived from the NeXTstep
91libraries developed by NeXT, Inc. for its NeXT computer and operating system,
92whose APIs were later published as the OpenStep specification. All classes
93and functions in these APIs start with the letters 'NS' for this historical
94reason.)
95
96Comments and bug reports relating to the window system interface are welcome.
97To report a bug please use the @samp{Help/Report Emacs.app bug...} menu item.
98This sends messages to the maintainer. (Note, please include your email
99address if you don't usually send email from this machine.)
100
101Problems and bugs which do not relate to the NS support (i.e. which can be
102reproduced even in a dumb terminal or under the Carbon port or X11) should be
103reported through the normal Emacs channels.
104
105Also, please inspect the ``Known Issues'' contained in the README file you may
106have received with this distribution or listed at the web site
107http://emacs-app.sf.net .
108
109There is also a developer mailing list for Emacs.app,
110<emacs-app-dev-@@lists.sourceforge.net>. Sign up through the project page at
111http://emacs-app.sf.net. A user mailing list will be added in time and if
112warranted.
113
114
115@menu
116* Introduction:: What you need to know to use and program.
117* Events:: How NS window system events are handled.
118* Preferences Panel:: Using the Preferences Panel to customize Emacs.
119* Customization:: Customization for Emacs.app.
120* Tips and Tricks:: Collected hints from Emacs users
121* Thanks:: The people who helped create Emacs.app
122@end menu
123
124@node Introduction, Events, Top, Top
125@section Introduction
126
127Despite the size and complexity of GNU Emacs, NeXTstep and the NeXTstep
128support code, this manual can be kept mercifully short by saying that
129everything written in the Emacs and the Emacs Lisp manuals about GNU Emacs
130applies equally to this Emacs except as noted here.
131
132@itemize @bullet
133@item
134The ``right-click'' button (usually the right-hand button on a two-button
135mouse) is mapped to Mouse-3, instead of Mouse-2 as earlier versions of
136Emacs.app. This is for compatibility with X versions of emacs. To get some
137of the old behavior back, you can put in your .emacs:
138
139@lisp
140(global-set-key [mouse-3] 'mouse-yank-at-click)
141@end lisp
142
143The other functionality of mouse-3 in a buffer of extending a selection is
144available via shift-click as in other NS applications. To pop up a context
145menu,
146
147@item
148The Alt or Opt key is bound to the traditional emacs "meta" by default, while
149the NS "command" key is bound to 'super', for which a set of keybindings are
150set to mimic other NeXTstep applications. (See @ref{Events}.) You can change
151either of these bindings using the preferences panel (see @ref{Preferences
152Panel}).
153
154@item
155The standard NeXTstep font and color panels are accessible through the Windows
156menu, or through the standard Cmd-t and Cmd-C. These are easier to use than
157Emacs's own methods for setting these items. To use the color panel, drag
158from it to an emacs frame. The foreground (or background, if shift is held
159down) of the face at that point will be changed. To finalize settings for
160either color or font, choose 'Save Options' from under the Options menu. To
161discard these settings, create a new frame and close the altered one.
162
163@item
164Opening files / directories and 'Save Buffer As' operated from the menus use
165the standard NS file panels. Likewise if you use Cmd-o or Cmd-S. However,
166if you use the regular Emacs key combinations Ctrl-x,Ctrl-f and Ctrl-x,w for
167these functions, the normal Emacs mode of typing filenames into the minibuffer
168is used.
169
170@item
171On GNUstep, in an X-windows environment you need to use Cmd-c instead of one
172of the Ctrl-w or Meta-w commands to transfer text to the X primary selection.
173(Ordinarily the "clipboard" selection is used, for compatibility with more
174modern Gnome and KDE programs.) Likewise, Cmd-y (instead of Ctrl-y) will
175yank/paste in the X primary selection instead of the kill-ring / clipboard.
176
177@item
178The @code{window-system} variable can now have the value @code{ns} in addition
179to, e.g., @code{x} or @code{nil}. You can use this in your .emacs file:
180
181If you just want to distinguish between cases in which there is a
182window system and in which there isn't, this construct is useful.
183@lisp
184(if window-system
185 ... ;;; evaluate if any window system is running
186 ...) ;;; evaluate only when running on a dumb terminal
187@end lisp
188
189For more detailed control, use this.
190@lisp
191(cond
192 ((eq window-system 'ns) ;;; NS specific instructions
193 ...)
194 ((eq window-system 'x) ;;; X specific instructions
195 ...)
196 (t ;;; Instructions for dumb terminal or other window systems
197 ...))
198@end lisp
199
200@item
201Likewise, you can detect whether you are running in emacs-23 or an earlier
202version with:
203
204@lisp
205 (if (eq emacs-major-version '23) <emacs-23 code> <emacs-22- code>)
206@end lisp
207
208@item
209Most NS specific functions begin with 'ns-'. Do "C-h f ns-[TAB]" to list
210these. Many of these replace equivalent 'x-' functions, while others perform
211uniquely NS things, such as Service invocation.
212
213@item
214There are also NS variables beginning with 'ns-', however in most cases users
215need not pay attention to them since the customizability they provide is also
216available through the defaults system and preferences panel (see
217@ref{Preferences Panel} and @ref{Customization}).
218
219@item
220When Emacs is called by a name which ends in @file{-nw} it will always
221start in terminal mode. For example, a user who needs a terminal only
222emacs would create a symbolic link from @file{emacs} to @file{emacs-nw}.
223When he launches @file{emacs-nw} from the command line, the window
224system will never be involved. (Note, as of rc2, terminal mode is still not
225working under OS X.)
226@end itemize
227
228@node Events, Preferences Panel, Introduction, Top
229@section Events
230
231Under Emacs.app the NeXTstep command key works as the @dfn{super} modifier
232key. In principle users can bind their command keys to whatever function they
233want, but to make the transition for NS users easier the default NS startup
234files bind the most commonly used NS command keys to work just like they do in
235most other NS applications. Some are shown in the menus. Choose "List
236Keybindings" from the Help menu and scroll down to the keys labeled starting
237with 's-' to see all of them.
238
239NS applications receive a number of special events which have no X equivalent.
240These are sent as specially defined ``keys'' (which don't correspond to any
241keyboard stroke combination). Under Emacs these ``key'' events can be bound
242to functions just like ordinary keystrokes. Here is a list of these events.
243
244@table @code
245@item ns-open-file
246This event occurs when another NeXTstep application requests that Emacs
247open a file. A typical reason for this would be a user double-clicking
248a file in the Finder. When this event is registered the
249name of the file to open is found in the variable @code{ns-input-file}.
250
251The behaviour of the default binding is controlled by the variable
252@code{ns-pop-up-frames}. It's default value @code{'fresh} causes Emacs
253to open the new file in the selected frame if the selected buffer is a
254scratch buffer. Otherwise Emacs opens a new frame and displays the file
255in that.
256
257To always get a new frame one would change @code{ns-pop-up-frames} to
258@code{t}. To get the opposite behaviour (i.e. always putting the file into
259the selected frame), change @code{ns-pop-up-frames} to @code{nil}.
260
261@item ns-open-temp-file
262This event occurs when another application requests that Emacs open a
263temporary file. The file name is again in @code{ns-input-file}. By
264default this is handled by just generating a @code{ns-open-file} event
265(which then causes the @code{ns-open-file} function to be called
266whatever that may be).
267
268@lisp
269(define-key global-map [ns-open-temp-file] [ns-open-file])
270@end lisp
271
272@item ns-open-file-line
273Some applications (like e.g. ProjectBuilder or gdb) request not only a
274particular file, but also a particular line or sequence of lines in the
275file. The file name is in @code{ns-input-file}, and
276@code{ns-input-line} is either the line or a cons cell the car of which
277contains the beginning line and the cdr of which the ending line.
278
279@lisp
280(define-key global-map [ns-open-file-line] 'ns-open-file-select-line)
281@end lisp
282
283@item ns-drag-file
284When a user drags files from another application into an Emacs frame
285this event is triggered. Here @code{ns-input-file} is a list of all
286dragged files. The default binding inserts all the dragged files into
287the current buffer.
288
289@lisp
290(define-key global-map [ns-drag-file] 'ns-insert-files)
291@end lisp
292
293@item ns-drag-color
294When a user drags a color from the color well (or some other source)
295Emacs sees this event and @code{ns-input-color} contains the name of the
296dragged color. The default bindings alter the foreground color of the
297area the color was dragged onto (or background color if the color was
298shift dragged).
299
300@lisp
301(define-key global-map [ns-drag-color]
302 'ns-set-foreground-at-mouse)
303(define-key global-map [S-ns-drag-color]
304 'ns-set-background-at-mouse)
305@end lisp
306
307@item ns-change-font
308Emacs.app allows the user to open a standard NS font panel (by default that
309function is bound to @kbd{Cmd-t}). When the user selects a font in that
310panel this event occurs. @code{ns-input-font} will contain the name of
311the selected font and @code{ns-input-fontsize} is its size. The
312default binding causes Emacs to adjust the font of the selected frame.
313
314@lisp
315(define-key global-map [ns-change-font] 'ns-respond-to-changefont)
316@end lisp
317
318@item ns-power-off
319Finally when the user logs out and Emacs is still running it receives
320this event so that it has a chance to save its files before it dies.
321
322@lisp
323(define-key global-map [ns-power-off]
324 '(lambda () (interactive) (save-buffers-kill-emacs t)))
325@end lisp
326
327@end table
328
329Emacs.app also allows users to make use of NeXTstep services programatically,
330in addition to via the Services menu. On the most basic level programmers can
331use the @code{ns-perform-service} to pass arbitrary strings to arbitrary
332services and receive the results back. However convenience functions are
333automatically provided for all services so there should be no need to use
334this. These function names begin with 'ns-service-', and they will either
335operate on marked text (replacing it with the result) or take a string
336argument and return the result as a string. Type "M-x ns-service-[TAB][TAB]"
337to see those currently defined. Note that Emacs may require a restart to
338access newly available services.
339
340
341@node Preferences Panel, Customization, Events, Top
342@section Preferences Panel
343
344The Preferences Panel can be used to set or change some of the settings for
345Emacs such as the text appearance, cursor settings, and key bindings.
346
347To save any settings changed through the Preferences Panel, hit OK;
348this has the same effect as if you had explicitly chosen Help > Save
349Preferences.
350
351To restore Emacs to use its default settings click Reset to Defaults from
352the Preferences Panel.
353
354Additional GNUstep/OS X preferences may be set from the command line using
355the @command{defaults} command. (See @ref{Customization}.)
356
357
358@section Text Rendering Preferences
359
360Font and color settings can be set using the standard NeXTstep font
361and color panels.
362
363@itemize @bullet
364@item
365To set the default font used by Emacs click the Default Font... button
366to launch the Font Panel. Click on a frame before selecting the font
367family, typeface, and size of the default font from the Font Panel.
368
369Note that the default font will not be changed if a frame hasn't been
370selected first.
371
372@item
373To set the default foreground or background color click the
374Colors... button to launch the Color Panel. Choose the color you want
375using any of the color models (color wheel, sliders, palette, image,
376or crayons) available from the Colors toolbar. To apply the color
377drag a swatch from the color bar at the top of the panel to text on
378an Emacs frame. Holding down shift will change the background color
379instead of the foreground.
380
381@item
382To use antialiased text check the Smooth Fonts option. Lighter font
383smoothing can be achieved by checking the Use Quickdraw (lighter)
384smoothing option.
385
386@item
387To change the line height that text is displayed at drag the Expand
388Line Spacing slider. When the slider is set to 0.0 Emacs will use the
389same line height as other Mac OS X applications. To increase the line
390height (and decrease the number of lines that can be displayed on the
391screen) drag the slider towards 1.0. To decrease the line height
392(increases the number of lines that can be displayed) drag the slider
393towards -1.0.
394
395After the line spacing setting has been changed Emacs must be restarted
396to take account of the change.
397
398@end itemize
399
400@section Display Preferences
401
402The Display Preferences can be used to change the appearance of the
403default cursor used by Emacs.
404
405@itemize @bullet
406@item
407The Cursor Type radio buttons can be used to select the style used for the cursor:
408
409@itemize
410@item
411Box - the cursor is displayed as a box
412@item
413Underscore - the cursor is displayed as a horizontal bar
414@item
415Bar - the cursor is displayed as a vertical bar
416@item
417Hollow - the cursor is displayed as a box with an outline but no fill
418@end itemize
419
420@item
421Use the Cursor Blink Rate slider to set the frequency at which the cursor blinks.
422
423@item
424Check the Use System Highlight Color option to use the system default
425color for highlighted text.
426
427@end itemize
428
429@section Modifier Interpretation Preferences
430
431The Modifier Preferences can be used to change the behaviour of the
432Alt/Opt and Command keys. By default the Alt or Opt key is bound to
433the Emacs 'Meta' key, and the Command key is bound to 'super' which
434allows the Command key to function in a way similar to other
435NeXTstep/OS X applications.
436
437@itemize @bullet
438@item
439To re-bind the Alt or Opt key select a keybinding from the Alt/Opt Key
440combo box.
441@item
442To re-bind the Command key select a keybinding from the Command Key
443combo box.
444@end itemize
445
446
447@node Customization, Tips and Tricks, Preferences Panel, Top
448@section Customization
449
450Under X, resources are used to customize the behavior of Emacs to the
451needs of the user. These resources are queried programmatically with
452the @code{x-get-resource} function. Under NS defaults fulfill a
453similar function. They can be read using the @code{ns-get-resource}
454function. Calls to @code{x-get-resource} are automatically mapped to
455@code{ns-get-resource}. From the command line, the command
456`@code{defaults read org.gnu.Emacs}' will show these resources as of
457last Emacs quit, and individual resources can be read/written by
458commands like `@code{defaults read Emacs Foo}' and `@code{defaults
459write Emacs Foo barvalue}'.
460
461Calling the function @code{ns-save-preferences} in lisp, or selecting ``Save
462Options'' from the 'Options' menu will automatically write out the defaults
463corresponding to the selected window.
464
465In addition, it is also possible to set many of the following customizations
466by setting the @code{default-frame-alist} in the @file{~/.emacs} file.
467
468Many of the preferences relating specifically to the NS windowing system (font
469rendering, cursor type, etc.) can be set using a @ref{Preferences Panel}
470accessed in the standard fashion from the menubar or Cmd-,. It is important
471to note that when you hit 'OK' on this panel, @emph{all} NS settings are saved
472(including font and colors) just as if you had called
473@code{ns-save-preferences}.
474
475Note that if you use the 'Default Font' button on the Preferences panel, you
476must click on a frame before selecting a font, otherwise nothing will happen.
477If you pop up the color panel, you must drag colors to a frame for them to
478have an effect. (Remember to hold down 'shift' to change background instead
479of foreground.)
480
481This is a listing of some of the more useful defaults (and their default
482values). Several of these defaults accept the names of colors as values. For
483a list of all available colors pull up the color panel and look at the color
484list called ``Emacs''. Emacs also accepts color specifications of the form
485@samp{ARGBaarrggbb} where @var{aa}, @var{rr}, @var{gg}, and @var{bb} are two
486hexadecimal digits describing the alpha, red, green, and blue content of the
487color respectively. @samp{HSBhhssbb}, @samp{CMYKccmmyykk} and
488@samp{GRAYgg} are the equivalents in @samp{HSB}, @samp{CMYK} and gray
489scales. (For HSB, @samp{AHSBaahhssbb} is also accepted.)
490
491@table @samp
492@item InternalBorderWidth
493Width in pixels of the internal border of the NS frame. This acts to separate
494the text area of the window from the fringes, scrollbars, and/or edges.
495
496@example
497defaults write Emacs InternalBorderWidth 2
498@end example
499
500@item VerticalScrollBars
501@samp{YES} or @samp{NO} to enable or disable scroll bars, @samp{left} or
502@samp{right} to explicitly set the side.
503
504@example
505defaults write Emacs VerticalScrollBars YES
506@end example
507
508@item Font
509Name of the default font to be used for new frames (which can be overriden by
510various faces). If this font is not set, Emacs.app will use the system
511wide fixed pitch font. For most users the system fixed pitch font will be
512@samp{Monaco} which doesn't have any bold or italic versions. (Italic will be
513synthesized.)
514
515@item FontSize
516Size of the font to be used for new frames. If not set Emacs for NS will use
517the default size of the system wide fixed pitch font.
518
519@item Foreground
520The default foreground (text) color for new frames.
521
522@example
523defaults write Emacs Foreground "Black"
524@end example
525
526@item Background
527The default background color for new frames.
528
529@example
530defaults write Emacs Background "White"
531@end example
532
533@item Height
534Height in rows of the default window.
535
536@example
537defaults write Emacs Height 48
538@end example
539
540@item Width
541Width in columns of the default window.
542
543@example
544defaults write Emacs Width 80
545@end example
546
547@item CursorType
548Name of the default cursor type for Emacs. Allowed values are
549@samp{box}, @samp{hollow}, @samp{underscore}, @samp{bar}, @samp{line} and @samp{no}.
550
551@example
552defaults write Emacs CursorType box
553@end example
554
555@item CursorBlinkRate
556Users who want their cursor to blink can set the rate (in seconds) with
557this defaults write. Setting it to @samp{NO} disables cursor blinking.
558
559@example
560defaults write Emacs CursorBlinkRate NO
561@end example
562
563@item CursorColor
564Name of the default cursor color for Emacs. Of a particular use for this
565setting is the @samp{Highlight} "color". When it is the cursor color,
566Emacs will draw the cursor using the standard NS highlighting operator.
567
568@example
569defaults write Emacs CursorColor Highlight
570@end example
571
572@item Top
573Distance in pixels from the top of the screen of the upper left corner
574of the default window.
575
576@example
577defaults write Emacs Top 100
578@end example
579
580@item Left
581Distance in pixels from the left edge of the screen to the upper left
582corner of the default window.
583
584@example
585defaults write Emacs Left 100
586@end example
587
588@item HideOnAutoLaunch
589@samp{YES} or @samp{NO} to determine whether Emacs will hide itself when
590autolaunched from the dock.
591
592@example
593defaults write Emacs HideOnAutoLaunch NO
594@end example
595
596@item ExpandSpace
597This lets you expand or shrink the line height used for displaying text. When
598this is set to 0.0, display should look like other NS apps. If you set it
599higher than 0, Emacs will spread the text lines apart, less than 0, compress
600them together. (With settings below zero parts of characters may be chopped
601off in certain fonts.) When using the @ref{Preferences Panel}, this is
602controlled by a slider. You must OK the panel and then restart Emacs.app for
603this default to take effect.
604
605When setting this using @code{"defaults write"}, you can either set a floating
606point value, or @samp{YES}, which is equivalent 0.5, or @samp{NO}, which is
607equivalent to 0.0.
608
609@example
610defaults write Emacs ExpandSpace -0.125
611@end example
612
613@item GSFontAntiAlias
614This turns antialiasing on and off on. Note that, on OS X, even if
615antialiasing is on, Emacs will not antialias text of a size below the system
616preference setting.
617
618@example
619defaults write Emacs GSFontAntiAlias NO
620@end example
621
622@item UseQuickdrawSmoothing
623On OS X 10.3 and higher, this will render fonts using Quickdraw antialiasing,
624which is less heavy than the Quartz antialiasing used by default. Whether
625this is on or off, the system font size threshold for antialiasing (see above)
626is respected.
627
628@example
629defaults write Emacs UseQuickdrawSmoothing YES
630@end example
631
632@item AlternateModifier
633This allows you to set the effect of the Alt or Opt key. The default is
634@samp{meta}, meaning to use as the Emacs 'meta' key. You can also set this to
635@samp{command}, @samp{hyper}, @samp{alt}, or @samp{none}. The last is useful
636for Continental users who normally use this key to enter accented and other
637special characters.
638
639@example
640defaults write Emacs AlternateModifier "none"
641@end example
642
643@item CommandModifier
644This allows you to set the effect of the Command key. The default is
645@samp{super}, which is used in a set of keybindings such as @code{s-o} for
646``open file'' and @code{s-z} for ``undo'' that are similar to other NeXTstep
647applications. On the other hand, some people who use the Alt/Opt key for
648accent entry like to set this to @samp{meta} so they still have easy access to
649Emacs functionality bound to meta keys. You can also set this, like Alt/Opt,
650to @samp{hyper} or @samp{alt}, though there are no bindings to combinations
651using these keys by default. The @samp{none} option is not available for the
652Command key.
653
654@example
655defaults write Emacs CommandModifier "meta"
656@end example
657
658@item fooFrame
659Position and size to use for the frame named @var{foo} when it is
660created. The position and size have to be specified as a space
661separated list: @samp{top}, @samp{left}, @samp{height} and
662@samp{width}. @samp{top} and @samp{left} are expressed in pixels,
663@samp{height} is given in rows and @samp{width} is given in columns.
664Named frames can be created by e.g. @code{(make-frame '((name
665. "FOO")))}.
666
667@example
668defaults write Emacs TestFrame "100 200 30 70"
669@end example
670
671Another default previouly used by many Emacs users is this.
672
673@example
674defaults write Workspace DefaultOpenApp Emacs
675@end example
676
677It caused the NeXTstep Workspace to open files without a registered extension
678in Emacs instead of as usual Edit. For this default to work, Emacs needed to
679be in the application search path of the Workspace (which usually includes
680@file{~/Applications} and @file{~/Applications}). If anyone knows the current
681way to do this under OS X please contact the authors.
682
683@end table
684
685@node Tips and Tricks, Thanks, Customization, Top
686@section Tips and Tricks
687
688Emacs is an extremely customizable editor. You can make it conform to
689virtually any conceivable user idiosyncrasy (and some which are not) by adding
690a few well-chosen lines of emacs lisp to your @file{~/.emacs}. Unfortunately
691even many experienced C developers are unfamiliar with Emacs Lisp. For that
692reason many Emacs.app defaults have been chosen to make it behave as similar
693to TextEdit as possible. But there are some customizations which a majority
694of users probably would hate as much as a minority would love them. This
695section contains a cookbook of such customizations. New contributions by
696Emacs users are very welcome.
697
698@menu
699* Grabbing environment variables::
700* Miscellaneous useful variables::
701* Color adjustments::
702* Evaling in the minibuffer::
703* Highlighting matching parentheses::
704* Dealing with X specific packages::
705* Rebinding the numeric keypad::
706* Improving C mode::
707* Custom menu items::
708* Single line scrolling::
709* Open files by dragging to an Emacs window::
710@ignore
711* Extended font customization::
712@end ignore
713@end menu
714
715@node Grabbing environment variables, Miscellaneous useful variables, Tips and Tricks, Tips and Tricks
716@subsection Grabbing environment variables
717
718Many programs which may run under Emacs like latex or man depend on the
719settings of environment variables. If Emacs is launched from the shell, it
720will automatically inherit these environment variables and its subprocesses
721will inherit them from it. But if Emacs.app is launched from the Finder it
722is not a descendant of any shell, so its environment variables haven't been
723set which often causes the subprocesses it launches to behave differently than
724they would when launched from the shell.
725
726To solve this problem for Emacs.app, there are two solutions. First is to
727run, from the command line:
728
729@example
730.../Emacs.app/Contents/MacOS/bin/mac-fix-env
731@end example
732
733This will pick up your environment settings and save them into a special file
734@file{~/.MacOSX/environment.plist}, which the desktop environment will use to
735set the environment for all launched applications. The drawback of this
736method is it needs to be run again whenever something changes.
737
738The other approach is to use the @code{ns-grabenv} command inside Emacs. This
739function will run a subshell and copy its environment variables into Emacs.
740
741Adding this line to your @file{~/.emacs} will grab the csh environment
742whenever emacs runs under a window system.
743
744@lisp
745(if window-system (ns-grabenv))
746@end lisp
747
748If you have a different shell you will have to give @code{ns-grabenv} some
749arguments. For zsh you would do this.
750
751@lisp
752(if window-system (ns-grabenv "/usr/bin/zsh"
753 "source /etc/zshenv"
754 "source ~/.zshenv"))
755@end lisp
756
757The reason that @code{ns-grabenv} is not done by default is that it adds up
758to a second or two to the Emacs startup time.
759
760@node Miscellaneous useful variables, Color adjustments, Grabbing environment variables, Tips and Tricks
761@subsection Miscellaneous useful variables
762
763This section describes a few variables you might want to set in your
764@file{~/.emacs} each of which doesn't warrant its own section.
765
766There is a conflict between the way the region behaved in emacs in the
767pre-GUI days and the way GUI users expect the selection to work. By
768default that conflict is resolved by having the former adopt the
769behaviour of the latter which most people prefer. However if you are a
770die-hard emacs user you may prefer things the other way around and add
771this line to your @file{~/.emacs}. Experiment with both settings.
772
773@lisp
774(setq transient-mark-mode nil)
775@end lisp
776
777When you try to move beyond the end of a file Emacs used to add newlines as
778needed, however from Emacs-21 on, this was no longer done. If you prefer the
779old behavior, this line in your @file{~/.emacs} will restore it.
780
781@lisp
782(setq next-line-add-newlines t)
783@end lisp
784
785By default when you kill a line with text on it, only the text is
786removed while the line itself remains. You have to kill twice to really
787get rid of the whole line. When this variable is set and you kill a
788line while at the beginning of the line it will go at once.
789
790@lisp
791(setq kill-whole-line t)
792@end lisp
793
794Annoyed by the Emacs startup message ? Add this and you start with a
795tabula rasa.
796
797@lisp
798(setq inhibit-startup-message t)
799@end lisp
800
801@node Color adjustments, Evaling in the minibuffer, Miscellaneous useful variables, Tips and Tricks
802@subsection Color adjustments
803
804A non-elisp hint: The easiest way to adjust your emacs color scheme is to
805bring up a color panel (with @key{Cmd-C}) and drag the color you want over the
806emacs face you want to change. Normal dragging will alter the foreground
807color. Shift dragging will alter the background color. To make the changes
808permanent select the "Save Options" item in the "Options" menu, or run
809@code{ns-save-preferences}. Useful in this context is the listing of all
810faces obtained by @key{M-x} @code{list-faces-display}.
811
812@node Evaling in the minibuffer, Highlighting matching parentheses, Color adjustments, Tips and Tricks
813@subsection Evaling in the minibuffer
814
815Often you (at least if you are an elisp hacker) want to quickly evaluate
816an elisp expression. To accomodate this desire Emacs provides the
817@code{eval-expression} command bound to @key{M-:}. By default it is
818disabled to protect novice users from themselves. These commands
819re-enable it and turn on an extremely powerful completion facility.
820
821@lisp
822(put 'eval-expression 'disabled nil)
823
824(define-key read-expression-map "\t" 'lisp-complete-symbol)
825@end lisp
826
827@node Highlighting matching parentheses, Dealing with X specific packages, Evaling in the minibuffer, Tips and Tricks
828@subsection Highlighting matching parentheses
829
830I doubt that there is anybody who doesn't use this already, but just in
831case:
832
833@lisp
834(show-paren-mode 't)
835@end lisp
836
837In Emacs.app this is currently enhanced by use of the @code{mic-paren} package
838from http://www.docs.uu.se/~mic/emacs.html.
839
840@node Dealing with X specific packages, Rebinding the numeric keypad, Highlighting matching parentheses, Tips and Tricks
841@subsection Dealing with X specific packages
842
843Some emacs lisp packages explicitly call X specific functions instead of
844calling generic functions which call the NS or X versions as appropriate.
845Typically such packages will result in error messages like @samp{Symbol's
846function definition is void: x-foo-bar}. The proper way of dealing with this
847is to have the author fix the code to call the generic functions. Generally
848all that requires is removing the @samp{x-} prefix from all function calls.
849
850However, sometimes that is not possible, or it may be a package internal to
851emacs itself. In this case please report a bug to the Emacs.app maintainers
852(not the main GNU emacs maintainers).
853
854A related problem is font names. For historical reasons, Emacs assumes all
855font names are given ``X style'', as in ``-adobe-courier-....-iso8859-1''.
856Emacs.app tries to work around this as well as possible, and the best thing to
857do is never rely on functions to set font names yourself but to always use the
858font panel.
859
860@node Rebinding the numeric keypad, Improving C mode, Dealing with X specific packages, Tips and Tricks
861@subsection Rebinding the numeric keypad
862
863By default in Emacs the numeric keypad keys are bound to the same
864characters they are in all other NS applications. But it is easy to
865change these bindings to commands many will find more useful. As an
866example here is the code which rebinds the numeric keypad for me.
867
868@lisp
869(global-set-key [kp-0] 'other-window)
870(global-set-key [kp-1] 'end-of-buffer)
871(global-set-key [kp-2] [down])
872(global-set-key [kp-3] 'scroll-up)
873(global-set-key [kp-4] [left])
874(global-set-key [kp-5] 'set-mark-command)
875(global-set-key [kp-6] [right])
876(global-set-key [kp-7] 'beginning-of-buffer)
877(global-set-key [kp-8] [up])
878(global-set-key [kp-9] 'scroll-down)
879(global-set-key [kp-decimal] 'yank)
880(global-set-key [kp-enter] 'set-mark-command)
881(global-set-key [kp-add] 'copy-region-as-kill)
882(global-set-key [kp-subtract] 'kill-region)
883@end lisp
884
885On machines with function keys they can be bound as well. This for example
886would bind @key{F12} to run gnus.
887
888@lisp
889(global-set-key [f12] 'gnus)
890@end lisp
891
892@node Improving C mode, Custom menu items, Rebinding the numeric keypad, Tips and Tricks
893@subsection Improving C mode
894
895That underscores are considered to break words in C mode has been driving me
896insane for a long time. This line fixes the problem.
897
898@lisp
899(modify-syntax-entry ?_ "w" c-mode-syntax-table)
900@end lisp
901
902@node Custom menu items, Single line scrolling, Improving C mode, Tips and Tricks
903@subsection Custom menu items
904
905The tools menu is intended for customization. Adding items to it is
906relatively painless as this example illustrates.
907
908@lisp
909(define-key global-map [menu-bar tools www] '("WWW" . w3-use-hotlist))
910@end lisp
911
912@node Single line scrolling, Open files by dragging to an Emacs window, Custom menu items, Tips and Tricks
913@subsection Single line scrolling
914
915The meta-arrow keys will perform single-line scrolling in Emacs
916just like they did in the old NeXT/OpenStep Stuart.app.
917
918@node Open files by dragging to an Emacs window, , Single line scrolling, Tips and Tricks
919@subsection Open files by dragging to an Emacs window
920
921The default behaviour when a user drags files from another application
922into an Emacs frame is to insert the contents of all the dragged files
923into the current buffer. To remap the @code{ns-drag-file} event to
924open the dragged files in the current frame use the following line:
925
926@lisp
927(define-key global-map [ns-drag-file] 'ns-find-file)
928@end lisp
929
930@ignore
931@node Extended font customization, , Single line scrolling, Tips and Tricks
932@subsection Extended font customization
933
934By default Emacs tries to guess the right font when you ask for a bold,
935italic or bold-italic face. Unfortunately this fails sometimes, for
936example Emacs won't guess that it should use @samp{Courier-Bold} as the
937font for the bold face of @samp{Ohlfs}. As an example here is the code
938which sets up @samp{Courier-Bold}, @samp{Courier-Oblique} and
939@samp{Courier-BoldOblique} as the fonts to be used with @samp{Ohlfs}.
940
941@lisp
942(setq ns-convert-font-trait-alist
943 '(("Ohlfs" "Courier-Bold" "Courier-Oblique"
944 "Courier-BoldOblique")))
945@end lisp
946
947You will still have to set the @samp{DefaultFont}, @samp{BoldFont},
948@samp{ItalicFont} and @samp{Bold-ItalicFont} defaults as Emacs
949initializes the default faces before it reads your @file{~/.emacs}.
950Also Emacs initializes @code{ns-convert-font-trait-alist} from these
951defaults so that normally it's sufficient to set these defaults to get
952correct faces.
953
954@example
955defaults write Emacs DefaultFont Ohlfs
956defaults write Emacs BoldFont Courier-Bold
957defaults write Emacs ItalicFont Courier-Oblique
958defaults write Emacs Bold-ItalicFont Courier-BoldOblique
959@end example
960@end ignore
961
962
963@node Thanks, , Tips and Tricks, Top
964@section Thanks
965A signficant number of people have been involved in the creation of Emacs.app.
966Carl Edman <cedman@@lynx.ps.uci.edu> created and maintained Emacs up to
967version 4.1 and it's reasonable to say that without his work, Emacs.app
968wouldn't exist. Michael Brouwer <michael@@thi.nl> wrote the original version
969(up to and including version 3.x) and was a constant contributor to Emacs.app
970version 4 and above. Christian Limpach <chris@@nice.ch> took over maintenance
971and updating at version 4.2, and made substantial contributions in a number of
972areas. Scott Bender <sbender@@harmony-ds.com> ported the code to OpenStep and
973Rhapsody for version 6.0. Christophe de Dinechin <ddd@@cup.hp.com> ported the
974code to MacOS X for version 7.0 and moved the code base to SourceForge. Leigh
975Smith <leigh@@leighsmith.com> maintained the SourceForge project for a period.
976Adrian Robert <arobert@@cogsci.ucsd.edu> ported the code to GNUstep
977(http://gnustep.org), updated it for post-emacs-20, and maintains it for the
978present.
979
980Also a number of others have contributed code. Steve Nygard
981<nygard@@telusplanet.net> got emacs to dump under OpenStep. The font panel
982code was Andrew Athan's <athan@@object.com> work. Joe Reiss
983<jreiss@@magnus.acs.ohio-state.edu> both created the beautiful icons you see
984and wrote the popup menu and dialog box code as well as much else.
985
986Finally, suggestions from Darcy Brockbank, Timothy Bissell, Scott Byer, David
987Griffiths, Scott Hess, Eberhard Mandler, John C. Randolph, and Bradley Taylor
988all helped things along at one point or another. Axel Seibert
989<seiberta@@informatik.tu-muenchen.de> and Paul J. Sanchez
990<paul@@whimsy.umsl.edu> offered their time and machines to make a binary
991release possible.
992
993The GNUstep port was made possible through the assistance of Adam Fedor, Fred
994Kiefer, M. Uli Klusterer, Alexander Malmberg, and Jonas Matton. Gürkan Sengün
995made it accessible to a wider community.
996
997Riccardo Mottola helped with compatibility with MacOS versions 10.1 and 10.2,
998and GNUstep on platforms other than Linux.
999
1000Peter Dyballa kept things honest with multilingual support. Rahul Abrol, Adam
1001Ratcliffe, David M. Cooke, and Carsten Bormann provided various small patches.
1002
1003Then there were a number of people who kept up the constant supply of bug
1004reports, suggested features and praise (which is the main fuel which the
1005development of a project like this runs) and so helped ensure that this
1006program is as bug free (hah !) and feature rich as you see it today. First
1007among them were Hardy Mayer <hardy@@golem.ps.uci.edu>, Gisli Ottarsson
1008<gisli@@timoshenko.eecs.umich.edu>, Anthony Heading <ajrh@@signal.dra.hmg.gb>,
1009David Bau <bau@@cs.cornell.edu>, Jamie Zawinski <jwz@@lucid.com>, Martin
1010Moncrieffe <moncrief@@mayo.edu>, Simson L. Garfinkel
1011<simsong@@next.cambridge.ma.us>, Richard Stallman <rms@@gnu.ai.mit.edu>,
1012Stephen Anderson <anderson@@sapir.cog.jhu.edu>, Ivo Welch
1013<ivo@@next.agsm.ucla.edu>, Magnus Nordborg <magnus@@fisher.Stanford.EDU>, Tom
1014Epperly <epperly@@valeron.che.wisc.edu>, Andreas Koenig
1015<k@@franz.ww.tu-berlin.de>, Yves Arrouye <Yves.Arrouye@@imag.fr>, Anil
1016Somayaji <soma@@hotspur.mit.edu>, Gregor Hoffleit
1017<flight@@mathi.uni-heidelberg.DE> and doubtlessly many more.
1018
1019Finally, let us also thank those few hundred other people on the mailing list
1020from whom we didn't hear much, but the presence of which assured us that maybe
1021this project was actually worth doing.
1022@bye
1023
1024@ignore
1025 arch-tag: 286bdf18-ccfb-48b2-b730-994771de6bdd
1026@end ignore