HowTos / Xemacs

Working with Xemacs files



This is just a few hints I have thrown together. For more detailed intros see control-escape (an amusing and informative intro, from which, I must confess, some of my xemacs options and helpful hints were cut and pasted from). Also check out the help manual by clicking on the info button.

To open or visit a document as you open xemacs, type 'xemacs filename &' from an xterm. Once xemacs is open, open a file by typing C-x,C-f (the C stands for Ctrl, which you press at the same time as the x, and then Ctrl with the f; if the second C- wasn't there (C-x,f), you would just press the f after releasing the Ctrl and the x). Note that if you press the Open button or choose File->Open from the menus, you'll get a dialog box to help you find the file. If you use the keyboard shortcut, the dialog box does not appear, and you are prompted to enter the filename in the minibuffer. Command line completion works here as it does at the shell prompt, by pressing TAB. Pressing TAB twice opens a DirEd (Directory Edit) buffer, which works like a little file manager to help you locate the file you want. Don't double-click! Selecting items in the DirEd buffer is done with mouse button 2, the middle button.

Occasionally you may find yourself stuck in the minibuffer. You probably typed a control key sequence that didn't do what you thought. Like a modal dialog, the minibuffer prevents you from editing while it is active. You must cancel it to continue working, but ESC does not do the trick! When this happens, the key you want is C-] (Control + right square bracket). Don't ask me why.

You will also notice early on that there is no "New" button and no File->New option on the menu. To create a new, blank document, use the File->Open command (or any equivalent) and specify a file name that does not already exist. The file will be created for you when you save it. There is also no File->Close option on the menu. The keyboard equivalent is C-x k ('kill-buffer').

Setting "Auto Delete Selection"

In most word processors, if you select some text and then type, what you type replaces what you selected. However, Xemacs has that feature turned OFF by default. To turn it on and make it stay on, do the following:

  1. From the Options menu choose Editing Options:Auto Delete Selection.
  2. From the Options menu choose Save Options.

Parenthesis Checking

Parenthesis-checking is a feature in Xemacs that will automatically show you the matching parenthesis in your file. It is an *essential* tool for writing and debugging most code. However, parenthesis checking is OFF in Xemacs unless you turn it on. So here's how to turn it ON:

  1. From the Options menu, choose "Paren Highlighting", and select the type of Parenthesis highlighting you desire ("blinking" is the most commonly used, although I find it a bit annoying and prefer "Steady").
  2. From the Options menu choose Save Options

Now when you click next to a right parenthesis (for example), the matching left parenthesis will blink. If nothing blinks, it means there is no matching parenthesis.

Line Numbers

On the bottom of each xemacs window is a dividing line (called the mode line) that contains the name of the file in the window above it (current buffer), and the major and minor mode for that buffer. It can also display the number of the line the cursor is currently on. It will be displayed as an L followed by the number. To turn this on:

  1. Go to the options menu, choose "Frame Appearance", and select "Line Numbers".
  2. From the Options menu choose Save Options.

One can also find the current line number by "M-x what-line", and can move the cursor to a specific line by M-g.

"Delete...No, I said DELETE!...ARRRGH!"

The first and most annoying thing that PC users will discover about XEmacs is that the backspace key backspaces, and the delete key also backspaces! The reason for this peculiar behavior no doubt goes back to the ancient days of Unix, but it has never been satisfactorily explained to me. To fix it:

  1. Click the Options menu, choose Customize->Emacs->Editing->Basics->Delete Key Deletes Forward.
  2. From the Options menu choose Save Options

(The key that normally "deletes" in XEmacs is Control-d, which still works.) Bear in mind, however, that the XEmacs documentation is written with the default configuration in mind, so when it says to press <DEL>, it usually means the backspace key.