emacs Command

The emacs command launches the Emacs text editor, a powerful and extensible editor that can be customized for various text editing tasks, programming, and document preparation.

Syntax

emacs [OPTIONS] [FILE...]

Description

Emacs is a highly customizable text editor that provides extensive functionality through its built-in Lisp interpreter. It can be used for text editing, programming, email, and many other tasks.

Key features:

  • Powerful text editing capabilities
  • Extensive customization through Emacs Lisp
  • Built-in help system and tutorial
  • Support for multiple programming languages
  • Integrated development environment features

Common Options

Option Description
-nw Run in terminal mode (no window)
-q Start without loading init file
-l file Load Lisp file on startup
-f function Execute Lisp function on startup
--help Display help information
--version Show version information
-batch Run in batch mode
-eval expr Evaluate Lisp expression

Examples

Open emacs

emacs

Starts Emacs with a new buffer

Open specific file

emacs myfile.txt

Opens myfile.txt in Emacs

Run in terminal mode

emacs -nw myfile.txt

Opens Emacs in terminal mode without GUI

Start without init file

emacs -q

Starts Emacs without loading configuration

Open multiple files

emacs file1.txt file2.txt file3.txt

Opens multiple files in separate buffers

Execute function on startup

emacs -f calendar

Starts Emacs and runs the calendar function

Load Lisp file

emacs -l ~/.emacs.d/my-config.el

Loads a specific Lisp configuration file

Batch mode processing

emacs -batch -l script.el -f my-function

Runs Emacs in batch mode for scripting

Evaluate Lisp expression

emacs -eval "(message \"Hello World\")"

Evaluates a Lisp expression on startup

Essential Key Bindings

Key Binding Description
Ctrl+X Ctrl+F Open file
Ctrl+X Ctrl+S Save file
Ctrl+X Ctrl+C Exit Emacs
Ctrl+G Cancel current command
Ctrl+X B Switch buffer
Ctrl+X K Kill buffer
Ctrl+H T Start tutorial

See also