COMP1011 Xemacs Frequently Asked Questions
Computing 1A 05s2 Last updated Wed 20 Jul 2005 14:14
Mail cs1011@cse.unsw.edu.au

We'll post here all the interesting new questions which have been asked about Xemacs, and their answers. Please read this carefully before asking any questions - most of your questions will be answered in here. It is very bad form to ask a question which is answered in a FAQ.

General Questions

  1. How do I quit?
  2. Help! Xemacs has frozen or it's doing something weird!
  3. How do I cut/copy/paste like C-X, C-C and C-V on Windows?
  4. How do I get to the menus if I'm running Xemacs from telnet?
  5. How do I run ghci inside Xemacs? How do I get rid of the ghci window?
  6. How do I switch from the ghci window back to my file?
  7. How do I do that really cool type-out-rest-of-function-name-for-me thing Manuel does in the lectures?
  8. Help help there's too many (), [], {}, and <>s on the screen! I'm getting a headache!
  9. How do I change the font?
  10. Is there a way I can get Xemacs to automatically indent Haskell functions for me?
  11. I want to select a rectangular region on the screen. Can Xemacs do this?
  12. How do I go to a specific line?
  13. Can I see what line number I'm on?
  14. I have a new question to put in this FAQ.

Using Xemacs at Home

  1. Where can I get Xemacs for Windows?
  2. How do I get ghci to run inside Xemacs for Windows?
  3. I am 31337 and run Linux. How do I set up Xemacs on Linux to work with GHC like it does at Uni?

Answers

  1. How do I quit?

    Press C-x C-c.

    (The notation C-x C-c means that you should press both Control and X at the same time, followed by Control and C at the same time.)

  2. Help! Xemacs has frozen or it's doing something weird!

    Try pressing C-g. That's is the universal "stop whatever you are doing" key in Xemacs. If that doesn't work, you'll have to kill Xemacs. To do this, type 'xkill' in an xterm, and when the cursor changes to the lovely skull, click on the Xemacs window to make it go away to the Xemacs afterland.

  3. How do I cut/copy/paste like C-X, C-C and C-V on Windows?

    Using only the keyboard:

    1. Go to beginning of text you want to copy/cut, press C-space
    2. To cut, go to the end of the region you want, and press C-w. To copy the region, press M-w (that's Alt w). Thanks to Pete Gammie for the tip on the M-w key.
    3. Go to where you want to paste the text and press C-y.

    Using only the mouse:

    You can select text normally with the mouse (using the left mouse button); pressing the middle mouse button will paste the text in at the point where you clicked (just like in an xterm). Remember that you use C-w to cut the text if you're using the mouse to select things, and you can still use C-y.

    Thanks to Patryk Zadarnowski for this tip.

  4. How do I get to the menus if I'm running Xemacs from telnet?

    Press the F10 key. You can then use the Up-Arrow and Down-Arrow keys to select the menu choices you want. Note: the F10 key does not work with the telnet program that comes with Windows! It will pull down the menus of the telnet program rather than the menus of Xemacs. If you want to quit, see the answer to Question 1.

  5. How do I run ghci inside Xemacs? How do I get rid of the Ghci window?

    Press C-c C-l. You must be editing a .hs file for this to work. (If your Haskell file isn't being colourised by Xemacs, then you're probably forgetting to save it with the .hs extension.)

    To close the ghci window, make sure that your cursor is in the window with your .hs file, and press C-x 1. (Mnemonic: Make this the only (1) window on the screen.)

  6. How do I switch from the ghci window back to my file?

    If you are at a computer in the labs, just use the mouse and click in the window you want to edit in. If you are working from home through telnet, or you simply want to know every single Xemacs key in existance, C-x o switches windows. Note that the key combination is not C-x C-o! It's C-x, then just o by itself without Control.

  7. How do I do that really cool type-out-rest-of-function-name-for-me thing Manuel does in the lectures?

    Use the key combination M-/. (That's Alt with the / (slash) key.) Here's a bit more detail on how it works from Manuel himself:

    M-/: also know as dynamic abbreviation. Works not only for function names, but anything that is a word by the rules of the syntax table of the currrent buffer. It just searches backward through the buffer for the first word starting with the same prefix (and if that doesn't match anything, forward through the buffer and then in other buffers). So, if I type com M-/ here, I get complete. By pressing M-/ repeatedly, you can cycle through all matches. IMHO this is one of Xemacs' killer features.

    Funky.

  8. Help help there's too many (), [], {}, and <>s on the screen! I'm getting a headache!

    Xemacs to the rescue! Put the following in a file called ~/.xemacs/init.el in your home directory and Xemacs will give much better highlighting of bracket pairs:

    (paren-set-mode 'paren)

    If you're still not convinced Xemacs can do anything, put this stuff in your ~/.xemacs/init.el file:

    (global-set-key "%" 'match-paren)
      (defun match-paren (arg)
        "Go to the matching paren if on a paren; otherwise insert %."
        (interactive "p")
        (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
          ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
          (t (self-insert-command (or arg 1)))))
    

    Now, if you are on a bracket such as ( or ), pressing the % key will bounce you to the matching bracket pair. If you press % and your cursor is not on a bracket, Xemacs will just type out % as it normally would.

  9. How do I change the font?

    Use the "Options->Font" menu. If you want to change it so it will be also be used the next time you start Xemacs, do "Options->Save Options to Init File"

  10. Is there a way I can get Xemacs to automatically indent Haskell functions for me?

    Yes! Xemacs has two types of automatic indentation available: simple and advanced.

    If you don't know what type of indentation mode you're using, you're using advanced. In advanced mode, pressing the Tab key repeatedly cycles through the various indentation levels available.

    In simple indentation mode, pressing Tab advances the cursor to where Xemacs thinks the next indentation level is. To use simple indent mode, make a file called .emacs in your home directory, and add the following line to it:

    (add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
  11. I want to select a rectangular region on the screen. Can Xemacs do this?
    You can mark the beginning of the rectangle with C-space, then go to the bottom-right corner and use C-x r k to cut a rectangle (or C-x r r to copy to a named register) and C-x r y (or C-x i from a named register) to paste it back at the point.
  12. How do I go to a specific line?

    Press M-g (that's Alt-G).

  13. Can I see what line number I'm on?

    Sure. Add the following to your .emacs file:

    (custom-set-variables '(line-number-mode t))
  14. I have a new question to put in this FAQ.

    Please email cs1011 if you have any questions or additions to this FAQ.


  1. Where can I get Xemacs for Windows?

    Click here, (Note: It's an executable file, so after you download it, just double-click it to install it. You do not have to "unzip" the file.)

  2. How do I get Ghci to run inside Xemacs for Windows?

    Download and run the GHCI4XEmacs installer

  3. I am 31337 and run Linux. How do I set up Xemacs on Linux to work with Haskell/Ghci like it does at Uni?

    Go to http://www.haskell.org/haskell-mode/ and have a read. Setting up Xemacs is way outside the scope of this FAQ; if you're really keen on this, consult a local Xemacs guru (or get your tutor to help you find an Xemacs guru).


This faq was originally created by André Pang

cs1011 @ CSE @ UNSW