# Emacs - GNU project Emacs editor - man(1) - [phpMan]

> **TLDR:** The extensible, customizable, self-documenting, real-time display editor.
>
- Start Emacs and open a file:
  `emacs {{path/to/file}}`
- Open a file at a specified line number:
  `emacs +{{line_number}} {{path/to/file}}`
- Run an Emacs Lisp file as a script:
  `emacs --script {{path/to/file.el}}`
- Start Emacs in console mode (without an X window):
  `emacs {{-nw|--no-window-system}}`
- Start an Emacs server in the background (accessible via `emacsclient`):
  `emacs --daemon`
- Stop a running Emacs server and all its instances, asking for confirmation on unsaved files:
  `emacsclient --eval '(save-buffers-kill-emacs)'`
- Save a file in Emacs:
  `<Ctrl x><Ctrl s>`
- Quit Emacs:
  `<Ctrl x><Ctrl c>`

*Source: tldr-pages*

---

[_EMACS_(1)](https://www.chedong.com/phpMan.php/man/EMACS/1/markdown)                                         GNU                                        [_EMACS_(1)](https://www.chedong.com/phpMan.php/man/EMACS/1/markdown)

## NAME
       emacs - GNU project Emacs editor

## SYNOPSIS
       **emacs **[ _command-line_ _switches_ ] [ _files_ _..._ ]

## DESCRIPTION
       _GNU_  _Emacs_  is  a  version  of  _Emacs_,  written by the author of the original (PDP-10) _Emacs_,
       Richard Stallman.  The user functionality of GNU Emacs encompasses everything  other  editors
       do, and it is easily extensible since its editing commands are written in Lisp.

       The  primary  documentation of GNU Emacs is in the GNU Emacs Manual, which you can read using
       Info, either from Emacs or as a standalone program.  Please look there for complete  and  up-
       to-date documentation.  This man page is updated only when someone volunteers to do so.

       _Emacs_  has an extensive interactive help facility, but the facility assumes that you know how
       to manipulate _Emacs_ windows and buffers.  CTRL-h or F1 enters the Help facility.  Help Tutor‐
       ial (CTRL-h t) starts an interactive tutorial to quickly teach beginners the fundamentals  of
       _Emacs._   Help  Apropos  (CTRL-h a) helps you find a command with a name matching a given pat‐
       tern, Help Key (CTRL-h k) describes a given key sequence, and Help Function  (CTRL-h  f)  de‐
       scribes a given Lisp function.

       _GNU_  _Emacs_'s  many  special  packages handle mail reading (RMail) and sending (Mail), outline
       editing (Outline), compiling (Compile), running subshells within _Emacs_ windows (Shell),  run‐
       ning  a  Lisp read-eval-print loop (Lisp-Interaction-Mode), automated psychotherapy (Doctor),
       and much more.

### Emacs Options
       The following options are of general interest:

              _file_    Edit _file_.

              **--file=_**file_, **--find-file=_**file_, **--visit=_**file_
                      The same as specifying _file_ directly as an argument.

              **+_**number_ Go to the line specified by _number_ (do not insert a space between the "+" sign
                      and the number).  This applies only to the next file specified.

              **+_**line:column_
                      Go to the specified _line_ and _column_.

              **--chdir=_**directory_
                      Change to _directory_.

              **-q**, **--no-init-file**
                      Do not load an init file.

              **-nl**, **--no-shared-memory**
                      Do not use shared memory.

              **--no-site-file**
                      Do not load the site-wide startup file.

              **-nsl**, **--no-site-lisp**
                      Do not add site-lisp directories to load-path.

              **--no-desktop**
                      Do not load a saved desktop.

              **-Q**, **--quick**
                      Similar to "-q --no-site-file --no-splash".   Also,  avoid  processing  X  re‐
                      sources.

              **--no-splash**
                      Do not display a splash screen during start-up.

              **--debug-init**
                      Enable  _Emacs_  Lisp  debugger  during  the  processing  of  the user init file
                      **~/.emacs**.  This is useful for debugging problems in the init file.

              **-u _**user_, **--user=_**user_
                      Load _user_'s init file.

              **--init-directory=_**directory_
                      Start emacs with user-emacs-directory set to _directory_.

              **-t _**file_, **--terminal=_**file_
                      Use specified _file_ as the terminal instead of using stdin/stdout.   This  must
                      be the first argument specified in the command line.

              **--daemon**[=_name_], **--bg-daemon**[=_name_]
                      Start  Emacs as a daemon, enabling the Emacs server and disconnecting from the
                      terminal.  You can then use the emacsclient (see  [**emacsclient**(1)](https://www.chedong.com/phpMan.php/man/emacsclient/1/markdown))  command  to
                      connect to the server (with optional _name_).

              **--fg-daemon**[=_name_]
                      Like "--bg-daemon", but don't disconnect from the terminal.

              **--version**
                      Display _Emacs_ version information and exit.

              **--help  **Display this help and exit.

       The  following  options  are  Lisp-oriented (these options are processed in the order encoun‐
       tered):

              **-f _**function_, **--funcall=_**function_
                      Execute the lisp function _function_.

              **-l _**file_, **--load=_**file_
                      Load the lisp code in the file _file_.

              **--eval=_**expr_, **--execute=_**expr_
                      Evaluate the Lisp expression _expr_.

       The following options are useful when running _Emacs_ as a batch editor:

              **--batch **Edit in batch mode.  The editor will send messages to stderr.  You must use -l
                      and -f options to specify files to execute and functions to call.

              **--script _**file_
                      Run _file_ as an Emacs Lisp script.

              **--insert=_**file_
                      Insert contents of _file_ into the current buffer.

              **--kill  **Exit _Emacs_ while in batch mode.

              **-L _**dir_, **--directory=_**dir_
                      Add _dir_ to the list of directories _Emacs_ searches for Lisp files.

### Using Emacs with X
       _Emacs_ has been tailored to work well with the X Window System.  If you run _Emacs_ from under X
       windows, it will create its own X window to display in.  You will probably want to start  the
       editor as a background process so that you can continue using your original window.

       _Emacs_ can be started with the following X switches:

              **--name=_**name_
                      Specify  the  name which should be assigned to the initial _Emacs_ window.  This
                      controls looking up X resources as well as the window title.

              **--no-x-resources**
                      Do not load X resources.

              **-T _**name_, **--title=_**name_
                      Specify the title for the initial X window.

              **-r**, **-rv**, **--reverse-video**
                      Display the _Emacs_ window in reverse video.

              **-fn _**font_, **--font=_**font_
                      Set the _Emacs_ window's font to that specified by _font_.  You will find the var‐
                      ious _X_ fonts in the _/usr/lib/X11/fonts_ directory.  Note that _Emacs_  will  only
                      accept  fixed  width  fonts.  Under the X11 Release 4 font-naming conventions,
                      any font with the value "m" or "c" in the eleventh field of the font name is a
                      fixed width font.  Furthermore, fonts whose name are of the form  _width_x_height_
                      are generally fixed width, as is the font _fixed_.  See [**xlsfonts**(1)](https://www.chedong.com/phpMan.php/man/xlsfonts/1/markdown) for more in‐
                      formation.

                      When  you  specify  a  font, be sure to put a space between the switch and the
                      font name.

              **--xrm=_**resources_
                      Set additional X resources.

              **--color**, **--color=_**mode_
                      Override color mode for character terminals; _mode_ defaults to "auto", and  can
                      also be "never", "auto", "always", or a mode name like "ansi8".

              **-bw _**pixels_, **--border-width=_**pixels_
                      Set  the _Emacs_ window's border width to the number of pixels specified by _pix‐_
                      _els_.  Defaults to one pixel on each side of the window.

              **-ib _**pixels_, **--internal-border=_**pixels_
                      Set the window's internal border width to the number of  pixels  specified  by
                      _pixels_.  Defaults to one pixel of padding on each side of the window.

              **-g _**geometry_, **--geometry=_**geometry_
                      Set the _Emacs_ window's width, height, and position as specified.  The geometry
                      specification is in the standard X format; see [**X**(7)](https://www.chedong.com/phpMan.php/man/X/7/markdown) for more information.  The
                      width  and height are specified in characters; the default for GUI frames is a
                      width of 80 and a height between 35 and 40, depending on the OS and the window
                      manager.  See the Emacs manual, section "Options for  Window  Size  and  Posi‐
                      tion",  for  information  on how window sizes interact with selecting or dese‐
                      lecting the tool bar, tab bar and menu bar.

              **-lsp _**pixels_, **--line-spacing=_**pixels_
                      Additional space to put between lines.

              **-vb**, **--vertical-scroll-bars**
                      Enable vertical scrollbars.

              **-fh**, **--fullheight**
                      Make the first frame as high as the screen.

              **-fs**, **--fullscreen**
                      Make the first frame fullscreen.

              **-fw**, **--fullwidth**
                      Make the first frame as wide as the screen.

              **-mm**, **--maximized**
                      Maximize the first frame, like "-fw -fh".

              **-fg _**color_, **--foreground-color=_**color_
                      On color displays, set the color of the text.

                      Use the command _M-x_ _list-colors-display_ for a list of valid color names.

              **-bg _**color_, **--background-color=_**color_
                      On color displays, set the color of the window's background.

              **-bd _**color_, **--border-color=_**color_
                      On color displays, set the color of the window's border.

              **-cr _**color_, **--cursor-color=_**color_
                      On color displays, set the color of the window's text cursor.

              **-ms _**color_, **--mouse-color=_**color_
                      On color displays, set the color of the window's mouse cursor.

              **-d _**displayname_, **--display=_**displayname_
                      Create the _Emacs_ window on the display specified by _displayname_.  Must be  the
                      first option specified in the command line.

              **-nbi**, **--no-bitmap-icon**
                      Do not use picture of gnu for Emacs icon.

              **--iconic**
                      Start _Emacs_ in iconified state.

              **-nbc**, **--no-blinking-cursor**
                      Disable blinking cursor.

              **--parent-id=_**xid_
                      Set parent window.

              **-nw**, **--no-window-system**
                      Tell  _Emacs_  not to create a graphical frame.  If you use this switch when in‐
                      voking _Emacs_ from an [**xterm**(1)](https://www.chedong.com/phpMan.php/man/xterm/1/markdown) window, display is done in that window.

              **-D**, **--basic-display**
                      This option disables many display features; use it for debugging Emacs.

       You can set _X_ default values for your _Emacs_ windows in your _.Xresources_ file  (see  [**xrdb**(1)](https://www.chedong.com/phpMan.php/man/xrdb/1/markdown)).
       Use the following format:

              emacs._keyword_:_value_

       where  _value_  specifies  the default value of _keyword_.  _Emacs_ lets you set default values for
       the following keywords:

              **background **(class **Background**)
                      For color displays, sets the window's background color.

              **bitmapIcon **(class **BitmapIcon**)
                      If **bitmapIcon**'s value is set to _on_, the window will iconify into the  "kitchen
                      sink."

              **borderColor **(class **BorderColor**)
                      For color displays, sets the color of the window's border.

              **borderWidth **(class **BorderWidth**)
                      Sets the window's border width in pixels.

              **cursorColor **(class **Foreground**)
                      For color displays, sets the color of the window's text cursor.

              **cursorBlink **(class **CursorBlink**)
                      Specifies  whether  to  make the cursor blink.  The default is _on_.  Use _off_ or
                      _false_ to turn cursor blinking off.

              **font **(class **Font**)
                      Sets the window's text font.

              **foreground **(class **Foreground**)
                      For color displays, sets the window's text color.

              **fullscreen **(class **Fullscreen**)
                      The desired fullscreen size.  The value can be  one  of  _fullboth_,  _maximized_,
                      _fullwidth_,  or _fullheight_, which correspond to the command-line options "-fs",
                      "-mm", "-fw", and "-fh", respectively.  Note that this applies to the  initial
                      frame only.

              **geometry **(class **Geometry**)
                      Sets the geometry of the _Emacs_ window (as described above).

              **iconName **(class **Title**)
                      Sets the icon name for the _Emacs_ window icon.

              **internalBorder **(class **BorderWidth**)
                      Sets the window's internal border width in pixels.

              **lineSpacing **(class **LineSpacing**)
                      Additional space ("leading") between lines, in pixels.

              **menuBar **(class **MenuBar**)
                      Gives frames menu bars if _on_; don't have menu bars if _off_.  See the Emacs man‐
                      ual,  sections "Lucid Resources" and "Motif Resources", for how to control the
                      appearance of the menu bar if you have one.

              **minibuffer **(class **Minibuffer**)
                      If _none_, don't make a minibuffer in  this  frame.   It  will  use  a  separate
                      minibuffer frame instead.

              **paneFont **(class **Font**)
                      Font name for menu pane titles, in non-toolkit versions of _Emacs_.

              **pointerColor **(class **Foreground**)
                      For color displays, sets the color of the window's mouse cursor.

              **privateColormap **(class **PrivateColormap**)
                      If  _on_,  use  a  private  color map, in the case where the "default visual" of
                      class **PseudoColor **and **Emacs **is using it.

              **reverseVideo **(class **ReverseVideo**)
                      If **reverseVideo**'s value is set to _on_, the window will be displayed in  reverse
                      video.

              **screenGamma **(class **ScreenGamma**)
                      Gamma correction for colors, equivalent to the frame parameter "screen-gamma".

              **scrollBarWidth **(class **ScrollBarWidth**)
                      The   scroll   bar   width  in  pixels,  equivalent  to  the  frame  parameter
                      "scroll-bar-width".

              **selectionFont **(class **SelectionFont**)
                      Font name for pop-up menu items,  in  non-toolkit  versions  of  _Emacs_.   (For
                      toolkit  versions, see the Emacs manual, sections "Lucid Resources" and "Motif
                      Resources".)

              **selectionTimeout **(class **SelectionTimeout**)
                      Number of milliseconds to wait for a selection reply.  A value of 0 means wait
                      as long as necessary.

              **synchronous **(class **Synchronous**)
                      Run Emacs in synchronous mode if _on_.  Synchronous mode is useful for debugging
                      X problems.

              **title **(class **Title**)
                      Sets the title of the _Emacs_ window.

              **toolBar **(class **ToolBar**)
                      Number of lines to reserve for the tool bar.

              **tabBar **(class **TabBar**)
                      Number of lines to reserve for the tab bar.

              **useXIM **(class **UseXIM**)
                      Turns off use of X input methods (XIM) if _false_ or _off_.

              **verticalScrollBars **(class **ScrollBars**)
                      Gives frames scroll bars if _on_; suppresses scroll bars if _off_.

              **visualClass **(class **VisualClass**)
                      Specify the "visual" that X should use.  This tells X how  to  handle  colors.
                      The  value should start with one of _TrueColor_, _PseudoColor_, _DirectColor_, _Stat‐_
                      _icColor_, _GrayScale_, and _StaticGray_, followed by **-_**depth_,  where  _depth_  is  the
                      number of color planes.

## MANUALS
       You can order printed copies of the GNU Emacs Manual from the Free Software Foundation, which
       develops GNU software.  See the online store at <<https://shop.fsf.org/>>.
       Your local administrator might also have copies available.  As with all software and publica‐
       tions from FSF, everyone is permitted to make and distribute copies of the Emacs manual.  The
       Texinfo source to the manual is also included in the Emacs source distribution.

## FILES
       /usr/local/share/info  —  files for the Info documentation browser.  The complete text of the
       Emacs reference manual is included in a convenient tree structured form.  This  includes  the
       Emacs Lisp Reference Manual, useful to anyone wishing to write programs in the Emacs Lisp ex‐
       tension language, and the Introduction to Programming in Emacs Lisp.

       /usr/local/share/emacs/$VERSION/lisp  — Lisp source files and compiled files that define most
       editing commands.  Some are preloaded; others are autoloaded from this directory when used.

       /usr/local/libexec/emacs/$VERSION/$ARCH — various programs that are used with GNU Emacs.

       /usr/local/share/emacs/$VERSION/etc — various files of information.

       /usr/local/share/emacs/$VERSION/etc/DOC.* — contains the documentation strings for  the  Lisp
       primitives  and  preloaded  Lisp  functions of GNU Emacs.  They are stored here to reduce the
       size of Emacs proper.


## BUGS
       There is a mailing list, <bug-gnu-emacs@gnu.org>, for reporting Emacs bugs and fixes.  But  be‐
       fore  reporting something as a bug, please try to be sure that it really is a bug, not a mis‐
       understanding or a deliberate feature.  We ask you to read the section  "Reporting  Bugs"  in
       the  Emacs manual for hints on how and when to report bugs.  Also, include the version number
       of the Emacs you are running in _every_ bug report that you send in.  Bugs tend actually to  be
       fixed  if  they  can be isolated, so it is in your interest to report them in such a way that
       they can be easily reproduced.

       Do not expect a personal answer to a bug report.  The purpose of reporting  bugs  is  to  get
       them  fixed  for everyone in the next release, if possible.  For personal assistance, consult
       the service directory at <<https://www.fsf.org/resources/service/>> for a list  of  people  who
       offer it.

       Please do not send anything but bug reports to this mailing list.  For other Emacs lists, see
       <<https://savannah.gnu.org/mail/?group=emacs>>.

## UNRESTRICTIONS
       _Emacs_  is  free;  anyone may redistribute copies of _Emacs_ to anyone under the terms stated in
       the GNU General Public License, a copy of which accompanies each copy of _Emacs_ and which also
       appears in the reference manual.

       Copies of _Emacs_ may sometimes be received packaged with distributions of Unix systems, but it
       is never included in the scope of any license covering those systems.   Such  inclusion  vio‐
       lates  the terms on which distribution is permitted.  In fact, the primary purpose of the GNU
       General Public License is to prohibit anyone from attaching any other restrictions to  redis‐
       tribution of _Emacs_.

       Richard  Stallman  encourages  you to improve and extend _Emacs_, and urges that you contribute
       your extensions to the GNU library.  Eventually GNU (Gnu's Not Unix) will be a  complete  re‐
       placement for Unix.  Everyone will be free to use, copy, study and change the GNU system.

## SEE ALSO
       [**emacsclient**(1)](https://www.chedong.com/phpMan.php/man/emacsclient/1/markdown), [**etags**(1)](https://www.chedong.com/phpMan.php/man/etags/1/markdown), [**X**(7)](https://www.chedong.com/phpMan.php/man/X/7/markdown), [**xlsfonts**(1)](https://www.chedong.com/phpMan.php/man/xlsfonts/1/markdown), [**xterm**(1)](https://www.chedong.com/phpMan.php/man/xterm/1/markdown), [**xrdb**(1)](https://www.chedong.com/phpMan.php/man/xrdb/1/markdown)

## AUTHORS
       _Emacs_ was written by Richard Stallman and the Free Software Foundation.  For detailed credits
       and acknowledgments, see the GNU Emacs manual.

## COPYING
       Copyright 1995, 1999-2024 Free Software Foundation, Inc.

       Permission  is  granted  to make and distribute verbatim copies of this document provided the
       copyright notice and this permission notice are preserved on all copies.

       Permission is granted to copy and distribute modified versions of  this  document  under  the
       conditions  for verbatim copying, provided that the entire resulting derived work is distrib‐
       uted under the terms of a permission notice identical to this one.

       Permission is granted to copy and distribute translations of this document into another  lan‐
       guage,  under  the above conditions for modified versions, except that this permission notice
       may be stated in a translation approved by the Free Software Foundation.


GNU Emacs 29.3                               2022-06-07                                     [_EMACS_(1)](https://www.chedong.com/phpMan.php/man/EMACS/1/markdown)
