Access Keys:
Skip to content (Access Key - 0)

Customizing Emacs using a .emacs file

To customize Emacs, you need to write some Lisp code. It's not really that difficult. The code should be put in a file named '.emacs' in your home directory. Every time Emacs starts up, it automatically reads any Lisp code you have put into your '.emacs' file.

  • To define a key binding, use an expression of this form:
    	(define-key key-map keystrokes function)
    
  • To set an Emacs variable, use an expression of this form:
    	(setq variable value)
    
  • The section below gives some typical customizations you might perform in your '.emacs' file. Note that comments in are preceded by semicolon ';' characters.
    (global-set-key "\M-g" 'goto-line)		; Esc-G runs the goto-line
    						; function.
    
    (global-set-key "\C-xt" 'transpose-lines)	; Ctrl-x t runs the
    						; transpose-lines function.
    
    (setq default-major-mode 'text-mode)		; Default mode is text-mode.
    
    (setq text-mode-hook				; Enable auto-fill-mode
     '(lambda () (auto-fill-mode 1)))		; whenever using text-mode.
    
    (setq delete-auto-save-files t)			; Delete unnecessary
    						; auto-save files.
    
    (display-time)					; Display current time and
    						; load average on mode line.
    

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

February 22, 2015

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
olc-emacs olc-emacs Delete
customize customize Delete
emacs emacs Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki