Emacs as Your Own IDE

with emacs, you pretty much develop your own IDE, especially if you do elisp. After a few years in your coding career, you'll have a IDE of your own that's far better than any.

the downside is that you have to learn elisp. But gradually, like a couple hours a week. You'll do that anyway if you love coding. Without emacs, programers usually accumulate a bunch of shell scripts over the years, or in python, perl, scsh. But with elisp, it's integrated in the editor!

Elisp: Getting Current Buffer Path

In your elisp program, you may call (buffer-file-name) to get the full path of the file, but sometimes the current buffer isn't associated with a file, so your program will fail.

Here's a idiom: (or (buffer-file-name) default-directory). This way, if the buffer isn't a file, it'll return the directory path of the buffer. (when a buffer is created, its “default-directory” is typically the same as previous buffer. In the case of temp buffers created by emacs such as {*info*, *scratch*, *Bookmark List*, …}, it's usually home dir.)

Emacs: Ways to Jump to Points

when coding, there's a common need to jump to a particular place, then return to previous position.

There are several ways. Most common standard methods are:

exchange-point-and-mark 【Ctrl+xCtrl+x】.

【Ctrl+uCtrl+Space】

I've tried all ways in past years, including custom elisp that push/pop marks. But i found split windows to be the best.

Split window, then go to where you wanna be, when done, unsplit. Give split/unsplit a easy key. [see Emacs: How to Define Keys] For example, in ErgoEmacs, it's:

【Alt+3】 delete-other-windows

【Alt+4】 split-window-vertically

【Alt+0】 delete-window

【Alt+s】 other-window

On a different note, here's a nice tip when using mouse (thx to Ken Goldman):

Middle mouse button on a status bar expands current pane.

Right mouse button on a status bar closes current pane.

2012-07-06

Elisp: Adding Your Package to MELPA

Emacs 24's package system is hot. It spreads a few hundred packages to every emacs user. (In GNU emacs, 41 packages (not counting built-in ones). With MELPA, 307 packages.) Before this, it takes years of emacs experience to know what packages are out there that are actually usable.

So, if you have written a package, putting it into a package repository would greatly increase your user base. I haven't done it yet myself, but here's a summary from
Jon-Michael Deldin.