Posts Tagged ‘database’

I’ve written a new article about how to query multiple databases using db-mode. It demonstrates quickly selecting between multiple databases using ido and you may be surprised to learn that it using a mechanism very similar to my directory aliases. This is a follow-up to my page on emacs db mode.

Why Should You Be Interested?

If you need to work with multiple databases and you like using emacs then the page is especially for you. Go take a look! It also has a good example of using the emacs mode line, in this case to display which database you are currently connected to. And finally it is another example of using ido which if you haven’t tried yet, you really should.

About The Code

The code is designed to work with my own db-mode as that is what I use but it could be easily adapted for use with sql-mode using the enter-db function from one of my earlier posts.

The preamble would be something like this:

;; ...
(let ((sql-sybase-program "/usr/bin/isql")
      (sql-server db-server)
      (sql-database db-database)
      (sql-user db-user)
      (sql-password db-password))
;; ...

Ian Eure also has a post on working with multiple databases here. It uses a new buffer for each database which is probably preferable to killing the connection.


Read Full Post »

I’ve written the third post in the comint series. Database Mode is a more traditional use of comint mode to interact with an external interpreter. Part 1 described basic use of comint with a cut-down shell mode and Part 2 was about a stock price subscriber.

There is a great tip from emacs-fu on using a custom menu to store all the tips you’ve been reading on blogs like my own.

Ben Atkin mentions a couple of things of things that I really like about emacs. First of all, he talks about the ability to see different parts of the same buffer in two frames. I use this all the time when all my constants (or whatever) are at the top of the file. Admittedly, a trick I’ve linked to before with C-x C-x to return to where you were also works nicely in this case.

And the other thing was the scratch buffer. The great thing about emacs is you can easily create another buffer with C-x b and store whatever you like in there.

There is a nice example of Kit OConnell asking the internet for help with an emacs issue. In the end it looks like it was solved in the real world by someone spotting some "smart quotes" in the .emacs. Perhaps emacs should warn about that at start-up.

There have been a few posts on whitespace recently. Matt Harrison mentions a whitespace mode that can be useful for the pythonistas that have the most trouble with inconsistent whitespace. RĂ©mi Vanicat isn’t the first person to talk about removing trailing whitespace (I linked to an even better solution in an earlier link roundup). It is nice that emacs has such a nice way of dealing with it.

Read Full Post »