;; Author: Alex Schroeder <alex@gnu.org>
;; Maintainer: Alex Schroeder <alex@gnu.org>
-;; Version: 1.4.19
+;; Version: 1.4.21
;; Keywords: comm languages processes
;; This file is part of GNU Emacs.
;; modes derived from comint mode. This makes these modes easier to
;; use.
-;; sql-mode can be used to enable syntactic hilighting for SQL
-;; statements in another buffer. SQL statements can then be sent to
-;; the SQL process in the SQLi buffer. sql-mode has already been
-;; used as a template to a simple PL/SQL mode.
+;; sql-mode can be used to keep editing SQL statements. The SQL
+;; statements can be sent to the SQL process in the SQLi buffer.
;; For documentation on the functionality provided by comint mode, and
;; the hooks available for customising it, see the file `comint.el'.
:type 'file
:group 'SQL)
+(defcustom sql-postgres-options '("--pset" "pager=off")
+ "*List of additional options for `sql-postgres-program'.
+The default setting includes the --pset option which breaks
+older versions of the psql client (such as version 6.5.3).
+If you want the psql to prompt you for a user name, add the
+string \"-u\" to the list of options."
+ :type '(repeat string)
+ :version "20.8"
+ :group 'SQL)
+
\f
;;; Variables which do not need customization
'("SQL"
["Send Paragraph" sql-send-paragraph (and (buffer-live-p sql-buffer)
(get-buffer-process sql-buffer))]
- ["Send Region" sql-send-region (and mark-active
+ ["Send Region" sql-send-region (and (or (and (boundp 'mark-active); Emacs
+ mark-active)
+ (mark)); XEmacs
(buffer-live-p sql-buffer)
(get-buffer-process sql-buffer))]
["Send Buffer" sql-send-buffer (and (buffer-live-p sql-buffer)
(setq major-mode 'sql-mode)
(setq mode-name "SQL")
(use-local-map sql-mode-map)
+ (if sql-mode-menu
+ (easy-menu-add sql-mode-menu)); XEmacs
(set-syntax-table sql-mode-syntax-table)
(make-local-variable 'font-lock-defaults)
;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
(setq major-mode 'sql-interactive-mode)
(setq mode-name "SQLi")
(use-local-map sql-interactive-mode-map)
+ (if sql-interactive-mode-menu
+ (easy-menu-add sql-interactive-mode-menu)); XEmacs
(set-syntax-table sql-mode-syntax-table)
(make-local-variable 'font-lock-defaults)
;; Note that making KEYWORDS-ONLY nil will cause havoc if you try
(message "Login...")
;; username and password are ignored. Jason Beegan suggest using
;; --pset and pager=off instead of \\o|cat. The later was the
- ;; solution by Gregor Zych. If you find that your postgres doesn't
- ;; like Jason Beegans's solution and prefers Gregor Zych's solution,
- ;; then I'd love to hear from you. Send your comments to the
- ;; mailing list.
- (let ((params (list "--pset" "pager=off")))
+ ;; solution by Gregor Zych. Jason's suggestion is the default value
+ ;; for sql-postgres-options.
+ (let ((params sql-postgres-options))
(if (not (string= "" sql-database))
(setq params (append (list sql-database) params)))
(if (not (string= "" sql-server))