Emacs Tutorial Series - episode 3
Emacs builtin features
Ido
Ido let you manage buffers conveniently:
shortcut | effect |
C-x b | quickly switch buffer |
C-x C-b | display all currently open buffers |
C-x C-f | find a file |
Dired
That’s emacs file manager (dired stands for Directory Editor):
- rename a file:
R
- copy a file:
C
- delete a file:
D
(pressx
to execute oru
to unmark) - create a directory:
M-x create-directory
a real terminal in emacs
M-x ansi-term
Once you get this, you can literally stay in emacs for most of your needs.
Tips:
On window, I just couldn’t make it work correctly. If you’re force to use window or worse if you like it ‘M-x shell
’ is your friend.
Browse the web with EWW
eww let you browse the web directly from emacs: ‘M-x eww
’. Yes it’s not as fancy as other browsers but still it does the job to lookup for some information:
Tips:
If you want to get in some fun stuff, it seems the latest version of emacs ships with a webkit based browser. To enable it, you need to compile emacs by yourself using the with-xwidgets
flag.
SQL client
Emacs can be use as an sql client for your database. It supports many type of database including: mysql, postgres, oracle and many others. Example for postgres: ‘M-x sql-postgres
’
Record and replay a serie of keyboard inputs in batch
KBD macros is like having a keylogger recording what you are typing and being able to replay what you were doing in one shot.
Shortcut | What it does |
C-x ( | Start recording |
C-x ) | Stop recording |
C-x C-e | Replay the last record |
C-u 100 C-x C-e | Replay the last recording 100 times |
Macro is a great help when you need to reformat a piece of text. To give a concrete example, here is a demonstration to transform a copy and paste from a search in google to csv:
Artist mode
Artist mode is like Microsoft Paint but for drawing in ascii: ‘M-x artist-mode
’. It won’t replace a proper drawing tool but if you’re too lazy to install one, then artist mode is your friend.
I already used it to draw UMLish diagrams and other things like wireframing but no it won’t replace any dedicated tool.
IRC
Emacs has builtin support for IRC with ‘M-x erc
’
Lisp
Probably the coolest features. Emacs has full support for a lisp dialect called elisp. You can basically execute elisp code directly within emacs without needing anything else.
For example, from a buffer you can type a expression like this one: (+ 1 2)
and evaluate it with ‘C-x C-e
’
Improbable builtin apps
- Wanna play tetris within emacs? ‘
M-x tetrix
’ - Emacs psychotherapist? ‘
M-x doctor
’
What next?
The next episode will be about installing plugins