Commit 801d1cb0 authored by Alex Schroeder's avatar Alex Schroeder
Browse files

(sql-imenu-generic-expression): new, used to set

imenu-generic-expression.

(sql-mode): Use ?_ and ?. instead of 95 and 46 when setting
font-lock-defaults' SYNTAX-ALIST.  Set imenu-generic-expression,
imenu-case-fold-search, and imenu-syntax-alist.

(sql-interactive-mode): Use ?_ and ?. instead of 95 and 46 when
setting font-lock-defaults' SYNTAX-ALIST.
parent 76d4fa66
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
;; Author: Alex Schroeder <alex@gnu.org> ;; Author: Alex Schroeder <alex@gnu.org>
;; Maintainer: Alex Schroeder <alex@gnu.org> ;; Maintainer: Alex Schroeder <alex@gnu.org>
;; Version: 1.4.7 ;; Version: 1.4.9
;; Keywords: comm languages processes ;; Keywords: comm languages processes
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
;;; Commentary: ;;; Commentary:
;; Please send bug reports and bug fixes to the mailing list at ;; Please send bug reports and bug fixes to the mailing list at
;; sql.el@gnu.org. If you want to subscribe to the mailing list, send ;; sql.el@gnu.org. If you want to subscribe to the mailing list, send
;; mail to sql.el-request@gnu.org with 'subscribe sql.el FIRSTNAME ;; mail to sql.el-request@gnu.org with `subscribe sql.el FIRSTNAME
;; LASTNAME' in the mail body. ;; LASTNAME' in the mail body.
;; You can get the latest version of this file from my homepage ;; You can get the latest version of this file from my homepage
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
;; interactive mode had to provide a command-line history; the other ;; interactive mode had to provide a command-line history; the other
;; mode had to provide "send region/buffer to SQL interpreter" ;; mode had to provide "send region/buffer to SQL interpreter"
;; functions. "simple" in this context means easy to use, easy to ;; functions. "simple" in this context means easy to use, easy to
;; maintain and little or no bells and whistles. ;; maintain and little or no bells and whistles.
;; If anybody feels like extending this sql mode, take a look at the ;; If anybody feels like extending this sql mode, take a look at the
;; above mentioned modes and write a sqlx-mode on top of this one. If ;; above mentioned modes and write a sqlx-mode on top of this one. If
...@@ -69,7 +69,8 @@ ...@@ -69,7 +69,8 @@
;; For documentation on the functionality provided by comint mode, and ;; For documentation on the functionality provided by comint mode, and
;; the hooks available for customising it, see the file `comint.el'. ;; the hooks available for customising it, see the file `comint.el'.
;; Hint for newbies: take a look at `dabbrev-expand' and `abbrev-mode'. ;; Hint for newbies: take a look at `dabbrev-expand', `abbrev-mode', and
;; `imenu-add-menubar-index'.
;;; Requirements for Emacs 19.34: ;;; Requirements for Emacs 19.34:
...@@ -105,6 +106,7 @@ ...@@ -105,6 +106,7 @@
;; Yair Friedman <yfriedma@JohnBryce.Co.Il> ;; Yair Friedman <yfriedma@JohnBryce.Co.Il>
;; Gregor Zych <zych@pool.informatik.rwth-aachen.de> ;; Gregor Zych <zych@pool.informatik.rwth-aachen.de>
;; nino <nino@inform.dk> ;; nino <nino@inform.dk>
;; Berend de Boer <berend@pobox.com>
...@@ -147,6 +149,8 @@ Customizing your password will store it in your ~/.emacs file." ...@@ -147,6 +149,8 @@ Customizing your password will store it in your ~/.emacs file."
:type 'string :type 'string
:group 'SQL) :group 'SQL)
;; misc customization of sql.el behaviour
(defcustom sql-pop-to-buffer-after-send-region nil (defcustom sql-pop-to-buffer-after-send-region nil
"*If t, pop to the buffer SQL statements are sent to. "*If t, pop to the buffer SQL statements are sent to.
...@@ -158,6 +162,17 @@ buffer is shown using `display-buffer'." ...@@ -158,6 +162,17 @@ buffer is shown using `display-buffer'."
:type 'boolean :type 'boolean
:group 'SQL) :group 'SQL)
;; imenu support for sql-mode.
(defvar sql-imenu-generic-expression
'(("Tables" "^\\s-*create\\s-+table\\s-+\\(\\w+\\)" 1)
("Indexes" "^\\s-*create\\s-+index\\s-+\\(\\w+\\)" 1))
"Define interesting points in the SQL buffer for `imenu'.
This is used to rebind `imenu-generic-expression'.")
;; history file
(defcustom sql-input-ring-file-name nil (defcustom sql-input-ring-file-name nil
"*If non-nil, name of the file to read/write input history. "*If non-nil, name of the file to read/write input history.
...@@ -252,7 +267,7 @@ The program can also specify a TCP connection. See `make-comint'." ...@@ -252,7 +267,7 @@ The program can also specify a TCP connection. See `make-comint'."
;; Customisation for SyBase ;; Customisation for SyBase
(defcustom sql-sybase-program "isql" (defcustom sql-sybase-program "isql"
"*Command to start isql by SyBase. "*Command to start isql by SyBase.
Starts `sql-interactive-mode' after doing some setup. Starts `sql-interactive-mode' after doing some setup.
...@@ -263,7 +278,7 @@ The program can also specify a TCP connection. See `make-comint'." ...@@ -263,7 +278,7 @@ The program can also specify a TCP connection. See `make-comint'."
;; Customisation for Informix ;; Customisation for Informix
(defcustom sql-informix-program "dbaccess" (defcustom sql-informix-program "dbaccess"
"*Command to start dbaccess by Informix. "*Command to start dbaccess by Informix.
Starts `sql-interactive-mode' after doing some setup. Starts `sql-interactive-mode' after doing some setup.
...@@ -274,7 +289,7 @@ The program can also specify a TCP connection. See `make-comint'." ...@@ -274,7 +289,7 @@ The program can also specify a TCP connection. See `make-comint'."
;; Customisation for Ingres ;; Customisation for Ingres
(defcustom sql-ingres-program "sql" (defcustom sql-ingres-program "sql"
"*Command to start sql by Ingres. "*Command to start sql by Ingres.
Starts `sql-interactive-mode' after doing some setup. Starts `sql-interactive-mode' after doing some setup.
...@@ -285,7 +300,7 @@ The program can also specify a TCP connection. See `make-comint'." ...@@ -285,7 +300,7 @@ The program can also specify a TCP connection. See `make-comint'."
;; Customisation for Microsoft ;; Customisation for Microsoft
(defcustom sql-ms-program "isql" (defcustom sql-ms-program "isql"
"*Command to start isql by Microsoft. "*Command to start isql by Microsoft.
Starts `sql-interactive-mode' after doing some setup. Starts `sql-interactive-mode' after doing some setup.
...@@ -296,7 +311,7 @@ The program can also specify a TCP connection. See `make-comint'." ...@@ -296,7 +311,7 @@ The program can also specify a TCP connection. See `make-comint'."
;; Customisation for Postgres ;; Customisation for Postgres
(defcustom sql-postgres-program "psql" (defcustom sql-postgres-program "psql"
"Command to start psql by Postgres. "Command to start psql by Postgres.
Starts `sql-interactive-mode' after doing some setup. Starts `sql-interactive-mode' after doing some setup.
...@@ -346,7 +361,7 @@ Used by `sql-rename-buffer'.") ...@@ -346,7 +361,7 @@ Used by `sql-rename-buffer'.")
;; Keymap for sql-interactive-mode, based on comint-mode-map. ;; Keymap for sql-interactive-mode, based on comint-mode-map.
(if (not (string-match "XEmacs\\|Lucid" emacs-version)) (if (not (string-match "XEmacs\\|Lucid" emacs-version))
(defvar sql-interactive-mode-map (defvar sql-interactive-mode-map
(let ((map (nconc (make-sparse-keymap) comint-mode-map))) (let ((map (nconc (make-sparse-keymap) comint-mode-map)))
(define-key map "\C-j" 'sql-accumulate-and-indent) (define-key map "\C-j" 'sql-accumulate-and-indent)
(define-key map "\C-c\C-w" 'sql-copy-column) (define-key map "\C-c\C-w" 'sql-copy-column)
...@@ -375,27 +390,27 @@ Used by `sql-rename-buffer'.") ...@@ -375,27 +390,27 @@ Used by `sql-rename-buffer'.")
;; easy menu for sql-mode. ;; easy menu for sql-mode.
(easy-menu-define (easy-menu-define
sql-mode-menu sql-mode-map sql-mode-menu sql-mode-map
"Menu for `sql-mode'." "Menu for `sql-mode'."
'("SQL" '("SQL"
["Send Paragraph" sql-send-paragraph (and (buffer-live-p sql-buffer) ["Send Paragraph" sql-send-paragraph (and (buffer-live-p sql-buffer)
(get-buffer-process sql-buffer))] (get-buffer-process sql-buffer))]
["Send Region" sql-send-region (and mark-active ["Send Region" sql-send-region (and mark-active
(buffer-live-p sql-buffer) (buffer-live-p sql-buffer)
(get-buffer-process sql-buffer))] (get-buffer-process sql-buffer))]
["Send Buffer" sql-send-buffer (and (buffer-live-p sql-buffer) ["Send Buffer" sql-send-buffer (and (buffer-live-p sql-buffer)
(get-buffer-process sql-buffer))] (get-buffer-process sql-buffer))]
["Show SQLi buffer" sql-show-sqli-buffer t] ["Show SQLi buffer" sql-show-sqli-buffer t]
["Set SQLi buffer" sql-set-sqli-buffer t] ["Set SQLi buffer" sql-set-sqli-buffer t]
["Pop to SQLi buffer after send" ["Pop to SQLi buffer after send"
sql-toggle-pop-to-buffer-after-send-region sql-toggle-pop-to-buffer-after-send-region
:style toggle :style toggle
:selected sql-pop-to-buffer-after-send-region])) :selected sql-pop-to-buffer-after-send-region]))
;; easy menu for sql-interactive-mode. ;; easy menu for sql-interactive-mode.
(easy-menu-define (easy-menu-define
sql-interactive-mode-menu sql-interactive-mode-map sql-interactive-mode-menu sql-interactive-mode-map
"Menu for `sql-interactive-mode'." "Menu for `sql-interactive-mode'."
'("SQL" '("SQL"
...@@ -417,7 +432,7 @@ Used by `sql-rename-buffer'.") ...@@ -417,7 +432,7 @@ Used by `sql-rename-buffer'.")
;; Syntax Table ;; Syntax Table
(defvar sql-mode-syntax-table (defvar sql-mode-syntax-table
(let ((table (make-syntax-table))) (let ((table (make-syntax-table)))
;; C-style comments /**/ (see elisp manual "Syntax Flags")) ;; C-style comments /**/ (see elisp manual "Syntax Flags"))
(modify-syntax-entry ?/ ". 14" table) (modify-syntax-entry ?/ ". 14" table)
...@@ -451,7 +466,7 @@ add functions and PL/SQL keywords.") ...@@ -451,7 +466,7 @@ add functions and PL/SQL keywords.")
(regexp-opt '( (regexp-opt '(
"authorization" "avg" "begin" "close" "cobol" "commit" "authorization" "avg" "begin" "close" "cobol" "commit"
"continue" "count" "declare" "double" "end" "escape" "continue" "count" "declare" "double" "end" "escape"
"exec" "fetch" "foreign" "fortran" "found" "go" "goto" "indicator" "exec" "fetch" "foreign" "fortran" "found" "go" "goto" "indicator"
"key" "language" "max" "min" "module" "numeric" "open" "pascal" "pli" "key" "language" "max" "min" "module" "numeric" "open" "pascal" "pli"
"precision" "primary" "procedure" "references" "rollback" "precision" "primary" "procedure" "references" "rollback"
"schema" "section" "some" "sqlcode" "sqlerror" "sum" "work") t) "\\b"))) "schema" "section" "some" "sqlcode" "sqlerror" "sum" "work") t) "\\b")))
...@@ -467,8 +482,8 @@ add functions and PL/SQL keywords.") ...@@ -467,8 +482,8 @@ add functions and PL/SQL keywords.")
(ansi-types (eval-when-compile (ansi-types (eval-when-compile
(concat "\\b" (concat "\\b"
(regexp-opt '( (regexp-opt '(
;; ANSI Keywords that look like types ;; ANSI Keywords that look like types
"character" "cursor" "dec" "int" "real" "character" "cursor" "dec" "int" "real"
;; ANSI Reserved Word that look like types ;; ANSI Reserved Word that look like types
"char" "integer" "smallint" ) t) "\\b")))) "char" "integer" "smallint" ) t) "\\b"))))
(setq sql-mode-ansi-font-lock-keywords (setq sql-mode-ansi-font-lock-keywords
...@@ -569,11 +584,11 @@ you define your own sql-mode-postgres-font-lock-keywords.") ...@@ -569,11 +584,11 @@ you define your own sql-mode-postgres-font-lock-keywords.")
(regexp-opt '( (regexp-opt '(
"language" "language"
) t) "\\b"))) ) t) "\\b")))
(postgres-types (eval-when-compile (postgres-types (eval-when-compile
(concat "\\b" (concat "\\b"
(regexp-opt '( (regexp-opt '(
"bool" "box" "circle" "char" "char2" "char4" "char8" "char16" "date" "bool" "box" "circle" "char" "char2" "char4" "char8" "char16" "date"
"float4" "float8" "int2" "int4" "int8" "line" "lseg" "money" "path" "float4" "float8" "int2" "int4" "int8" "line" "lseg" "money" "path"
"point" "polygon" "serial" "text" "time" "timespan" "timestamp" "varchar" "point" "polygon" "serial" "text" "time" "timespan" "timestamp" "varchar"
) t)"\\b"))) ) t)"\\b")))
(postgres-builtin-functions (eval-when-compile (postgres-builtin-functions (eval-when-compile
...@@ -618,7 +633,7 @@ can be changed by some entry functions to provide more hilighting.") ...@@ -618,7 +633,7 @@ can be changed by some entry functions to provide more hilighting.")
;;;###autoload ;;;###autoload
(defun sql-help () (defun sql-help ()
"Shows short help for the SQL modes. "Show short help for the SQL modes.
Use an entry function to open an interactive SQL buffer. This buffer is Use an entry function to open an interactive SQL buffer. This buffer is
usually named `*SQL*'. The name of the major mode is SQLi. usually named `*SQL*'. The name of the major mode is SQLi.
...@@ -691,18 +706,18 @@ In order to ask the user for username, password and database, call the ...@@ -691,18 +706,18 @@ In order to ask the user for username, password and database, call the
function like this: (sql-get-login 'user 'password 'database)." function like this: (sql-get-login 'user 'password 'database)."
(interactive) (interactive)
(if (memq 'user what) (if (memq 'user what)
(setq sql-user (setq sql-user
(read-from-minibuffer "User: " sql-user nil nil (read-from-minibuffer "User: " sql-user nil nil
sql-user-history))) sql-user-history)))
(if (memq 'password what) (if (memq 'password what)
(setq sql-password (setq sql-password
(sql-read-passwd "Password: " sql-password))) (sql-read-passwd "Password: " sql-password)))
(if (memq 'server what) (if (memq 'server what)
(setq sql-server (setq sql-server
(read-from-minibuffer "Server: " sql-server nil nil (read-from-minibuffer "Server: " sql-server nil nil
sql-server-history))) sql-server-history)))
(if (memq 'database what) (if (memq 'database what)
(setq sql-database (setq sql-database
(read-from-minibuffer "Database: " sql-database nil nil (read-from-minibuffer "Database: " sql-database nil nil
sql-database-history)))) sql-database-history))))
...@@ -714,14 +729,14 @@ strings are sent to. Calling this function sets `sql-buffer' and runs ...@@ -714,14 +729,14 @@ strings are sent to. Calling this function sets `sql-buffer' and runs
`sql-set-sqli-hook'. `sql-set-sqli-hook'.
If you call it from a SQL buffer, this sets the local copy of If you call it from a SQL buffer, this sets the local copy of
`sql-buffer'. `sql-buffer'.
If you call it from anywhere else, it sets the global copy of If you call it from anywhere else, it sets the global copy of
`sql-buffer'." `sql-buffer'."
(interactive) (interactive)
(let ((new-buffer (get-buffer (read-buffer "New SQLi buffer: " nil t)))) (let ((new-buffer (get-buffer (read-buffer "New SQLi buffer: " nil t))))
(if new-buffer (if new-buffer
(progn (progn
(setq sql-buffer new-buffer) (setq sql-buffer new-buffer)
(run-hooks 'sql-set-sqli-hook))))) (run-hooks 'sql-set-sqli-hook)))))
...@@ -770,11 +785,11 @@ Inserts SELECT or commas if appropriate." ...@@ -770,11 +785,11 @@ Inserts SELECT or commas if appropriate."
(goto-char (point-max)) (goto-char (point-max))
(cond (cond
;; if empty command line, insert SELECT ;; if empty command line, insert SELECT
((save-excursion (beginning-of-line) ((save-excursion (beginning-of-line)
(looking-at (concat comint-prompt-regexp "$"))) (looking-at (concat comint-prompt-regexp "$")))
(insert "SELECT ")) (insert "SELECT "))
;; else if appending to SELECT or ORDER BY, insert a comma ;; else if appending to SELECT or ORDER BY, insert a comma
((save-excursion ((save-excursion
(re-search-backward "\\b\\(select\\|order by\\) .+" (re-search-backward "\\b\\(select\\|order by\\) .+"
(save-excursion (beginning-of-line) (point)) t)) (save-excursion (beginning-of-line) (point)) t))
(insert ", ")) (insert ", "))
...@@ -801,7 +816,7 @@ Inserts SELECT or commas if appropriate." ...@@ -801,7 +816,7 @@ Inserts SELECT or commas if appropriate."
() ()
(comint-send-string sql-buffer "\n")) (comint-send-string sql-buffer "\n"))
(message "Sent string to buffer %s." (buffer-name sql-buffer)) (message "Sent string to buffer %s." (buffer-name sql-buffer))
(if sql-pop-to-buffer-after-send-region (if sql-pop-to-buffer-after-send-region
(pop-to-buffer sql-buffer) (pop-to-buffer sql-buffer)
(display-buffer sql-buffer))) (display-buffer sql-buffer)))
(message "No SQL process started."))) (message "No SQL process started.")))
...@@ -830,7 +845,7 @@ sql-toggle-pop-to-buffer-after-send-region to VALUE." ...@@ -830,7 +845,7 @@ sql-toggle-pop-to-buffer-after-send-region to VALUE."
(interactive "P") (interactive "P")
(if value (if value
(setq sql-pop-to-buffer-after-send-region value) (setq sql-pop-to-buffer-after-send-region value)
(setq sql-pop-to-buffer-after-send-region (setq sql-pop-to-buffer-after-send-region
(null sql-pop-to-buffer-after-send-region )))) (null sql-pop-to-buffer-after-send-region ))))
...@@ -845,7 +860,7 @@ You can send SQL statements to the SQLi buffer using ...@@ -845,7 +860,7 @@ You can send SQL statements to the SQLi buffer using
\\[sql-send-region]. Such a buffer must exist before you can do this. \\[sql-send-region]. Such a buffer must exist before you can do this.
See `sql-help' on how to create SQLi buffers. See `sql-help' on how to create SQLi buffers.
\\{sql-mode-map} \\{sql-mode-map}
Customization: Entry to this mode runs the `sql-mode-hook'. Customization: Entry to this mode runs the `sql-mode-hook'.
When you put a buffer in SQL mode, the buffer stores the last SQLi When you put a buffer in SQL mode, the buffer stores the last SQLi
...@@ -864,20 +879,35 @@ For information on how to create multiple SQLi buffers, see ...@@ -864,20 +879,35 @@ For information on how to create multiple SQLi buffers, see
(use-local-map sql-mode-map) (use-local-map sql-mode-map)
(set-syntax-table sql-mode-syntax-table) (set-syntax-table sql-mode-syntax-table)
(make-local-variable 'font-lock-defaults) (make-local-variable 'font-lock-defaults)
(setq font-lock-defaults '(sql-mode-font-lock-keywords ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
nil t ((95 . "w") (46 . "w")))) ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column
;; will have just one quote. Therefore syntactic hilighting is
;; disabled for interactive buffers. `_' and `.' are considered part
;; of words.
(setq font-lock-defaults '(sql-mode-font-lock-keywords
nil t ((?_ . "w") (?. . "w"))))
(make-local-variable 'comment-start) (make-local-variable 'comment-start)
(setq comment-start "--") (setq comment-start "--")
;; Make each buffer in sql-mode remeber the "current" SQLi buffer. ;; Make each buffer in sql-mode remember the "current" SQLi buffer.
(make-local-variable 'sql-buffer) (make-local-variable 'sql-buffer)
;; Add imenu support for sql-mode. Note that imenu-generic-expression
;; is buffer-local, so we don't need a local-variable for it. SQL is
;; case-insensitive, that's why we have to set imenu-case-fold-search.
;; imenu-syntax-alist makes sure that `_' is considered part of object
;; names.
(setq imenu-generic-expression sql-imenu-generic-expression
imenu-case-fold-search t
imenu-syntax-alist '(("_" . "w")))
;; Make `sql-send-paragraph' work on paragraphs that contain indented ;; Make `sql-send-paragraph' work on paragraphs that contain indented
;; lines. ;; lines.
(make-local-variable 'paragraph-separate) (make-local-variable 'paragraph-separate)
(make-local-variable 'paragraph-start) (make-local-variable 'paragraph-start)
(setq paragraph-separate "[\f]*$" (setq paragraph-separate "[\f]*$"
paragraph-start "[\n\f]") paragraph-start "[\n\f]")
;; Abbrevs
(setq local-abbrev-table sql-mode-abbrev-table) (setq local-abbrev-table sql-mode-abbrev-table)
(setq abbrev-all-caps 1) (setq abbrev-all-caps 1)
;; Run hook
(run-hooks 'sql-mode-hook)) (run-hooks 'sql-mode-hook))
...@@ -953,7 +983,7 @@ certain length. ...@@ -953,7 +983,7 @@ certain length.
Here is another example. It will always put point back to the statement Here is another example. It will always put point back to the statement
you entered, right above the output it created. you entered, right above the output it created.
\(setq comint-output-filter-functions \(setq comint-output-filter-functions
\(function (lambda (STR) (comint-show-output))))" \(function (lambda (STR) (comint-show-output))))"
(comint-mode) (comint-mode)
(setq comint-prompt-regexp sql-prompt-regexp) (setq comint-prompt-regexp sql-prompt-regexp)
...@@ -964,11 +994,12 @@ you entered, right above the output it created. ...@@ -964,11 +994,12 @@ you entered, right above the output it created.
(set-syntax-table sql-mode-syntax-table) (set-syntax-table sql-mode-syntax-table)
(make-local-variable 'font-lock-defaults) (make-local-variable 'font-lock-defaults)
;; Note that making KEYWORDS-ONLY nil will cause havoc if you try ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column
;; column will have just one quote. Therefore syntactic hilighting ;; will have just one quote. Therefore syntactic hilighting is
;; is disabled for interactive buffers. ;; disabled for interactive buffers. `_' and `.' are considered part
(setq font-lock-defaults '(sql-mode-font-lock-keywords ;; of words.
t t ((95 . "w") (46 . "w")))) (setq font-lock-defaults '(sql-mode-font-lock-keywords
t t ((?_ . "w") (?. . "w"))))
;; Enable commenting and uncommenting of the region. ;; Enable commenting and uncommenting of the region.
(make-local-variable 'comment-start) (make-local-variable 'comment-start)
(setq comment-start "--") (setq comment-start "--")
...@@ -1108,7 +1139,7 @@ The default comes from `process-coding-system-alist' and ...@@ -1108,7 +1139,7 @@ The default comes from `process-coding-system-alist' and
(setq params (append (list "-P" sql-password) params))) (setq params (append (list "-P" sql-password) params)))
(if (not (string= "" sql-user)) (if (not (string= "" sql-user))
(setq params (append (list "-U" sql-user) params))) (setq params (append (list "-U" sql-user) params)))
(set-buffer (apply 'make-comint "SQL" sql-sybase-program (set-buffer (apply 'make-comint "SQL" sql-sybase-program
nil params))) nil params)))
(setq sql-prompt-regexp "^SQL> ") (setq sql-prompt-regexp "^SQL> ")
(setq sql-prompt-length 5) (setq sql-prompt-length 5)
...@@ -1199,7 +1230,7 @@ The default comes from `process-coding-system-alist' and ...@@ -1199,7 +1230,7 @@ The default comes from `process-coding-system-alist' and
(setq params (append (list (concat "--password=" sql-password)) params))) (setq params (append (list (concat "--password=" sql-password)) params)))
(if (not (string= "" sql-user)) (if (not (string= "" sql-user))
(setq params (append (list (concat "--user=" sql-user)) params))) (setq params (append (list (concat "--user=" sql-user)) params)))
(set-buffer (apply 'make-comint "SQL" sql-mysql-program (set-buffer (apply 'make-comint "SQL" sql-mysql-program
nil params))) nil params)))
(setq sql-prompt-regexp "^mysql>") (setq sql-prompt-regexp "^mysql>")
(setq sql-prompt-length 6) (setq sql-prompt-length 6)
...@@ -1246,7 +1277,7 @@ The default comes from `process-coding-system-alist' and ...@@ -1246,7 +1277,7 @@ The default comes from `process-coding-system-alist' and
(setq params (append (list sql-user sql-password) params))) (setq params (append (list sql-user sql-password) params)))
(if (not (string= "" sql-server)) (if (not (string= "" sql-server))
(setq params (append (list sql-server) params))) (setq params (append (list sql-server) params)))
(set-buffer (apply 'make-comint "SQL" sql-solid-program (set-buffer (apply 'make-comint "SQL" sql-solid-program
nil params))) nil params)))
(setq sql-prompt-regexp "^") (setq sql-prompt-regexp "^")
(setq sql-prompt-length 0) (setq sql-prompt-length 0)
...@@ -1368,7 +1399,7 @@ in the input and output to the process, use \\[universal-coding-system-argument] ...@@ -1368,7 +1399,7 @@ in the input and output to the process, use \\[universal-coding-system-argument]
before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system] before \\[sql-postgres]. You can also specify this with \\[set-buffer-process-coding-system]
in the SQL buffer, after you start the process. in the SQL buffer, after you start the process.
The default comes from `process-coding-system-alist' and The default comes from `process-coding-system-alist' and
`default-process-coding-system'. If your output lines end with ^M, `default-process-coding-system'. If your output lines end with ^M,
your might try undecided-dos as a coding system. If this doesn't help, your might try undecided-dos as a coding system. If this doesn't help,
Try to set `comint-output-filter-functions' like this: Try to set `comint-output-filter-functions' like this:
...@@ -1387,12 +1418,12 @@ Try to set `comint-output-filter-functions' like this: ...@@ -1387,12 +1418,12 @@ Try to set `comint-output-filter-functions' like this:
(setq params (append (list sql-database) params))) (setq params (append (list sql-database) params)))
(if (not (string= "" sql-server)) (if (not (string= "" sql-server))
(setq params (append (list "-h" sql-server) params))) (setq params (append (list "-h" sql-server) params)))
(set-buffer (apply 'make-comint "SQL" sql-postgres-program (set-buffer (apply 'make-comint "SQL" sql-postgres-program
nil params))) nil params)))
(setq sql-prompt-regexp "^.*> *") (setq sql-prompt-regexp "^.*> *")
(setq sql-prompt-length 5) (setq sql-prompt-length 5)
;; This is a lousy hack to prevent psql from truncating it's output ;; This is a lousy hack to prevent psql from truncating it's output
;; and giving stupid warnings. If s.o. knows a way to prevent psql ;; and giving stupid warnings. If s.o. knows a way to prevent psql
;; from acting this way, then I would be very thankful to ;; from acting this way, then I would be very thankful to
;; incorporate this (Gregor Zych <zych@pool.informatik.rwth-aachen.de>) ;; incorporate this (Gregor Zych <zych@pool.informatik.rwth-aachen.de>)
(comint-send-string "*SQL*" "\\o \| cat\n") (comint-send-string "*SQL*" "\\o \| cat\n")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment