Being Productive With Emacs
Part 1
Phil Sung
sipb-iap-emacs@mit.edu http://stuff.mit.edu/iap/emacs
Special thanks to Piaw Na and Arthur Gleckler
Being Productive With Emacs Part 1 Phil Sung - - PowerPoint PPT Presentation
Being Productive With Emacs Part 1 Phil Sung sipb-iap-emacs@mit.edu http://stuff.mit.edu/iap/emacs Special thanks to Piaw Na and Arthur Gleckler Emacs is the extensible, customizable, self-documenting real-time display editor. The many
Special thanks to Piaw Na and Arthur Gleckler
M-x hexl-find-file M-x hexl-find-file
M-x ediff-buffers M-x ediff-buffers
M-x dired M-x dired
M-x shell M-x shell
M-x gnus M-x gnus
M-x tetris M-x tetris
Provides an integrated environment
Easy to extend
Portable
Today's goal: get the flavor of Emacs
Later...
Examples based on GNU Emacs 22
Emacs basic concepts
Keyboard commands
Basic tasks
Text in files
Text outside of files
Text as a metaphor
M-x wdired-change-to-wdired-mode after opening any directory
By character or line
Beginning, end of line
By word
By sentence
By screen
Beginning, end of
Go to line #
Move multiple lines forward, backward
Search for text
Exchange point (cursor) and mark
Kill line
Kill many lines
Kill region
Save without killing
Kill sentence
Kill ("zap") to next
Yank
Yank earlier killed text
The kill ring
When you...
the mark is set to...
Remembers a previous cursor position
The mark ring
Mark and point are also used to delineate 'the
Undo previous actions
Undo within current region
These states are accessible with 'undo'
These states are accessible with 'undo' These states are accessible with 'redo'
These states are accessible with 'undo' These states are no longer accessible!
The list of states is 'folded' so that all previous actions, including undos, are undoable
Search for text (like Firefox's "find as you type")
C-s again to find next occurrence RET to stop at found occurrence C-g to cancel and go back to start of search
Search for previously searched string
Browse and edit previous queries
Search for regular expressions
Emacs REs are a superset of Perl REs
Search and replace, asking for confirmation
Display all lines matching RE
M-x replace-regexp Replacement text can depend on found text! Replacement text gets these substitutions:
More tips at http://steve-yegge.blogspot.com/2006/06/shiny-and-new-emacs-22.html
Shell
Compile (invoke make)
Debug
Grep
Man page reader
Invoke shell commands
Calculator
Calendar
Moon calendar
TRAMP: open remote files over SSH
VC: automatically deal with CVS, SVN, etc.
etags: name search/completion for source code
Use a single Emacs session for all editing Do this once: M-x server-start
To edit a file:
Remembers a fixed sequence of keys for later
Start recording macro: C-x ( Stop recording macro: C-x ) Replay macro: C-x e
"Remove first word and space, uppercase next word, insert comma and space afterward, reinsert first word, move to beginning of next line"
Restricts view/editing in a buffer to a certain
Store current window configuration
Restore window configuration
Registers can also store positions, text,
REGISTER may be any letter or number
Sometimes used to indicate repetition
Sometimes modify following command
A command's documentation (C-h f or C-h k)
Alters behavior, key bindings, and text display Switch mode in existing buffer:
Or, use another command to create buffer:
Language-specific indentation, syntax coloring Language-specific features:
Extra functionality you can turn on or off
M-x auto-fill-mode M-x flyspell-mode M-x follow-mode
Offer completions for buffers, commands, etc.
Show all buffer names on C-x b:
Common features whenever Emacs prompts
M-x eval-expression, M-x find-
Help with key
Help with function
Help with mode
Show key bindings
Help about help
Apropos (search for command)
Help with prefix key
Manuals
Cancel command
Undo!
What did I just do?
Delete not deleting?
Keys with M- not working?
From Windows applications
From vi/vim
Emacs on Athena
Emacs reference card
emacs21 on Athena: athena% emacs emacs22 on Ubuntu/Debian:
emacs22 on Gentoo: emerge emacs-cvs emacs on Windows:
Bonus: Being Unproductive With Emacs
Next time: Emacs lisp