Center for Patient Care and Outcomes Research (PCOR)

Center for Patient Care and Outcomes Research (PCOR)

EmailEmail    |   Bookmark Page Bookmark  |   RSS Feeds RSS  |   Print Page Print  

XEmacs FAQs

How do I use the XEmacs editor?
XEmacs is a highly customizable open source text editor and application development system. It is free software released under the GNU Public License (GPL) and related to other versions of emacs, such as GNU Emacs. XEmacs was the first version of emacs to take advantage of X Windows which is how its name. XEmacs is available for nearly all versions of Unix or Unix-like operating systems, such as Linux and Mac OS X, that support X Windows. More recently, XEmacs was also ported to MS Windows.

To start XEmacs, type the following at the command prompt:

godzilla ~ % xemacs &

This will open XEmacs with an introduction screen that has some useful reminders of important information.

Command Keys:

You can perform a lot of operations from the Menu and the Toolbar that are self-explanatory.  Due to the constant mouse movements you may find these inconvenient; key combinations exist for many common operations. On Sun keyboards, the Alt key is the menu accelerator, e.g. Alt-f displays the File menu.

Modifier Keys:

C-KEY means hold down the Control key while pressing another KEY. For example, C-x means hold down Control while pressing x.

Sh-KEY means hold down the Shift key while pressing another KEY.

M-KEY means hold down the Meta key while pressing another KEY. On PC and Mac keyboards, the Meta key is usually the Alt key. On Sun keyboards, Meta keys are usually to the left and right of the spacebar and have a solid diamond symbol. If you don't have a Meta key, you can press Esc, release, and then press KEY.

Execute an emacs command:
M-x COMMAND Enter

Getting out of Trouble:

Cancel current command
C-g

Exit xemacs
C-x C-c

File Commands:

Open a file or directory:
C-x C-f

Toggle files in a directory:
C-c o
M-x dired-omit-toggle

Open a file/URL in the cursor:
C-c f
right mouse button
M-x find-file-at-point

Save a file:
C-x C-s

Refresh a file:
F2

Toggle read-only status of file:
C-x C-q (or middle mouse button click on --%%- in the file/mode status: bottom left)

Text Commands:

Undo changes:
C-x u
Undo

Copy region:
C-Insert
Copy

Cut region:
Sh-Delete
C-Delete
Cut

Paste region:
Sh-Insert
Paste

Select whole buffer as region:
C-x h
Props

Cut a rectangle of text:
M-x kill-rectangle
C-x r k

Paste a Cut rectangle of text:
M-x yank-rectangle
C-x r y

Fill paragraph:
M-q

Search forward:
C-s (Return stops search)

Search backward:
C-r (Return stops search)

Search forward w/ wildcards:
M-C-s (Return stops search)

Search backward w/ wildcards:
M-C-r (Return stops search)

Query-replace:
M-% (y for replace, n for no replace, ! for replace all, Return to stop)

Create a portrait .rtf file:
C-F1

Create a landscape .rtf file:
C-F2

Comment a region:
C-c c
M-x comment-region

Uncomment a region:
C-u C-c c
C-u M-x comment-region

Buffer Commands:

Switch to the *shell* buffer:
F8

Send Control character:
C-q C-KEY

Split window for two views:
C-x 2

Unsplit window:
C-x 1

Compose an email message:
C-x m

Find email address:
C-c C-m
(Type FIRSTNAME LASTNAME and press C-c C-m. An MCW email address and telephone number will replace the name that you typed. LASTNAME must be exact, but FIRSTNAME just needs to be the first character. Only one entry will be returned so make sure that you specify a person uniquely.)

Send an email message:
C-c C-c

Close a buffer:
C-x k

List all buffers:
C-x C-b

vi emulation on:
M-Esc

vi emulation toggle off/on:
C-z (from vi command mode to emacs and back)

Cursor Movement Commands:

Move to beginning of line:
C-a
Home

Move to end of line:
C-e
End

Beginning of file:
C-Home

End of file:
C-End

Page down:
PageDown

Page up:
PageUp

Forward word:
M-f

Backward word:
M-b

Help:

xemacs tutorial:
M-? t

xemacs manuals:
F1 i (or using your mouse to click on the "info" icon in the toolbar)

Search for help:
F1 a TEXT

Help for a key:
F1 k KEY

Help for an emacs variable:
F1 v VARIABLE

Help for an emacs command:
F1 f COMMAND

Help for an emacs mode:
F1 m

Help for all keys currently available:
F1 b

Help for a UNIX command:
M-x man
(this is preferable to typing "man COMMAND" in the *shell* buffer)

ESS Commands:

Start R:
M-x R

Start Stata:
M-x stata

Batch submit a .sas program:
F3

Batch submit a highlighted region of a .sas buffer:
C-F3

Switch to the .sas buffer:
F4

Switch to the .log, refresh and search for errors:
F5

Switch to the .lst and refresh:
F6

Switch to the .txt and refresh:
F7

Open a SAS dataset with PROC FSVIEW:
F9

Open a SAS dataset with PROC INSIGHT:
C-F9

Switch to the .csv and refresh:
F11

View a GSASFILE graph:
F12

For more information about ESS, you can read the ESS manual from within xemacs by typing F1 i (or using your mouse to click on the "info" icon in the toolbar) and scroll down to "* ESS: (ess). Emacs Speaks Statistics." ESS manual is available on the web at http://ess.r-project.org/Manual/ess.html 

Fonts and Point Size:

There are two ways to do this.  The first is probably the easiest.

On the Options menu, select Font.  From there you can pick the font that you want.  On our system, Lucidatypewriter seems to work well.  Now, from the Options menu, select Font Size.  From this list, select the point size that you want.  You can change these settings until you are satisfied with your choices.  Then, from the Options menu, select Save Options to Custom File.  From now on this will be your font and point size choice (until you decide to change it again).

Like all X Windows applications, you can specify the font and point size used by XEmacs in ~/.Xdefaults. After making your changes, reload settings and restart XEmacs:
godzilla ~ % xrdb ~/.Xdefaults; xemacs &
! ~/.Xdefaults
! Lines starting with ! are comments
! You can see which fonts and point sizes are available by:
! prompt> xlsfonts
!
! The default font for the text area of XEmacs is set by XEmacs.default.attributeFont
!
! bold weight
!XEmacs.default.attributeFont: *-courier-bold-r-*-*-*-120-*-*-*-*-*-*
! regular weight
!XEmacs.default.attributeFont: *-courier-medium-r-*-*-*-120-*-*-*-*-*-*

webmaster@mcw.edu
© 2012 Medical College of Wisconsin
Page Updated 07/13/2011