• English
  • Japanese

emacs

Easy manual for Emacs

About Emacs

What is Emacs

  • It is a very popular multifunction text editor on UNIX. *1
  • You can also use it as mailer (e.g., Wanderlust, Mew, etc.).*2

How to run

  • To run Emacs, just type "emacs filename" where "filename" is file you want to edit with Emacs. If the filename does not exist, a new file with the filename will be created.

How to close

  • [Ctrl] + [x] + [c]

How to save

  • [Ctrl] + [x] + [s]

How to move the cursor

  • Use the arrow keys on a keyboard
    or
[Ctrl]-[p]

[Ctrl]-[b] ←  → [Ctrl]-[f]

[Ctrl]-[n]

Key assign

Command Key assign
Delete one word [Ctrl]-[d]
Cut Begin: [Ctrl]+[Space]/[Ctrl]+[@] End: [Ctrl]+[w]
Copy Begin: [Ctrl]+[Space]/[Ctrl]+[@] End: [Esc]+[w]
Paste [Ctrl]+[y]
Undo [Ctrl]-[x]+[u]

Example

(1) Create a new html file

  1. Login and move to the public directory.
    % cd public_html [Enter key]
    
    1. public_html → If there is no directory, you need to create one.
      % cd [Enter key]
      % mkdir public_html [Enter key]
      % cd public_html [Enter key]
      
  2. Specify the file name, and run Emacs.
    % emacs index.html [Enter key]
    
  3. The plug-in for writing HTML called html-helper-mode is installed in CNS's Emacs, therefore necessary tags are already entered. Type "Hellow!" between <title></title> and <h1></h1>.
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    <html> <head>
    <title>Hello!</title>
    </head>
    <body>
    <h1>Hello!</h1>
    <hr>
    <address></address>
    <!-- hhmts start --> <!-- hhmts end -->
    </body> </html>
    
  4. When you typed, save the file with [Ctrl]-[x][s] and close Emacs with [Ctrl]-[x][c].
  5. Enter "http://web.sfc.keio.ac.jp/~login name/index.html" and see if "Hello!" appears.

(2) Edit the administrative file for mailing list

  1. Login to the mail server, and open the administrative file in Emacs.
    % emacs /var/mail-list/Specified directory/Administrative file name
    
  2. Write one email address on each line.
  3. When all email addresses are entered, save with [Ctrl]-[x][s].
  4. When you saved it, close Emancs with [Ctrl]-[x][c]
*1 As is often said, "Emacs is an environment".
*2 "Emacs+Mew" and "Emacs+Wanderlust" were general mailers on CNS.

Last-Modified: December 20, 2011

The content ends at this position.