CHAPTER 10 Editors
To set or toggle emacs variables, or to use emacs built-in functions, use the <escape> key ("Meta" is how emacs refers to it), followed by the letter x, then by the variable or function and its arguments.
M-x what-line what line is the cursor on?
M-x auto-fill-mode turn on word-wrap
M-x auto-fill-mode turn off word-wrap
M-x set-variable<return>
fill-column<return> set line-length to
45 45 characters
M-x set-variable<return>
auto-save-interval<return> save the file automatically after every
300 300 keystrokes
M-x goto-line<return>16 move the cursor to line 16
M-x help-for-help invoke emacs help when C-h has been bound to the backspace key
The following is a sample .emacs file:
(message "Loading ~/.emacs...")
; Comments begin with semi-colons and continue to the end of the line.
(setq text-mode-hook 'turn-on-auto-fill) ;turn on word-wrap
(setq fill-column 45) ;line-length=45 chars
(setq auto-save-interval 300) ;save after every 300 keystrokes
; Bind (or map) the rubout (control-h) function to the backspace key
(global-set-key "\C-h" 'backward-delete-char-untabify)
; Bind the emacs help function to the keystroke sequence "C-x ?".
(global-set-key "\C-x?" 'help-for-help)
; To jump to line 16, type M-#<return>16
(global-set-key "\M-#" 'goto-line)
; To find out what line you are on, type M-n
(global-set-key "\M-n" 'what-line)
(message "~/.emacs loaded.")
(message "")