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
Next revisionBoth sides next revision
emacs_tutorial [2021/03/21 06:18] – [Emacs Modes] hc9emacs_tutorial [2021/03/21 06:24] – [Dired Mode] hc9
Line 103: Line 103:
 ===== Buffers ===== ===== Buffers =====
  
-When you visit a file with "C-x C-f", Emacs loads the file into a new buffer created just for that file. Existing buffers are not destroyed, but persist and can be switched to with "C-x b". Emacs will prompt you for a buffer name to switch to; tab-completion works here as it does in other places. One tip that I wish I had known when I first started using Emacs is to use a special mode called //iswitch mode// to help manage buffers. Since it's not uncommon to have dozens of buffers in an Emacs editing session, you can easily forget buffer names. With iswitch mode enabled, a "C-x bdisplays a list of buffers in the echo area that changes in real-time as you type characters. You don't even have to type the first few letters of a buffer name, any substring of a buffer name will do. To enable iswitch mode, type the extended command "M-x iswitchb-mode(we'll see later how to permanently enable modes like this in a startup file). To see a list of all buffers, type "C-x C-b". The buffer list will appear in a new window. Here is a list of some useful buffer commands:+When you visit a file with ''C-x C-f'', Emacs loads the file into a new buffer created just for that file. Existing buffers are not destroyed, but persist and can be switched to with ''C-x b''. Emacs will prompt you for a buffer name to switch to; tab-completion works here as it does in other places. One tip that I wish I had known when I first started using Emacs is to use a special mode called //iswitch mode// to help manage buffers. Since it's not uncommon to have dozens of buffers in an Emacs editing session, you can easily forget buffer names. With iswitch mode enabled, a ''C-x b'' displays a list of buffers in the echo area that changes in real-time as you type characters. You don't even have to type the first few letters of a buffer name, any substring of a buffer name will do. To enable iswitch mode, type the extended command ''M-x iswitchb-mode'' (we'll see later how to permanently enable modes like this in a startup file). To see a list of all buffers, type ''C-x C-b''. The buffer list will appear in a new window. Here is a list of some useful buffer commands:
  
 | C-x b | Switch to another buffer | | C-x b | Switch to another buffer |
Line 112: Line 112:
 ===== Windows ===== ===== Windows =====
  
-The Emacs screen area can be divided into multiple //windows//. Each window contains one buffer, so the contents of a window can change depending on the buffer it contains. The most common way to create new windows is to split the screen into two regions with "C-x 2or "C-x 3". The first splits the screen in half horizontally, the second splits it vertically. Any Emacs window can be split multiple times, so if you have a large display, you could have lots of windows open. You can cycle through visible windows with "C-x o(think of the "o" as meaning "other window"). When you do have another window open, it's sometimes useful to scroll the other window without leaving your current one. You can do this with "C-M-v". This is particularly useful for when Emacs pops up a completion or help buffer in a new window that you would like to scroll through.+The Emacs screen area can be divided into multiple //windows//. Each window contains one buffer, so the contents of a window can change depending on the buffer it contains. The most common way to create new windows is to split the screen into two regions with ''C-x 2'' or ''C-x 3''. The first splits the screen in half horizontally, the second splits it vertically. Any Emacs window can be split multiple times, so if you have a large display, you could have lots of windows open. You can cycle through visible windows with ''C-x o'' (think of the "o" as meaning "other window"). When you do have another window open, it's sometimes useful to scroll the other window without leaving your current one. You can do this with ''C-M-v''. This is particularly useful for when Emacs pops up a completion or help buffer in a new window that you would like to scroll through.
  
-You can close a window with "C-x 0or "C-x 1". The first closes the window you are currently in, the second closes all the other windows, but leaves the window you are currently in open for you. Closing a window does not destroy the buffer it contains, so you can think of a window as a view into a buffer (in fact you can have multiple windows visiting different parts of the same buffer). Here is a list of the most useful window commands:+You can close a window with ''C-x 0'' or ''C-x 1''. The first closes the window you are currently in, the second closes all the other windows, but leaves the window you are currently in open for you. Closing a window does not destroy the buffer it contains, so you can think of a window as a view into a buffer (in fact you can have multiple windows visiting different parts of the same buffer). Here is a list of the most useful window commands:
  
 | C-x 0 | Close this window | | C-x 0 | Close this window |
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 |
emacs_tutorial.txt · Last modified: 2021/03/21 06:38 by hc9