User Tools

Site Tools


emacs_tutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
emacs_tutorial [2021/03/21 06:23] – [Windows] hc9emacs_tutorial [2021/03/21 06:38] (current) – [Basic Commands] hc9
Line 31: Line 31:
 | C-l | Redraw and center screen at cursor | | C-l | Redraw and center screen at cursor |
 | M-< | Go to start of buffer | | M-< | Go to start of buffer |
-| M-> | Go to end of buffer |+| M-<nowiki>></nowiki> | Go to end of buffer |
 | Backspace | Delete previous character | | Backspace | Delete previous character |
  
Line 125: Line 125:
 ===== Dired Mode ===== ===== Dired Mode =====
  
-If you type the name of a directory after a "C-x C-fcommand, Emacs will display the directory contents in a new buffer. By default, Emacs displays the file name, permissions, owner/group, size and timestamp of each file on a line by itself. You can visit a file by just moving the cursor to it and hitting "Enter". Dired mode is unlike other modes in that single keys are used to effect commands. Here is a list of the most useful dired commands:+If you type the name of a directory after a ''C-x C-f'' command, Emacs will display the directory contents in a new buffer. By default, Emacs displays the file name, permissions, owner/group, size and timestamp of each file on a line by itself. You can visit a file by just moving the cursor to it and hitting ''Enter''. Dired mode is unlike other modes in that single keys are used to effect commands. Here is a list of the most useful dired commands:
  
 | Left, right arrow keys or p, n | Previous and next file, respectively | | Left, right arrow keys or p, n | Previous and next file, respectively |
Line 146: Line 146:
 ===== Shell Modes ===== ===== Shell Modes =====
  
-It is possible to run a shell from within Emacs; there are a few different ways to do so. The easiest way is to type "M-x shell". This creates a a buffer called *shell* with a shell prompt. Shell commands you type are sent to a system shell and the output displayed in the shell buffer. One thing you'll notice in shell mode is that the arrow keys move you around the buffer - they don't access command history as they do in most shells. To access command history, use "M-pand "M-nfor previous and next, respectively.+It is possible to run a shell from within Emacs; there are a few different ways to do so. The easiest way is to type ''M-x shell''. This creates a a buffer called *shell* with a shell prompt. Shell commands you type are sent to a system shell and the output displayed in the shell buffer. One thing you'll notice in shell mode is that the arrow keys move you around the buffer - they don't access command history as they do in most shells. To access command history, use ''M-p'' and ''M-n'' for previous and next, respectively.
  
-One of the drawbacks of shell-mode is that it is not suitable for full-screen applications (like less, lynx, mutt or pine), to run these inside of Emacs, you need to use a terminal mode. Type "M-x ansi-term", and specify which shell you would like to run (your default will be the shell you are using, e.g. "/usr/pkg/bin/bash").+One of the drawbacks of shell-mode is that it is not suitable for full-screen applications (like less, lynx, mutt or pine), to run these inside of Emacs, you need to use a terminal mode. Type ''M-x ansi-term'', and specify which shell you would like to run (your default will be the shell you are using, e.g. ''/usr/pkg/bin/bash'').
  
-On platforms without an underlying shell (e.g., Windows), Emacs has a terminal emulator written entirely in Emacs Lisp. To enter it, type "M-x eshell". While not suitable for full-screen applications, it does emulate a limited subset of shell features rather nicely. In this shell mode, the arrow keys work as you would expect, and most shell builtins and shell aliases work as well. Some external commands such as grep work, although input/output redirection is not yet implemented.+On platforms without an underlying shell (e.g., Windows), Emacs has a terminal emulator written entirely in Emacs Lisp. To enter it, type ''M-x eshell''. While not suitable for full-screen applications, it does emulate a limited subset of shell features rather nicely. In this shell mode, the arrow keys work as you would expect, and most shell builtins and shell aliases work as well. Some external commands such as grep work, although input/output redirection is not yet implemented.
  
 Here are the commands we discussed above: Here are the commands we discussed above:
Line 160: Line 160:
 ===== Emacs Startup and Configuration ===== ===== Emacs Startup and Configuration =====
  
-When Emacs starts it will load a file named ".emacsin your home directory and execute the commands found in it. This file is written in Emacs Lisp, but you can use it without knowing any Lisp, by copying other people's sample files. It is mainly useful for making certain extended commands a permanent part of your Emacs experience, so you don't have to type them every time you start Emacs. In the example below, comment lines start with one or more semi-colons, so you would delete the semi-colons to enable the given feature.+When Emacs starts it will load a file named ''.emacs'' in your home directory and execute the commands found in it. This file is written in Emacs Lisp, but you can use it without knowing any Lisp, by copying other people's sample files. It is mainly useful for making certain extended commands a permanent part of your Emacs experience, so you don't have to type them every time you start Emacs. In the example below, comment lines start with one or more semi-colons, so you would delete the semi-colons to enable the given feature.
  
 <file config .emacs> <file config .emacs>
Line 204: Line 204:
 </file> </file>
  
-The above example gives you a good idea of what can be done in a ".emacsfile, for more in-depth configuration Emacs has a customization mode that can be accessed with the extended command "M-x customize". Running it will put you in a curses-style application where you can choose from customization menus and have your changes written to your ".emacsfile automatically.+The above example gives you a good idea of what can be done in a ''.emacs'' file, for more in-depth configuration Emacs has a customization mode that can be accessed with the extended command ''M-x customize''. Running it will put you in a curses-style application where you can choose from customization menus and have your changes written to your ''.emacs'' file automatically.
  
 ===== Browsing the Web in Emacs with w3m ===== ===== Browsing the Web in Emacs with w3m =====
  
-[[http://sourceforge.net/projects/w3m/files/|Emacs w3m mode]] will use the excellent [[http://w3m.sourceforge.net|w3m]] text-mode browser and allow you to surf the web in an Emacs buffer. To get started, add the following to your ".emacsfile:+[[http://sourceforge.net/projects/w3m/files/|Emacs w3m mode]] will use the excellent [[http://w3m.sourceforge.net|w3m]] text-mode browser and allow you to surf the web in an Emacs buffer. To get started, add the following to your ''.emacs'' file:
  
 <code> <code>
Line 214: Line 214:
 </code> </code>
  
-Then restart emacs, or place the cursor at the end of each line in turn and press "C-x e". Then you can open a new w3m buffer with "M-x w3m". The basic key bindings are as follows (note that these are taken from the w3m-mode help page, which can be accessed at any time in a new window with "C-h m"):+Then restart emacs, or place the cursor at the end of each line in turn and press ''C-x e''. Then you can open a new w3m buffer with ''M-x w3m''. The basic key bindings are as follows (note that these are taken from the w3m-mode help page, which can be accessed at any time in a new window with ''C-h m''):
  
 | M-x w3m | Start browsing web with emacs-w3m. | | M-x w3m | Start browsing web with emacs-w3m. |
Line 249: Line 249:
 | M-a | Add the url under point to a new bookmark. | | M-a | Add the url under point to a new bookmark. |
  
-There are many more features in w3m-mode, the mode help text details them all with keybindings. To end your session and close all w3m buffers, just press "Qand answer "ywhen prompted.+There are many more features in w3m-mode, the mode help text details them all with keybindings. To end your session and close all w3m buffers, just press ''Q'' and answer ''y'' when prompted.
  
 ===== Where to Go From Here ===== ===== Where to Go From Here =====
emacs_tutorial.1616307813.txt.gz · Last modified: 2021/03/21 06:23 by hc9