Programming Environment for C-based Courses


Last modified: "January 13, 1997 20:11:46 by matt"

Emacs is Number One!

I recommend using emacs19 to do your programming. Forget that ancient and obsolete VI stuff! Emacs is the happening place! To run emacs19 just use the 'emacs19' command in the departmental Unix environment. (When not working in an X windowing environment, run version 18 of emacs, via the 'emacs' command.)

Learning emacs

Emacs is the world's most powerful editor, but this comes at a price: Emacs has a steep learning curve. I have been using emacs for 13 years, and pick new stuff up all the time. Still, you only need to know a little about the editor to use it. You will pick up more powerful features as you become more comfortable with the editor. There are four good ways to learn about emacs:

  1. Run the emacs tutorial. To do this, use the Help menu, or just type C-h t.
  2. Check out Keith Waclena's Web-based emacs tutorial.
  3. Use emacs' built-in Info facility. C-h i. Use the middle mouse-button to select topics.
  4. Ask other emacs users. If you see somebody doing something neat, ask them how they do it.

Modifications to Emacs for Programmers

There are a couple of modifications you should make to your emacs environment to make it C or C++ friendly: Put the following code in your ~/.emacs file (before fiddling with your .emacs files, always make a copy someplace safe, in case something goes wrong):

(defvar emacs-is-version-19 (>= (string-to-int (substring emacs-version 0 2)) 19)) (if emacs-is-version-19 (progn (load "completion") ;Turn on completion mode (initialize-completions))) ;This defines M-Ret as complete. (cond (window-system (setq hilit-mode-enable-list '(not text-mode) ;Enables hilighting in all modes except text hilit-background-mode 'light hilit-inhibit-hooks nil hilit-inhibit-rebinding nil) (require 'hilit19) )) ;;; This shell-strip stuff removes the "^M" which would otherwise appear at the end of ;;; every line of output in any shell buffer, including inferior-lisp buffers. (defun my-comint-mode-hook () (require 'shell) (cond ((not (member 'shell-strip-ctrl-m comint-output-filter-functions)) (setq comint-output-filter-functions (cons 'shell-strip-ctrl-m comint-output-filter-functions))))) (if (boundp 'comint-mode-hook) (if (listp comint-mode-hook) (if (not (member 'my-comint-mode-hook comint-output-filter-functions)) (setq comint-mode-hook (append comint-mode-hook '(my-comint-mode-hook)))) (setq comint-mode-hook (list comint-mode-hook 'my-comint-mode-hook))) (setq comint-mode-hook (list 'my-comint-mode-hook))) Here are some capabilities you should have: For a complete list of the commands within the C environment (as it called,) type C-h m.