tags:

views:

174

answers:

1

I started using sqlplus for emacs. It works fine except one thing - very often I get a message "Buffer ... is not talking to anybody". In a file sqlplus.el there is the following code which verifies (get-buffer-process process-buffer-name). How can I keep alive the sql process?

(defun sqlplus-verify-buffer (connect-string)
  (let ((output-buffer-name (sqlplus-get-output-buffer-name connect-string))
    (process-buffer-name (sqlplus-get-process-buffer-name connect-string)))
    (when (not (get-buffer process-buffer-name))
      (sqlplus-shutdown connect-string)
      (error "No SQL*Plus session!  Use 'M-x sqlplus' to start the SQL*Plus interpreter"))
    (unless (get-buffer-process process-buffer-name)
      (sqlplus-shutdown connect-string)
      (error "Buffer '%s' is not talking to anybody!" output-buffer-name)))
  t)
A: 

One possible solution is the following

(defadvice sqlplus-verify-buffer (before sqlplus-verify-buffer-and-reconnect activate)
  (unless (get-buffer-process (sqlplus-get-process-buffer-name connect-string))
    (sqlplus connect-string)))
Oleg Pavliv