MEWBIES@: Facebook Twitter G+ YouTube DeviantArt Forum Wall
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ██
█▌ - EMACS BASICS & TROUBLE SHOOTING - █▌
█▌ █▌
█ ▐▌
█ And who knew you could have so many headaches with a text editor... ▐▌
█ This is for working with Emacs in the terminal. ▐▌
█ ▐▌
█ I'm a pico/nano (Linux) and a Notepad++ (Win) user. I rarely use Emacs. ▐▌
█ I made this so I can refer back to it and maybe others that like me just ▐▌
█ need a QUICK BASIC baby help file to go with (decode) Emacs' help manual. ▐▌
█ Of course once one starts to get the hang of Emacs the help manual makes ▐▌
█ much more sense. ▐▌
█ ▐▌
█ An emacs joke I found, don't do this!: ▐▌
█ How to Use Emacs ▐▌
█ First, you need to 'remember' where emacs is, using the 'rm' (remember) ▐▌
█ command: ▐▌
█ rm -f 'which emacs' ▐▌
█ Next, you need to tell the system that you want to use emacs in 'visual' ▐▌
█ mode: ▐▌
█ alias emacs=vi ▐▌
█ Now, you're all set to use emacs! To edit a file, just type ▐▌
█ emacs filename ▐▌
█ ▐▌
█ And ▐▌
█ Emacs is a great operating system - it lacks a good editor, though. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ EMACS' USAGE PROBLEMS: ▐▌
█ BASIC EMACS KEY CODES ▐▌
█ EMACS' BACKSPACE KEY IS BROKEN ▐▌
█ HOW TO SET A REGION / SET A MARK IN EMACS ▐▌
█ HOW TO COPY PASTE WITHIN EMACS ▐▌
█ HOW TO COPY PASTE INTO EMACS FROM ANOTHER PROGRAM ▐▌
█ CHANGE EMAC'S MINIBUFFER (COMMAND LINE WINDOW) COLOR ▐▌
█ ▐▌
█ EMACS' AMUSEMENTS & GAMES ERRORS: ▐▌
█ FIX EMACS' TETRIS AND SNAKE SCORE ERROR ▐▌
█ FIX EMACS' FORTUNE ERROR ▐▌
█ FIX EMACS' YOW RETURNING ONLY ONE LINE ▐▌
█ ▐▌
█ EMAC'S ARTIST-MODE & PICTURE-MODE ▐▌
█ ENABLE DRAGGING YOUR CURSOR IN EMAC- MOUSE MODE ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ BASIC EMACS KEY CODES: ▐▌
█ `````````````````````` ▐▌
█ _________________________________________________________________ ▐▌
█ /\ \ ▐▌
█ \_| BASIC EMACS KEY CODES: | ▐▌
█ | `````````````````````` | ▐▌
█ | | ▐▌
█ | EMACS KEY CODE MEANINGS: | ▐▌
█ | C-* = Ctrl + * example: | ▐▌
█ | C-c = Ctrl + c | ▐▌
█ | C-f = Ctrl + f | ▐▌
█ | C-SPC = Ctrl = space key | ▐▌
█ | RET = Enter key | ▐▌
█ | | ▐▌
█ | Escape key is called meta key so | ▐▌
█ | M-x = Esc + x | ▐▌
█ | M-! = Esc + Shift + ! | ▐▌
█ | | ▐▌
█ | Access top menu: F10 or M-` (Esc + `) | ▐▌
█ | | ▐▌
█ | Execute a shell command: M-! | ▐▌
█ | For example: M-! ls | ▐▌
█ | | ▐▌
█ | EXIT EMACS & FILES: | ▐▌
█ | Exit Emacs: C-z | ▐▌
█ | Exit Emacs: C-x C-c | ▐▌
█ | Exit & save file with its current name: C-x C-s | ▐▌
█ | Exit & save with specified name: C-x C-w | ▐▌
█ | Save all open files: C-x s | ▐▌
█ | To view a file while in Emacs: C-x C-f | ▐▌
█ | To insert contents of a file: C-x i | ▐▌
█ | Replace file with another: C-x C-v | ▐▌
█ | Abort: C-g | ▐▌
█ | | ▐▌
█ | CUT COPY PASTE WITHIN EMACS (not from another program): | ▐▌
█ | Cut, copy to clipboard: | ▐▌
█ | Move cursor to beginning of text you | ▐▌
█ | want to kill (cut), set a mark: C-SPACE (Ctrl+Space) | ▐▌
█ | Move cursor to end of text that you | ▐▌
█ | want to cut then: C-w | ▐▌
█ | Paste: C-y (Ctrl+y = yank) | ▐▌
█ | Copy to clipboard: M-w (Esc+w) | ▐▌
█ | View 'killed' (cut): Middle mouse button | ▐▌
█ | or C-h v kill-ring | ▐▌
█ | To select from kill ring: ALT-y | ▐▌
█ | | ▐▌
█ | NAVIGATING WITHINT A FILE: | ▐▌
█ | Move back to previous paragraph: M-[ | ▐▌
█ | Move forward to next paragraph: M-] | ▐▌
█ | Move back to beginning of sentence: M-a | ▐▌
█ | Move forward to end of sentence: M-e | ▐▌
█ | Move to beginning: M-< (Esc+Shift+<) | ▐▌
█ | Move to end: M-> | ▐▌
█ | Move forward to next word: M-f (Esc+f) | ▐▌
█ | Move forward one character: C-f | ▐▌
█ | Move back to previous word: M-b | ▐▌
█ | Move back to previous character: C-f | ▐▌
█ | | ▐▌
█ | SEARCH: | ▐▌
█ | Search forward: C-s | ▐▌
█ | Search backward: C-r | ▐▌
█ | Regular expression: C-M-s | ▐▌
█ | Reverse regular expression: C-M-r | ▐▌
█ | Exit search: RET | ▐▌
█ | Cancel current search: C-g | ▐▌
█ | | ▐▌
█ | EDITING A FILE: | ▐▌
█ | Kill (cut) up to end of a word: M-d | ▐▌
█ | Kill character: C-c | ▐▌
█ | Kill forward to end of sentence: M-k | ▐▌
█ | Kill back to beginning of sentence: C-x Delete key | ▐▌
█ | Undo: C-/ & C-x u & C-_ | ▐▌
█ | Set a mark: C-SPC | ▐▌
█ | Mark paragraph: M-h | ▐▌
█ | Mark page: C-x C-p | ▐▌
█ | Mark entire buffer: C-x h | ▐▌
█ | | ▐▌
█ | SPELL CHECK: | ▐▌
█ | Check spelling current word: M-$ (Esc + Shift = $) | ▐▌
█ | select word by number | ▐▌
█ | Check spelling in region: M-x ispell-region | ▐▌
█ | Check spelling of current buffer: M-x ispell-buffer | ▐▌
█ | | ▐▌
█ | CONVERT CASE: | ▐▌
█ | Word to lower case: M-l | ▐▌
█ | Word to upper case: M-u | ▐▌
█ | Capitalize word: M-c | ▐▌
█ | Convert 'region' to lower case: C-x C-l | ▐▌
█ | Convert 'region' to upper case: C-x C-u | ▐▌
█ | | ▐▌
█ | BUFFERS: | ▐▌
█ | Create a new buffer: C-x b [name] | ▐▌
█ | Switch to a buffer: C-x 4 [name] b | ▐▌
█ | Select previous buffer: C-x [left arrow key] | ▐▌
█ | Select next buffer: C-x [right arrow key] | ▐▌
█ | Kill buffer: C-x k | ▐▌
█ | | ▐▌
█ | MULTIPLE WINDOWS: | ▐▌
█ | Delete current window: C-x 0 | ▐▌
█ | Delete other windows: C-x 1 | ▐▌
█ | Split window into two vertically: C-x 2 | ▐▌
█ | Split window into two horizontally C-x 3 | ▐▌
█ | Switch to other window: C-x o | ▐▌
█ | Window shorter: C-x ^ | ▐▌
█ | Window taller: C-x - | ▐▌
█ | Window wider: C-x " | ▐▌
█ | | ▐▌
█ | mewbies.com | ▐▌
█ | ____________________________________________________________|_ ▐▌
█ \_/______________________________________________________________/ ▐▌
█ ▐▌
█ HERE you can find a mirror of Stephen Gildea's 'GNU Emacs Reference Card' ▐▌
█ card that contains even more handy key codes. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ EMACS' BACKSPACE KEY IS BROKEN: ▐▌
█ ``````````````````````````````` ▐▌
█ I'm sure there is some magic key combination to do a BASIC thing like ▐▌
█ backspace (C-h) or even the delete key but why...I just want to use my ▐▌
█ flipping backspace key. Thankfully a little google searching did the magic ▐▌
█ (without even using a secret key combo), found HERE as well as many easy ▐▌
█ Emacs usage articles. Do this: ▐▌
█ cd ~ ▐▌
█ pico .emacs ▐▌
█ Add these lines at the end of the file (if that file doesn't exist doing ▐▌
█ this will create it): ▐▌
;; Working backspace key
(define-key global-map "\C-h" 'backward-delete-char)
█ ▐▌
█ ▐▌
█ You then might want to add for help file: ▐▌
(define-key global-map "\C-x?" 'help-command)
█ ▐▌
█ Help will now be: C-x? ▐▌
█ Restart your Emacs with a working backspace key :)). ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ HOW TO SET A REGION / SET A MARK IN EMACS: ▐▌
█ `````````````````````````````````````````` ▐▌
█ This is something like highlight but it is telling Emacs to operate some ▐▌
█ command you are going to give onto the selected region: ▐▌
█ Move your cursor to area you want to select ▐▌
█ press C-SPC (Ctrl + space aka C-@; Ctrl+Shift+@) ▐▌
█ You'll see in the mini-buffer it states Mark Activated. ▐▌
█ (Do it again will deactivate it.) ▐▌
█ Then move cursor to the end of the string that you want in the 'region'. ▐▌
█ Run your command, like M-x morse ▐▌
█ btw Ctrl+space in pico/nano moves the cursor to next word. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ HOW TO COPY PASTE WITHIN EMACS: ▐▌
█ ``````````````````````````````` ▐▌
█ To 'Yank' - Copy Cut Paste Within Emacs (not paste from another window): ▐▌
█ Cut, copy to clipboard: ▐▌
█ Move cursor to beginning of text you want to cut (kill), set a mark: ▐▌
█ C-space (Ctrl+Space) ▐▌
█ Move cursor to end of text that you want to cut then: ▐▌
█ C-w (Ctrl+w) ▐▌
█ ▐▌
█ Paste from clipboard (from a copy within Emacs only): ▐▌
█ C-y (Ctrl+y = yank) ▐▌
█ Copy to clipboard: ▐▌
█ M-w (Esc+w) ▐▌
█ ▐▌
█ To view what has been 'killed' (cut): ▐▌
█ Middle mouse button click or C-h v kill-ring ▐▌
█ To select from kill ring: Alt-y ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ HOW TO COPY PASTE INTO EMACS FROM ANOTHER PROGRAM: ▐▌
█ `````````````````````````````````````````````````` ▐▌
█ Bleepty bleep - hard to believe a BASIC function in a text editor doesn't ▐▌
█ work no matter how many clipboards (3) there are. I have not managed to ▐▌
█ have this working yet, others have managed to by using xsel with ▐▌
█ copypaste.el, Debian package info HERE, read HERE how to. Read HERE also ▐▌
█ for xsel: Can't open display: (null). ▐▌
█ ▐▌
█ My Notes: ▐▌
█ install xsel / done ▐▌
█ xauth / already have ▐▌
█ put copy.el in ~ / done ▐▌
█ add to .emacs (load "~/copypaste.el") / done ▐▌
█ add to ~/.ssh/config : / done ▐▌
█ Host * ▐▌
█ ForwardX11 yes ▐▌
█ ForwardX11Trusted yes ▐▌
█ ▐▌
█ ssh -Y ▐▌
█ ssh -X ▐▌
█ Test: xsel -o ▐▌
█ xsel: Can't open display: (null). ▐▌
█ : Success ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ CHANGE EMAC'S MINIBUFFER (COMMAND LINE WINDOW) COLOR: ▐▌
█ ````````````````````````````````````````````````````` ▐▌
█ The mini-buffer is the bottom strip of the window where you enter your ▐▌
█ text. My default mini-buffer color was dark blue against black - basically ▐▌
█ I couldn't see that there was anything going on down there; where M-x is. ▐▌
█ ▐▌
█ ▐▌
█ cd ~ ▐▌
█ pico .emacs ▐▌
█ Add these lines at the end of the file (if that file doesn't exist doing ▐▌
█ this will create it) changing the color to the one you want from the list ▐▌
█ below: ▐▌
;; Custom minibuffer style
(set-face-foreground 'minibuffer-prompt "green")
█ ▐▌
█ Colors to select from, (click HERE to view the exact color). ▐▌
█ COLOR: If BOLD is enabled the color will be (brighter): ▐▌
█ black = dark gray ▐▌
█ red = light red ▐▌
█ green = light green ▐▌
█ yellow = light yellow ▐▌
█ blue = light blue ▐▌
█ magenta = light magenta ▐▌
█ cyan = light cyan ▐▌
█ gray = white ▐▌
█ ▐▌
█ To enable bold, which make colors lighter/brighter add this line also: ▐▌
█ (set-face-attribute 'minibuffer-prompt nil :weight 'bold) ▐▌
█ You can even set the font, change default to the one wanted: ▐▌
█ (set-face-font 'minibuffer-prompt (face-font 'default)) ▐▌
█ ▐▌
█ To change emac's color theme view HERE. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ FIX EMACS' TETRIS AND SNAKE SCORE ERROR: ▐▌
█ ```````````````````````````````````````` ▐▌
█ If you received this error while playing tetris or snake: ▐▌
█ Failed to access scores file: No such file or directory ▐▌
█ To keep track of the scores we need to create the file '.emacs' in our ▐▌
█ home directory: ▐▌
█ cd ~ ▐▌
█ pico .emacs ▐▌
█ Add these lines at the end of the file (if that file doesn't exist doing ▐▌
█ this will create it): ▐▌
;; Game Scores
(setq tetris-score-file
"~/.emacs.d/tetris-scores")
(setq snake-score-file
"~/.emacs.d/snake-scores")
█ ▐▌
█ Save it and exit by pressing Ctrl+x then type in y, hit enter key. ▐▌
█ Test it by running tetris or snake again as above. ▐▌
█ Now it should state: Wrote /home/mewbies/.emacs.d/ ▐▌
█ If you would like to view your tetris scores: ▐▌
█ cat ~/.emacs.d/tetris-scores ▐▌
█ The scores are on the first left column. ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ FIX EMACS' FORTUNE ERROR: ▐▌
█ ````````````````````````` ▐▌
█ If you run M-x fortune and receive the error: ▐▌
█ Can't compile fortune file /home/user/docs/ascii/misc/fortunes/usenet ▐▌
█ We need to tell .emacs where to look for it. You can either create your ▐▌
█ own or install Fortune (in this tutorial) and then select a fortune file ▐▌
█ to read from: ▐▌
█ cd ~ ▐▌
█ pico .emacs ▐▌
█ Add these lines at the end of the file (if that file doesn't exist doing ▐▌
█ this will create it): ▐▌
;; Fortune path
(require 'fortune)
(setq fortune-dir "/usr/share/games/fortunes"
fortune-file "/usr/share/games/fortunes/fortunes")
█ ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ FIX EMACS' YOW RETURNING ONLY ONE LINE: ▐▌
█ ``````````````````````````````````````` ▐▌
█ M-x yow returns this one line only : ▐▌
█ Yow! Legally-imposed CULTURE-reduction is CABBAGE-BRAINED! ▐▌
█ This isn't an error. Since v22.1 all lines were removed due to copyright ▐▌
█ issues. ▐▌
█ So doesn't that just leave you a little bit curious what the other lines ▐▌
█ were? It does me :) So I downloaded v21.4 ▐▌
█ (ftp://ftp.gnu.org/gnu/emacs/emacs-21.4a.tar.gz), extracted the yow.lines ▐▌
█ file and put HERE: ▐▌
█ cd ~ ▐▌
█ wget http://mewbies.com/geek_fun_files/emacs/yow.lines ▐▌
█ su ▐▌
█ mv /usr/share/emacs/23.2/etc/yow.lines /usr/share/emacs/23.2/etc/yow.lines_backup
█ mv yow.lines /usr/share/emacs/23.2/etc/yow.lines ▐▌
█ exit ▐▌
█ Now you can try that again: ▐▌
█ emacs ▐▌
█ M-x yow ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ EMAC'S ARTIST-MODE & PICTURE-MODE: ▐▌
█ `````````````````````````````````` ▐▌
█ Artist-mode: create poly-line, ellipse, rectangle and even use a spray-can.▐▌
█ If you want to draw a diagram around some text make sure it has the space ▐▌
█ on the side. ▐▌
█ Open a text file in Emacs or start from scratch: ▐▌
█ emacs test.txt ▐▌
█ M-x artist-mode ▐▌
█ To select a tool, for example poly-line: ▐▌
█ C-c C-a p ▐▌
█ Or hold middle mouse button down for the menu ▐▌
█ Or M-x artist-mode TAB key ▐▌
█ ▐▌
█ You can drag your cursor and release to use the tools as well IF your ▐▌
█ mouse-mode is enabled. ▐▌
█ ▐▌
█ If during using one of the modes you receive the error: ▐▌
█ "Can not switch to a different shape while drawing" ▐▌
█ Press your enter key then try again - ▐▌
█ If the the blue strip that goes across the window has * in its tool path ▐▌
█ it won't work, for example: ▐▌
█ F1 filename All L40 (Picture:left Artist/vaporize-1/*) ▐▌
█ ^ ▐▌
█ To remove tabs: M-x untabify ▐▌
█ ▐▌
█ M-x artist-mode-off or C-c C-c to return to normal editing ▐▌
█ ▐▌
█ M-x picture-mode lets you type in a selected continuous direction - ▐▌
█ up-north, down-south, left-west, etc... View my chart below for a visual ▐▌
█ of which keys to use to select the direction. ▐▌
█ ▐▌
█ For example to type in the direction of North-East - C-c ' (Ctrl+c then '):▐▌
█ ▐▌
█ +-----------------------------------------------+ ▐▌
█ | Emacs M-x picture-mode Typing Direction | ▐▌
█ | C-c (Ctrl+c) Then Key Shown | ▐▌
█ | | ▐▌
█ | N | ▐▌
█ | up | ▐▌
█ | NW ` /|\ NE ' | ▐▌
█ | \ | / | ▐▌
█ | \ | / | ▐▌
█ | \ | / | ▐▌
█ | \ | / | ▐▌
█ | W<- - - - - - -o- - - - - - ->E | ▐▌
█ | / | \ | ▐▌
█ | / | \ | ▐▌
█ | / | \ | ▐▌
█ | / | \ | ▐▌
█ | SW / \|/ SE \ | ▐▌
█ | down | ▐▌
█ | S | ▐▌
█ | | ▐▌
█ | ___________________________________________ | ▐▌
█ | | | | ▐▌
█ | | NW ` N [up] NE ' | | ▐▌
█ | | W [left] E [right] | | ▐▌
█ | | SW / S [down] SE \ | | ▐▌
█ | .___________________________________________. | ▐▌
█ | | ▐▌
█ | mewbies.com | ▐▌
█ +-----------------------------------------------+ ▐▌
█ ▐▌
█ ___________..___________ ▐▌
█ ▐▌
█ ENABLE DRAGGING YOUR CURSOR IN EMAC- MOUSE MODE: ▐▌
█ ```````````````````````````````````````````````` ▐▌
█ This is very useful when in artist-mode - ability to drag your cursor, ▐▌
█ release then it creates the shape determined by your tool selection. To do ▐▌
█ this: ▐▌
█ M-x xterm-mouse-mode ▐▌
█ Repeating the command turns the mode off ▐▌
█ ▐▌
█ To make this setting permanent: ▐▌
█ cd ~ ▐▌
█ pico .emacs ▐▌
█ Add these lines at the end of the file (if that file doesn't exist doing ▐▌
█ this will create it): ▐▌
;; mouse-mode on
(xterm-mouse-mode 1)
xterm-mouse-mode
█ ▐▌
█ //---------------------------------------------------------------------- ▐▌
█ ▐▌
█ If you find mistakes, have suggestions, and or questions please post at ▐▌
█ mewbies forum HERE - thank you. ▐▌
█ ▐▌
█ Last update on 06 May '13 ▐▌
█ ▐▌
█▌ █▌
█▌ - mewbies.com - █▌
█▌ █▌
██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██