190 likes | 357 Views
EMACS. Jim Vallino Proud emacs user since 1979. The truth about editors. Editors are like religions. Everyone has one that they like. What does emacs stand for?. Editor MACroS Eight Megs And Constantly Swapping EMACS Makes A Computer Slow EMACS Makes All Computing Simple
E N D
EMACS Jim Vallino Proud emacs user since 1979
The truth about editors • Editors are like religions. Everyone has one that they like.
What does emacs stand for? • Editor MACroS • Eight Megs And Constantly Swapping • EMACS Makes A Computer Slow • EMACS Makes All Computing Simple • EMACS May Allow Customized Screwups • Escape Meta Alt Control Shift • Eventually Malloc()s All Computer Storage • Extensible Macro System
How long has emacs been around? • Many variants have been developed • I first used it at Bell Labs in 1979 • Current favorites • GNU Emacs • XEmacs
How do you use emacs? • Start it and use it • Current versions have menu interface so you do not have to remember lots of (any?) key sequences • Ctrl-G terminates any command • You will quickly customize it to your liking
Customizing emacs • Under the hood emacs is run by elisp • Standard emacs library has elisp code to do just about everything • Including vip-mode for the “must have vi” crowd • ~/.emacs executed on startup to configure editor to your liking • Hack your way into a stupor writing elisp functions
Can you do X in emacs? • Yes! • You may have to write some elisp code to get it to work though.
Typical things done in .emacs • Fix braindead defaults for Ctrl-H and delete(global-set-key "\C-h" 'delete-backward-char)(global-set-key [delete] 'delete-char)(global-set-key "\M-h" 'help-command) • Set path to personal elisp library(defvar emacslib (expand-file-name "~/lib/emacs") • Set screen colors(set-background-color "black")(set-foreground-color "white")(set-cursor-color "white") • Trigger modes(setq auto-mode-alist (cons '("\\.txt\\'" . indented-text-mode) auto-mode-alist))
More in .emacs • Load your personal keybindings • Custom-set-variables controlled from within emacs
Searching • Standard • Incremental • Regular expression
Emacs modes • Always editing in some “mode” • Mode usually based on file extension • Can set manually • Force in file: -*- Perl -*- • Name your favorite language there’s probably a mode for it
What do you get with a mode? • Set of local key bindings • Some come transparently like auto indent • Templates • Syntax sensitive indenting • Abbreviations • Compilation commands • Hook function to run when mode is loaded • Customizing a mode
Version control • RCS and CVS builtin • Register file initially • Check in/out • Add revision coments • Compare revisions
Help system • Ctrl-H is default keybinding • Operation available • a – apropos • b – key bindings • c, k – describe key sequence • f – describe function • i – info command • m – describe mode • v – describe variable • w – where is command bound
Emacs terms • Buffer – holds a file being edited; may or may not be visible • Window – a display region for a file • Frame – an Emacs “window” managed by the local windowing toolkit; may contain multiple windows • Multiple frames are allowed • Mark – a remembered hidden location • Point – current location of cursor
Miscellaneous modes • Directory • Shell • Vip • If you can’t live without vi you can live with emacs with vip-mode • Full functionality of vi and ex
What good is vi? • It’s available on every Unix system. • It starts in an instant
What’s the difference between emacs and vi? • The difference between emacs and vi is like the difference between making love and masturbation. That is to say: vi will always be there when you need it.-- signature for Patrick Dockhorn, patsch@ubka.uni-karlsruhe.de