08 December 2010
To finish off the series on Emacs, this post outlines a few tips and tricks I have picked up over the years.
I do a lot of Oracle PLSQL development. Once upon a time I used TOAD as my IDE. However, once you start using Emacs and get used to it, you want to use it for everything. Enter plsql-mode. This will syntax highlight plsql, and let you compile it with C-c c. Any errors are marked and displayed in a split window, and clicking on an error jumps you to the line of code causing it (standard emacs compile-mode behaviour).
I found the default emacs Perl mode to be a bit clunky, but I cannot remember why. The improved cperl-mode is much better.
These just blew my mind. You the story:
Here are a bunch of 2000 account numbers, can you query their status on the database please?
So to do this, you can write a program that opens a file, reads it a line at a time and runs an SQL query for each one.
You could load all the accounts into a database table and join them to produce a report. To do this, for each account you need to take
and turn it into
insert into tempAccounts values ('1234567890');
Enter keyboard macros. You 'record' a series of keystrokes for one line, and then have emacs repeat it for the rest of the lines. There is more information on the emacswiki. Once you know about this tool, repetitive changes to text files becomes a breeze.
The number of times I have quit emacs by accident is just too many. I like it to prompt me and ask 'if I really want to quit':
; stops me killing emacs by accident! (setq confirm-kill-emacs 'yes-or-no-p)
Once you get used to the emacs keyboard commands, you won't have much need for the menu and tool bars. They take up valuable screen space, so I get rid of them:
; turn off the tool and menu bars (tool-bar-mode -1) (menu-bar-mode -1)
Finally, the default splash screen that appears each time emacs loads can be a bit of a pain, so to get rid of it, simply add this to .emacs:
(setq inhibit-splash-screen t)