Forum OpenACS Q&A: Re: psql and emacs

19: Re: psql and emacs (response to 18)
Posted by Bart Teeuwisse on
Another option is to apply the following patch to emacs/21.2/lisp/progmodes/sql.el so that Emacs will always ask for a username regardless of environment variables. It has served me well.

<    (sql-get-login 'database 'server)
<blockquote>    (sql-get-login 'user 'database 'server)
<blockquote>      (if (not (string= "" sql-user))
      (setq params (append (list "-U" sql-user) params)))

Don't forget to byte compile sql.el afterwards or Emacs will continue to use the old sql.elc without the patch.


20: Re: psql and emacs (response to 19)
Posted by Mark Aufflick on
To save people wasting the time i just wasted, if you're using emacs 21.3 you can do just about the same thing as Bart describes with the following points:

* I applied the patch by hand, but I think the lines in the 21.2 patch above is off by 1 - but get to line 1683 and it's around there somewhere
* it only worked for me if the sql-get-login used this specific order:

(sql-get-login 'database 'user 'server)

If I put the 'user anywhere else it ignored it :/

Also, sql-get-login will automatically ask for password when it asks for user - if you are not using passwords just leave it blank and hit enter.

PS: Bart you'll be pleased to know that I got to this thread from the first page of a google search - it's cool because I'm working at a non-oacs client, and I didn't even notice that I was on until I saw /Bart :)

I'll be signing off /Mark soon, thus completing all our conversions into Lars-borgs :P