Posts Tagged ‘database mode’

or is the documentation to blame?

From time to time I have a little niggle with emacs or need a new feature. As I know a bit of elisp it is all too tempting to jump in and code up a solution rather than investigate whether someone else has already solved it.

A case in point would be my database mode. Ian Eure pointed out that there is a way to get sql-mode (a core module) to do something similar to what I wanted.

(defun enter-db ()
  (let ((sql-sybase-program "/usr/bin/isql")
        (sql-server "DB_SERVER")
        (sql-database "DB_DATABASE")
        (sql-user "USER")
        (sql-password "PASSWORD")
        (sql-sybase-options '()))
    (other-window -1)
    (switch-to-buffer "*sql*" t)

And there are modules that provide similar functionality to my directory aliases although I am extremely pleased I wrote it. I use it many times every day and I love it.

In fact, often when I publish a piece of elisp I have written, people point out that it has already been done. Another example would be when Peter Jones pointed out a much easier way of implementing emacs muse aliases.

So what is the answer? Hang out on #emacs? Improve my google-fu so I can find pre-existing solutions? Or some kind of central documentation / module repository. Yes, the wiki is great but it isn’t comprehensive. It didn’t mention the alternative to database mode until I added it.

Central Documentation / Module Repository

I often think that emacs would make a nice alternative to Visual Basic for creating quick interactive applications if only there was a decent API reference.

I’m not saying CPAN (if you listen carefully, you can hear me very clearly not saying CPAN) but some sort of centralised repository would be nice. However, I suspect the emacs lisp writing part of the community is [far] to small to generate or support the required infrastructure. Yes, I know about ELPA, but when I checked it didn’t have more than half my third-party packages (including org-mode, htmlize and tuareg)

My Solution

No, I think that the best solution is to keep publishing my code and wait for my readers to tell me about the right way to do things. What do you think?


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 »