Merge remote-tracking branch 'savannah/master' into HEAD

This commit is contained in:
Andrea Corallo 2020-03-15 10:31:03 +00:00
commit a8c20f67be
3 changed files with 145 additions and 228 deletions

View file

@ -798,7 +798,7 @@ correspond to previously loaded files (those returned by
;; FIXME: not the friendliest, but simple. ;; FIXME: not the friendliest, but simple.
(require 'info) (require 'info)
(info-initialize) (info-initialize)
(push pkg-dir Info-directory-list)) (add-to-list 'Info-directory-list pkg-dir))
(push name package-activated-list) (push name package-activated-list)
;; Don't return nil. ;; Don't return nil.
t))) t)))

View file

@ -257,7 +257,6 @@
(defcustom sql-user "" (defcustom sql-user ""
"Default username." "Default username."
:type 'string :type 'string
:group 'SQL
:safe 'stringp) :safe 'stringp)
(defcustom sql-password "" (defcustom sql-password ""
@ -265,33 +264,28 @@
If you customize this, the value will be stored in your init If you customize this, the value will be stored in your init
file. Since that is a plaintext file, this could be dangerous." file. Since that is a plaintext file, this could be dangerous."
:type 'string :type 'string
:group 'SQL
:risky t) :risky t)
(defcustom sql-database "" (defcustom sql-database ""
"Default database." "Default database."
:type 'string :type 'string
:group 'SQL
:safe 'stringp) :safe 'stringp)
(defcustom sql-server "" (defcustom sql-server ""
"Default server or host." "Default server or host."
:type 'string :type 'string
:group 'SQL
:safe 'stringp) :safe 'stringp)
(defcustom sql-port 0 (defcustom sql-port 0
"Default port for connecting to a MySQL or Postgres server." "Default port for connecting to a MySQL or Postgres server."
:version "24.1" :version "24.1"
:type 'number :type 'number
:group 'SQL
:safe 'numberp) :safe 'numberp)
(defcustom sql-default-directory nil (defcustom sql-default-directory nil
"Default directory for SQL processes." "Default directory for SQL processes."
:version "25.1" :version "25.1"
:type '(choice (const nil) string) :type '(choice (const nil) string)
:group 'SQL
:safe 'stringp) :safe 'stringp)
;; Login parameter type ;; Login parameter type
@ -707,9 +701,9 @@ making new SQLi sessions."
(repeat :inline t (repeat :inline t
(list :tab "Other" (list :tab "Other"
(symbol :tag " Variable Symbol") (symbol :tag " Variable Symbol")
;; FIXME: Why "Value *Expression*"?
(sexp :tag "Value Expression"))))) (sexp :tag "Value Expression")))))
:version "24.1" :version "24.1")
:group 'SQL)
(defvaralias 'sql-dialect 'sql-product) (defvaralias 'sql-dialect 'sql-product)
@ -723,7 +717,6 @@ This allows highlighting buffers properly when you open them."
(capitalize (symbol-name (car prod-info)))) (capitalize (symbol-name (car prod-info))))
,(car prod-info))) ,(car prod-info)))
sql-product-alist)) sql-product-alist))
:group 'SQL
:safe 'symbolp) :safe 'symbolp)
;; SQL indent support ;; SQL indent support
@ -735,7 +728,6 @@ SQL statements with easy customizations to support varied layout
requirements. requirements.
The package must be available to be loaded and activated." The package must be available to be loaded and activated."
:group 'SQL
:link '(url-link "https://elpa.gnu.org/packages/sql-indent.html") :link '(url-link "https://elpa.gnu.org/packages/sql-indent.html")
:type 'boolean :type 'boolean
:version "27.1") :version "27.1")
@ -851,7 +843,6 @@ host key."
See `sql-password-search-wallet-function' to understand how this value See `sql-password-search-wallet-function' to understand how this value
is used to locate the password wallet." is used to locate the password wallet."
:type `(plist-get (symbol-plist 'auth-sources) 'custom-type) :type `(plist-get (symbol-plist 'auth-sources) 'custom-type)
:group 'SQL
:version "27.1") :version "27.1")
(defvar sql-password-search-wallet-function #'sql-auth-source-search-wallet (defvar sql-password-search-wallet-function #'sql-auth-source-search-wallet
@ -878,8 +869,7 @@ current input in the SQLi buffer to the process."
:type '(choice (const :tag "Nothing" nil) :type '(choice (const :tag "Nothing" nil)
(const :tag "The semicolon `;'" semicolon) (const :tag "The semicolon `;'" semicolon)
(const :tag "The string `go' by itself" go)) (const :tag "The string `go' by itself" go))
:version "20.8" :version "20.8")
:group 'SQL)
(defcustom sql-send-terminator nil (defcustom sql-send-terminator nil
"When non-nil, add a terminator to text sent to the SQL interpreter. "When non-nil, add a terminator to text sent to the SQL interpreter.
@ -907,8 +897,7 @@ it automatically."
(cons :tag "Terminator Pattern and String" (cons :tag "Terminator Pattern and String"
(regexp :tag "Terminator Pattern") (regexp :tag "Terminator Pattern")
(string :tag "Terminator String"))) (string :tag "Terminator String")))
:version "22.2" :version "22.2")
:group 'SQL)
(defvar sql-contains-names nil (defvar sql-contains-names nil
"When non-nil, the current buffer contains database names. "When non-nil, the current buffer contains database names.
@ -932,8 +921,7 @@ buffer."
:type '(choice (const :tag "Default" t) :type '(choice (const :tag "Default" t)
(const :tag "No display" nil) (const :tag "No display" nil)
(function :tag "Display Buffer function")) (function :tag "Display Buffer function"))
:version "27.1" :version "27.1")
:group 'SQL)
;; imenu support for sql-mode. ;; imenu support for sql-mode.
@ -971,8 +959,7 @@ This is used to initialize `comint-input-ring-file-name'.
Note that the size of the input history is determined by the variable Note that the size of the input history is determined by the variable
`comint-input-ring-size'." `comint-input-ring-size'."
:type '(choice (const :tag "none" nil) :type '(choice (const :tag "none" nil)
(file)) (file)))
:group 'SQL)
(defcustom sql-input-ring-separator "\n--\n" (defcustom sql-input-ring-separator "\n--\n"
"Separator between commands in the history file. "Separator between commands in the history file.
@ -987,21 +974,18 @@ does not have it, setting `sql-input-ring-separator' will have no
effect. In that case multiline commands will be split into several effect. In that case multiline commands will be split into several
commands when the input history is read, as if you had set commands when the input history is read, as if you had set
`sql-input-ring-separator' to \"\\n\"." `sql-input-ring-separator' to \"\\n\"."
:type 'string :type 'string)
:group 'SQL)
;; The usual hooks ;; The usual hooks
(defcustom sql-interactive-mode-hook '(sql-indent-enable) (defcustom sql-interactive-mode-hook '(sql-indent-enable)
"Hook for customizing `sql-interactive-mode'." "Hook for customizing `sql-interactive-mode'."
:type 'hook :type 'hook
:group 'SQL
:version "27.1") :version "27.1")
(defcustom sql-mode-hook '(sql-indent-enable) (defcustom sql-mode-hook '(sql-indent-enable)
"Hook for customizing `sql-mode'." "Hook for customizing `sql-mode'."
:type 'hook :type 'hook
:group 'SQL
:version "27.1") :version "27.1")
(defcustom sql-set-sqli-hook '() (defcustom sql-set-sqli-hook '()
@ -1009,8 +993,7 @@ commands when the input history is read, as if you had set
This is called by `sql-set-sqli-buffer' when the value of `sql-buffer' This is called by `sql-set-sqli-buffer' when the value of `sql-buffer'
is changed." is changed."
:type 'hook :type 'hook)
:group 'SQL)
(defcustom sql-login-hook '() (defcustom sql-login-hook '()
"Hook for interacting with a buffer in `sql-interactive-mode'. "Hook for interacting with a buffer in `sql-interactive-mode'.
@ -1018,8 +1001,7 @@ is changed."
This hook is invoked in a buffer once it is ready to accept input This hook is invoked in a buffer once it is ready to accept input
for the first time." for the first time."
:version "24.1" :version "24.1"
:type 'hook :type 'hook)
:group 'SQL)
;; Customization for ANSI ;; Customization for ANSI
@ -1033,8 +1015,7 @@ All products share this list; products should define a regexp to
identify additional keywords in a variable defined by identify additional keywords in a variable defined by
the :statement feature." the :statement feature."
:version "24.1" :version "24.1"
:type 'regexp :type 'regexp)
:group 'SQL)
;; Customization for Oracle ;; Customization for Oracle
@ -1046,27 +1027,23 @@ Starts `sql-interactive-mode' after doing some setup.
On Windows, \"sqlplus\" usually starts the sqlplus \"GUI\". In order On Windows, \"sqlplus\" usually starts the sqlplus \"GUI\". In order
to start the sqlplus console, use \"plus33\" or something similar. to start the sqlplus console, use \"plus33\" or something similar.
You will find the file in your Orant\\bin directory." You will find the file in your Orant\\bin directory."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-oracle-options '("-L") (defcustom sql-oracle-options '("-L")
"List of additional options for `sql-oracle-program'." "List of additional options for `sql-oracle-program'."
:type '(repeat string) :type '(repeat string)
:version "24.4" :version "24.4")
:group 'SQL)
(defcustom sql-oracle-login-params '(user password database) (defcustom sql-oracle-login-params '(user password database)
"List of login parameters needed to connect to Oracle." "List of login parameters needed to connect to Oracle."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
(defcustom sql-oracle-statement-starters (defcustom sql-oracle-statement-starters
(regexp-opt '("declare" "begin" "with")) (regexp-opt '("declare" "begin" "with"))
"Additional statement starting keywords in Oracle." "Additional statement starting keywords in Oracle."
:version "24.1" :version "24.1"
:type 'string :type 'string)
:group 'SQL)
(defcustom sql-oracle-scan-on t (defcustom sql-oracle-scan-on t
"Non-nil if placeholders should be replaced in Oracle SQLi. "Non-nil if placeholders should be replaced in Oracle SQLi.
@ -1082,8 +1059,7 @@ You need to issue the following command in SQL*Plus to be safe:
In older versions of SQL*Plus, this was the SET SCAN OFF command." In older versions of SQL*Plus, this was the SET SCAN OFF command."
:version "24.1" :version "24.1"
:type 'boolean :type 'boolean)
:group 'SQL)
(defcustom sql-db2-escape-newlines nil (defcustom sql-db2-escape-newlines nil
"Non-nil if newlines should be escaped by a backslash in DB2 SQLi. "Non-nil if newlines should be escaped by a backslash in DB2 SQLi.
@ -1092,8 +1068,7 @@ When non-nil, Emacs will automatically insert a space and
backslash prior to every newline in multi-line SQL statements as backslash prior to every newline in multi-line SQL statements as
they are submitted to an interactive DB2 session." they are submitted to an interactive DB2 session."
:version "24.3" :version "24.3"
:type 'boolean :type 'boolean)
:group 'SQL)
;; Customization for SQLite ;; Customization for SQLite
@ -1103,21 +1078,18 @@ they are submitted to an interactive DB2 session."
"Command to start SQLite. "Command to start SQLite.
Starts `sql-interactive-mode' after doing some setup." Starts `sql-interactive-mode' after doing some setup."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-sqlite-options nil (defcustom sql-sqlite-options nil
"List of additional options for `sql-sqlite-program'." "List of additional options for `sql-sqlite-program'."
:type '(repeat string) :type '(repeat string)
:version "20.8" :version "20.8")
:group 'SQL)
(defcustom sql-sqlite-login-params '((database :file nil (defcustom sql-sqlite-login-params '((database :file nil
:must-match confirm)) :must-match confirm))
"List of login parameters needed to connect to SQLite." "List of login parameters needed to connect to SQLite."
:type 'sql-login-params :type 'sql-login-params
:version "26.1" :version "26.1")
:group 'SQL)
;; Customization for MariaDB ;; Customization for MariaDB
@ -1134,22 +1106,19 @@ Starts `sql-interactive-mode' after doing some setup."
"Command to start mysql by Oracle. "Command to start mysql by Oracle.
Starts `sql-interactive-mode' after doing some setup." Starts `sql-interactive-mode' after doing some setup."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-mysql-options nil (defcustom sql-mysql-options nil
"List of additional options for `sql-mysql-program'. "List of additional options for `sql-mysql-program'.
The following list of options is reported to make things work The following list of options is reported to make things work
on Windows: \"-C\" \"-t\" \"-f\" \"-n\"." on Windows: \"-C\" \"-t\" \"-f\" \"-n\"."
:type '(repeat string) :type '(repeat string)
:version "20.8" :version "20.8")
:group 'SQL)
(defcustom sql-mysql-login-params '(user password database server) (defcustom sql-mysql-login-params '(user password database server)
"List of login parameters needed to connect to MySQL." "List of login parameters needed to connect to MySQL."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
;; Customization for Solid ;; Customization for Solid
@ -1157,14 +1126,12 @@ on Windows: \"-C\" \"-t\" \"-f\" \"-n\"."
"Command to start SOLID SQL Editor. "Command to start SOLID SQL Editor.
Starts `sql-interactive-mode' after doing some setup." Starts `sql-interactive-mode' after doing some setup."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-solid-login-params '(user password server) (defcustom sql-solid-login-params '(user password server)
"List of login parameters needed to connect to Solid." "List of login parameters needed to connect to Solid."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
;; Customization for Sybase ;; Customization for Sybase
@ -1172,21 +1139,18 @@ Starts `sql-interactive-mode' after doing some setup."
"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."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-sybase-options nil (defcustom sql-sybase-options nil
"List of additional options for `sql-sybase-program'. "List of additional options for `sql-sybase-program'.
Some versions of isql might require the -n option in order to work." Some versions of isql might require the -n option in order to work."
:type '(repeat string) :type '(repeat string)
:version "20.8" :version "20.8")
:group 'SQL)
(defcustom sql-sybase-login-params '(server user password database) (defcustom sql-sybase-login-params '(server user password database)
"List of login parameters needed to connect to Sybase." "List of login parameters needed to connect to Sybase."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
;; Customization for Informix ;; Customization for Informix
@ -1194,14 +1158,12 @@ Some versions of isql might require the -n option in order to work."
"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."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-informix-login-params '(database) (defcustom sql-informix-login-params '(database)
"List of login parameters needed to connect to Informix." "List of login parameters needed to connect to Informix."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
;; Customization for Ingres ;; Customization for Ingres
@ -1209,14 +1171,12 @@ Starts `sql-interactive-mode' after doing some setup."
"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."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-ingres-login-params '(database) (defcustom sql-ingres-login-params '(database)
"List of login parameters needed to connect to Ingres." "List of login parameters needed to connect to Ingres."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
;; Customization for Microsoft ;; Customization for Microsoft
@ -1229,21 +1189,18 @@ Starts `sql-interactive-mode' after doing some setup."
"Command to start osql by Microsoft. "Command to start osql by Microsoft.
Starts `sql-interactive-mode' after doing some setup." Starts `sql-interactive-mode' after doing some setup."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-ms-options '("-w" "300" "-n") (defcustom sql-ms-options '("-w" "300" "-n")
;; -w is the linesize ;; -w is the linesize
"List of additional options for `sql-ms-program'." "List of additional options for `sql-ms-program'."
:type '(repeat string) :type '(repeat string)
:version "22.1" :version "22.1")
:group 'SQL)
(defcustom sql-ms-login-params '(user password server database) (defcustom sql-ms-login-params '(user password server database)
"List of login parameters needed to connect to Microsoft." "List of login parameters needed to connect to Microsoft."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
;; Customization for Postgres ;; Customization for Postgres
@ -1251,8 +1208,7 @@ Starts `sql-interactive-mode' after doing some setup."
"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."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-postgres-options '("-P" "pager=off") (defcustom sql-postgres-options '("-P" "pager=off")
"List of additional options for `sql-postgres-program'. "List of additional options for `sql-postgres-program'.
@ -1263,8 +1219,7 @@ name, add the string \"-u\" to the list of options. If you want to
provide a user name on the command line (newer versions such as 7.1), provide a user name on the command line (newer versions such as 7.1),
add your name with a \"-U\" prefix (such as \"-Umark\") to the list." add your name with a \"-U\" prefix (such as \"-Umark\") to the list."
:type '(repeat string) :type '(repeat string)
:version "20.8" :version "20.8")
:group 'SQL)
(defcustom sql-postgres-login-params (defcustom sql-postgres-login-params
`((user :default ,(user-login-name)) `((user :default ,(user-login-name))
@ -1275,8 +1230,7 @@ add your name with a \"-U\" prefix (such as \"-Umark\") to the list."
server) server)
"List of login parameters needed to connect to Postgres." "List of login parameters needed to connect to Postgres."
:type 'sql-login-params :type 'sql-login-params
:version "26.1" :version "26.1")
:group 'SQL)
(defun sql-postgres-list-databases () (defun sql-postgres-list-databases ()
"Return a list of available PostgreSQL databases." "Return a list of available PostgreSQL databases."
@ -1297,20 +1251,17 @@ add your name with a \"-U\" prefix (such as \"-Umark\") to the list."
"Command to start isql by Interbase. "Command to start isql by Interbase.
Starts `sql-interactive-mode' after doing some setup." Starts `sql-interactive-mode' after doing some setup."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-interbase-options nil (defcustom sql-interbase-options nil
"List of additional options for `sql-interbase-program'." "List of additional options for `sql-interbase-program'."
:type '(repeat string) :type '(repeat string)
:version "20.8" :version "20.8")
:group 'SQL)
(defcustom sql-interbase-login-params '(user password database) (defcustom sql-interbase-login-params '(user password database)
"List of login parameters needed to connect to Interbase." "List of login parameters needed to connect to Interbase."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
;; Customization for DB2 ;; Customization for DB2
@ -1318,20 +1269,17 @@ Starts `sql-interactive-mode' after doing some setup."
"Command to start db2 by IBM. "Command to start db2 by IBM.
Starts `sql-interactive-mode' after doing some setup." Starts `sql-interactive-mode' after doing some setup."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-db2-options nil (defcustom sql-db2-options nil
"List of additional options for `sql-db2-program'." "List of additional options for `sql-db2-program'."
:type '(repeat string) :type '(repeat string)
:version "20.8" :version "20.8")
:group 'SQL)
(defcustom sql-db2-login-params nil (defcustom sql-db2-login-params nil
"List of login parameters needed to connect to DB2." "List of login parameters needed to connect to DB2."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
;; Customization for Linter ;; Customization for Linter
@ -1339,20 +1287,17 @@ Starts `sql-interactive-mode' after doing some setup."
"Command to start inl by RELEX. "Command to start inl by RELEX.
Starts `sql-interactive-mode' after doing some setup." Starts `sql-interactive-mode' after doing some setup."
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-linter-options nil (defcustom sql-linter-options nil
"List of additional options for `sql-linter-program'." "List of additional options for `sql-linter-program'."
:type '(repeat string) :type '(repeat string)
:version "21.3" :version "21.3")
:group 'SQL)
(defcustom sql-linter-login-params '(user password database server) (defcustom sql-linter-login-params '(user password database server)
"Login parameters to needed to connect to Linter." "Login parameters to needed to connect to Linter."
:type 'sql-login-params :type 'sql-login-params
:version "24.1" :version "24.1")
:group 'SQL)
@ -1436,10 +1381,7 @@ specified, it's `sql-product' or `sql-connection' must match."
(defvar sql-interactive-mode-map (defvar sql-interactive-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(if (fboundp 'set-keymap-parent) (set-keymap-parent map comint-mode-map)
(set-keymap-parent map comint-mode-map); Emacs
(if (fboundp 'set-keymap-parents)
(set-keymap-parents map (list comint-mode-map)))); XEmacs
(if (fboundp 'set-keymap-name) (if (fboundp 'set-keymap-name)
(set-keymap-name map 'sql-interactive-mode-map)); XEmacs (set-keymap-name map 'sql-interactive-mode-map)); XEmacs
(define-key map (kbd "C-j") 'sql-accumulate-and-indent) (define-key map (kbd "C-j") 'sql-accumulate-and-indent)
@ -2374,7 +2316,8 @@ function `regexp-opt'.")
"ansi_warnings" "forceplan" "showplan_all" "showplan_text" "ansi_warnings" "forceplan" "showplan_all" "showplan_text"
"statistics" "implicit_transactions" "remote_proc_transactions" "statistics" "implicit_transactions" "remote_proc_transactions"
"transaction" "xact_abort" "transaction" "xact_abort"
) t) )
t)
"\\)\\)\\|go\\s-*\\|use\\s-+\\|setuser\\s-+\\|dbcc\\s-+\\).*$") "\\)\\)\\|go\\s-*\\|use\\s-+\\|setuser\\s-+\\|dbcc\\s-+\\).*$")
'font-lock-doc-face) 'font-lock-doc-face)
@ -2856,7 +2799,7 @@ See `sql-product-alist' for a list of products and supported features."
(member feature sql-indirect-features) (member feature sql-indirect-features)
(not not-indirect) (not not-indirect)
(symbolp v)) (symbolp v))
(eval v) (symbol-value v)
v)) v))
(error "`%s' is not a known product; use `sql-add-product' to add it first." product) (error "`%s' is not a known product; use `sql-add-product' to add it first." product)
nil))) nil)))
@ -4245,7 +4188,6 @@ must tell Emacs. Here's how to do that in your init file:
\(add-hook \\='sql-mode-hook \(add-hook \\='sql-mode-hook
(lambda () (lambda ()
(modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))" (modify-syntax-entry ?\\\\ \".\" sql-mode-syntax-table)))"
:group 'SQL
:abbrev-table sql-mode-abbrev-table :abbrev-table sql-mode-abbrev-table
(if sql-mode-menu (if sql-mode-menu
@ -4280,7 +4222,7 @@ must tell Emacs. Here's how to do that in your init file:
(put 'sql-interactive-mode 'mode-class 'special) (put 'sql-interactive-mode 'mode-class 'special)
(put 'sql-interactive-mode 'custom-mode-group 'SQL) (put 'sql-interactive-mode 'custom-mode-group 'SQL)
;; FIXME: Why not use `define-derived-mode'? ;; FIXME: Why not use `define-derived-mode'?
(defun sql-interactive-mode () (define-derived-mode sql-interactive-mode comint-mode "SQLi[?]"
"Major mode to use a SQL interpreter interactively. "Major mode to use a SQL interpreter interactively.
Do not call this function by yourself. The environment must be Do not call this function by yourself. The environment must be
@ -4348,9 +4290,10 @@ 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))))"
:syntax-table sql-mode-syntax-table
;; FIXME: The doc above uses `setq' on `comint-output-filter-functions', ;; FIXME: The doc above uses `setq' on `comint-output-filter-functions',
;; whereas hooks should be manipulated with things like `add/remove-hook'. ;; whereas hooks should be manipulated with things like `add/remove-hook'.
(delay-mode-hooks (comint-mode)) :after-hook (sql--adjust-interactive-setup)
;; Get the `sql-product' for this interactive session. ;; Get the `sql-product' for this interactive session.
(set (make-local-variable 'sql-product) (set (make-local-variable 'sql-product)
@ -4358,14 +4301,11 @@ you entered, right above the output it created.
sql-product)) sql-product))
;; Setup the mode. ;; Setup the mode.
(setq major-mode 'sql-interactive-mode)
(setq mode-name (setq mode-name
(concat "SQLi[" (or (sql-get-product-feature sql-product :name) (concat "SQLi[" (or (sql-get-product-feature sql-product :name)
(symbol-name sql-product)) "]")) (symbol-name sql-product)) "]"))
(use-local-map sql-interactive-mode-map)
(if sql-interactive-mode-menu (if sql-interactive-mode-menu
(easy-menu-add sql-interactive-mode-menu)) ; XEmacs (easy-menu-add sql-interactive-mode-menu)) ; XEmacs
(set-syntax-table sql-mode-syntax-table)
;; 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 column ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column
@ -4409,9 +4349,10 @@ you entered, right above the output it created.
(add-hook 'comint-preoutput-filter-functions (add-hook 'comint-preoutput-filter-functions
#'sql-interactive-remove-continuation-prompt nil t) #'sql-interactive-remove-continuation-prompt nil t)
(make-local-variable 'sql-input-ring-separator) (make-local-variable 'sql-input-ring-separator)
(make-local-variable 'sql-input-ring-file-name) (make-local-variable 'sql-input-ring-file-name))
;; Run the mode hook (along with comint's hooks).
(run-mode-hooks 'sql-interactive-mode-hook) (defun sql--adjust-interactive-setup ()
"Finish the mode's setup after running the mode hook."
;; Set comint based on user overrides. ;; Set comint based on user overrides.
(setq comint-prompt-regexp (setq comint-prompt-regexp
(if sql-prompt-cont-regexp (if sql-prompt-cont-regexp
@ -4490,7 +4431,7 @@ is specified in the connection settings."
(dolist (vv connect-set) (dolist (vv connect-set)
(let ((var (car vv)) (let ((var (car vv))
(val (cadr vv))) (val (cadr vv)))
(set-default var (eval val)))) (set-default var (eval val)))) ;FIXME: Why `eval'?
(setq-default sql-connection connection) (setq-default sql-connection connection)
;; :sqli-login params variable ;; :sqli-login params variable
@ -4521,10 +4462,10 @@ is specified in the connection settings."
(if vals (cons var vals) var))))) (if vals (cons var vals) var)))))
;; Start the SQLi session with revised list of login parameters ;; Start the SQLi session with revised list of login parameters
(eval `(let ((,param-var ',rem-vars)) (cl-progv (list param-var) (list rem-vars)
(sql-product-interactive (sql-product-interactive
',sql-product sql-product
',(or buf-name (format "<%s>" connection)))))) (or buf-name (format "<%s>" connection)))))
(user-error "SQL Connection <%s> does not exist" connection) (user-error "SQL Connection <%s> does not exist" connection)
nil))) nil)))
@ -4595,7 +4536,10 @@ optionally is saved to the user's init file."
(format "Connection <%s>\t%s" (car conn) (format "Connection <%s>\t%s" (car conn)
(let ((sql-user "") (sql-database "") (let ((sql-user "") (sql-database "")
(sql-server "") (sql-port 0)) (sql-server "") (sql-port 0))
(eval `(let ,(cdr conn) (sql-make-alternate-buffer-name))))) (cl-progv
(mapcar #'car (cdr conn))
(mapcar #'cadr (cdr conn))
(sql-make-alternate-buffer-name))))
(list 'sql-connect (car conn)) (list 'sql-connect (car conn))
t)) t))
sql-connection-alist) sql-connection-alist)
@ -4977,8 +4921,7 @@ The default comes from `process-coding-system-alist' and
See the distinct values in ALL_OBJECTS.OBJECT_TYPE for possible values." See the distinct values in ALL_OBJECTS.OBJECT_TYPE for possible values."
:version "24.1" :version "24.1"
:type '(repeat string) :type '(repeat string))
:group 'SQL)
(defun sql-oracle-completion-object (sqlbuf schema) (defun sql-oracle-completion-object (sqlbuf schema)
(sql-redirect-value (sql-redirect-value
@ -5624,21 +5567,18 @@ buffer.
(defcustom sql-vertica-program "vsql" (defcustom sql-vertica-program "vsql"
"Command to start the Vertica client." "Command to start the Vertica client."
:version "25.1" :version "25.1"
:type 'file :type 'file)
:group 'SQL)
(defcustom sql-vertica-options '("-P" "pager=off") (defcustom sql-vertica-options '("-P" "pager=off")
"List of additional options for `sql-vertica-program'. "List of additional options for `sql-vertica-program'.
The default value disables the internal pager." The default value disables the internal pager."
:version "25.1" :version "25.1"
:type '(repeat string) :type '(repeat string))
:group 'SQL)
(defcustom sql-vertica-login-params '(user password database server) (defcustom sql-vertica-login-params '(user password database server)
"List of login parameters needed to connect to Vertica." "List of login parameters needed to connect to Vertica."
:version "25.1" :version "25.1"
:type 'sql-login-params :type 'sql-login-params)
:group 'SQL)
(defun sql-comint-vertica (product options &optional buf-name) (defun sql-comint-vertica (product options &optional buf-name)
"Create comint buffer and connect to Vertica." "Create comint buffer and connect to Vertica."

View file

@ -44,28 +44,23 @@
"Align assignments to this column by default with \\[conf-align-assignments]. "Align assignments to this column by default with \\[conf-align-assignments].
If this number is negative, the `=' comes before the whitespace. Use 0 to If this number is negative, the `=' comes before the whitespace. Use 0 to
not align (only setting space according to `conf-assignment-space')." not align (only setting space according to `conf-assignment-space')."
:type 'integer :type 'integer)
:group 'conf)
(defcustom conf-javaprop-assignment-column 32 (defcustom conf-javaprop-assignment-column 32
"Value for `conf-assignment-column' in Java properties buffers." "Value for `conf-assignment-column' in Java properties buffers."
:type 'integer :type 'integer)
:group 'conf)
(defcustom conf-colon-assignment-column (- (abs conf-assignment-column)) (defcustom conf-colon-assignment-column (- (abs conf-assignment-column))
"Value for `conf-assignment-column' in Java properties buffers." "Value for `conf-assignment-column' in Java properties buffers."
:type 'integer :type 'integer)
:group 'conf)
(defcustom conf-assignment-space t (defcustom conf-assignment-space t
"Put at least one space around assignments when aligning." "Put at least one space around assignments when aligning."
:type 'boolean :type 'boolean)
:group 'conf)
(defcustom conf-colon-assignment-space nil (defcustom conf-colon-assignment-space nil
"Value for `conf-assignment-space' in colon style Conf mode buffers." "Value for `conf-assignment-space' in colon style Conf mode buffers."
:type 'boolean :type 'boolean)
:group 'conf)
(defvar conf-mode-map (defvar conf-mode-map
(let ((map (make-sparse-keymap)) (let ((map (make-sparse-keymap))
@ -349,9 +344,37 @@ unbalanced, but hey...)"
(scan-error depth)))) (scan-error depth))))
(defun conf--guess-mode ()
"Try to guess sub-mode of `conf-mode' based on buffer content."
(let ((unix 0) (win 0) (equal 0) (colon 0) (space 0) (jp 0))
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(skip-chars-forward " \t\f")
(cond ((eq (char-after) ?\#) (setq unix (1+ unix)))
((eq (char-after) ?\;) (setq win (1+ win)))
((eq (char-after) ?\[)) ; nop
((eolp)) ; nop
((eq (char-after) ?})) ; nop
;; recognize at most double spaces within names
((looking-at "[^ \t\n=:]+\\(?: ?[^ \t\n=:]+\\)*[ \t]*[=:]")
(if (eq (char-before (match-end 0)) ?=)
(setq equal (1+ equal))
(setq colon (1+ colon))))
((looking-at "/[/*]") (setq jp (1+ jp)))
((looking-at ".*{")) ; nop
((setq space (1+ space))))
(forward-line)))
(cond
((> jp (max unix win 3)) #'conf-javaprop-mode)
((> colon (max equal space)) #'conf-colon-mode)
((> space (max equal colon)) #'conf-space-mode)
((or (> win unix) (and (= win unix) (eq system-type 'windows-nt)))
#'conf-windows-mode)
(t #'conf-unix-mode))))
;;;###autoload ;;;###autoload
(defun conf-mode () (define-derived-mode conf-mode nil "Conf[?]"
"Mode for Unix and Windows Conf files and Java properties. "Mode for Unix and Windows Conf files and Java properties.
Most conf files know only three kinds of constructs: parameter Most conf files know only three kinds of constructs: parameter
assignments optionally grouped into sections and comments. Yet assignments optionally grouped into sections and comments. Yet
@ -382,75 +405,37 @@ See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode',
\\{conf-mode-map}" \\{conf-mode-map}"
(interactive)
;; `conf-mode' plays two roles: it's the parent of several sub-modes ;; `conf-mode' plays two roles: it's the parent of several sub-modes
;; but it's also the function that chooses between those submodes. ;; but it's also the function that chooses between those submodes.
;; To tell the difference between those two cases where the function ;; To tell the difference between those two cases where the function
;; might be called, we check `delay-mode-hooks'. ;; might be called, we check `delay-mode-hooks'.
;; (adopted from tex-mode.el) ;; (adopted from tex-mode.el)
(if (not delay-mode-hooks) (if (not delay-mode-hooks)
;; try to guess sub-mode of conf-mode based on buffer content (funcall (conf--guess-mode))
(let ((unix 0) (win 0) (equal 0) (colon 0) (space 0) (jp 0))
(save-excursion
(goto-char (point-min))
(while (not (eobp))
(skip-chars-forward " \t\f")
(cond ((eq (char-after) ?\#) (setq unix (1+ unix)))
((eq (char-after) ?\;) (setq win (1+ win)))
((eq (char-after) ?\[)) ; nop
((eolp)) ; nop
((eq (char-after) ?})) ; nop
;; recognize at most double spaces within names
((looking-at "[^ \t\n=:]+\\(?: ?[^ \t\n=:]+\\)*[ \t]*[=:]")
(if (eq (char-before (match-end 0)) ?=)
(setq equal (1+ equal))
(setq colon (1+ colon))))
((looking-at "/[/*]") (setq jp (1+ jp)))
((looking-at ".*{")) ; nop
((setq space (1+ space))))
(forward-line)))
(cond
((> jp (max unix win 3)) (conf-javaprop-mode))
((> colon (max equal space)) (conf-colon-mode))
((> space (max equal colon)) (conf-space-mode))
((or (> win unix) (and (= win unix) (eq system-type 'windows-nt)))
(conf-windows-mode))
(t (conf-unix-mode))))
(kill-all-local-variables) (setq-local font-lock-defaults '(conf-font-lock-keywords nil t nil nil))
(use-local-map conf-mode-map)
(setq major-mode 'conf-mode
mode-name "Conf[?]")
(set (make-local-variable 'font-lock-defaults)
'(conf-font-lock-keywords nil t nil nil))
;; Let newcomment.el decide this for itself. ;; Let newcomment.el decide this for itself.
;; (set (make-local-variable 'comment-use-syntax) t) ;; (setq-local comment-use-syntax t)
(set (make-local-variable 'parse-sexp-ignore-comments) t) (setq-local parse-sexp-ignore-comments t)
(set (make-local-variable 'outline-regexp) (setq-local outline-regexp "[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)")
"[ \t]*\\(?:\\[\\|.+[ \t\n]*{\\)") (setq-local outline-heading-end-regexp "[\n}]")
(set (make-local-variable 'outline-heading-end-regexp) (setq-local outline-level #'conf-outline-level)
"[\n}]") (setq-local imenu-generic-expression
(set (make-local-variable 'outline-level) '(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*=" 1)
'conf-outline-level) ;; [section]
(set-syntax-table conf-mode-syntax-table) (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1)
(setq imenu-generic-expression ;; section { ... }
'(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*=" 1) (nil "^[ \t]*\\([^=:{} \t\n][^=:{}\n]+\\)[ \t\n]*{" 1)))))
;; [section]
(nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1)
;; section { ... }
(nil "^[ \t]*\\([^=:{} \t\n][^=:{}\n]+\\)[ \t\n]*{" 1)))
(run-mode-hooks 'conf-mode-hook)))
(defun conf-mode-initialize (comment &optional font-lock) (defun conf-mode-initialize (comment &optional font-lock)
"Initializations for sub-modes of `conf-mode'. "Initializations for sub-modes of `conf-mode'.
COMMENT initializes `comment-start' and `comment-start-skip'. COMMENT initializes `comment-start' and `comment-start-skip'.
The optional arg FONT-LOCK is the value for FONT-LOCK-KEYWORDS." The optional arg FONT-LOCK is the value for FONT-LOCK-KEYWORDS."
(set (make-local-variable 'comment-start) comment) (setq-local comment-start comment)
(set (make-local-variable 'comment-start-skip) (setq-local comment-start-skip
(concat (regexp-quote comment-start) "+\\s *")) (concat (regexp-quote comment-start) "+\\s *"))
(if font-lock (if font-lock
(set (make-local-variable 'font-lock-defaults) (setq-local font-lock-defaults `(,font-lock nil t nil nil))))
`(,font-lock nil t nil nil))))
;;;###autoload ;;;###autoload
(define-derived-mode conf-unix-mode conf-mode "Conf[Unix]" (define-derived-mode conf-unix-mode conf-mode "Conf[Unix]"
@ -497,13 +482,11 @@ x.1 =
x.2.y.1.z.1 = x.2.y.1.z.1 =
x.2.y.1.z.2.zz =" x.2.y.1.z.2.zz ="
(conf-mode-initialize "#" 'conf-javaprop-font-lock-keywords) (conf-mode-initialize "#" 'conf-javaprop-font-lock-keywords)
(set (make-local-variable 'conf-assignment-column) (setq-local conf-assignment-column conf-javaprop-assignment-column)
conf-javaprop-assignment-column) (setq-local conf-assignment-regexp ".+?\\([ \t]*[=: \t][ \t]*\\|$\\)")
(set (make-local-variable 'conf-assignment-regexp) (setq-local comment-start-skip "\\(?:#+\\|/[/*]+\\)\\s *")
".+?\\([ \t]*[=: \t][ \t]*\\|$\\)") (setq-local imenu-generic-expression
(setq comment-start-skip "\\(?:#+\\|/[/*]+\\)\\s *") '(("Parameters" "^[ \t]*\\(.+?\\)[=: \t]" 1))))
(setq imenu-generic-expression
'(("Parameters" "^[ \t]*\\(.+?\\)[=: \t]" 1))))
;;;###autoload ;;;###autoload
(define-derived-mode conf-space-mode conf-unix-mode "Conf[Space]" (define-derived-mode conf-space-mode conf-unix-mode "Conf[Space]"
@ -529,20 +512,18 @@ class desktop
add /dev/audio desktop add /dev/audio desktop
add /dev/mixer desktop" add /dev/mixer desktop"
(conf-mode-initialize "#" 'conf-space-font-lock-keywords) (conf-mode-initialize "#" 'conf-space-font-lock-keywords)
(make-local-variable 'conf-assignment-sign) (setq-local conf-assignment-sign nil)
(setq conf-assignment-sign nil)
(make-local-variable 'conf-space-keywords)
(cond (buffer-file-name (cond (buffer-file-name
;; We set conf-space-keywords directly, but a value which is ;; We set conf-space-keywords directly, but a value which is
;; in the local variables list or interactively specified ;; in the local variables list or interactively specified
;; (see the function conf-space-keywords) takes precedence. ;; (see the function conf-space-keywords) takes precedence.
(setq conf-space-keywords (setq-local conf-space-keywords
(assoc-default buffer-file-name conf-space-keywords-alist (assoc-default buffer-file-name conf-space-keywords-alist
'string-match)))) #'string-match))))
(conf-space-mode-internal) (conf-space-mode-internal)
;; In case the local variables list specifies conf-space-keywords, ;; In case the local variables list specifies conf-space-keywords,
;; recompute other things from that afterward. ;; recompute other things from that afterward.
(add-hook 'hack-local-variables-hook 'conf-space-mode-internal nil t)) (add-hook 'hack-local-variables-hook #'conf-space-mode-internal nil t))
;;;###autoload ;;;###autoload
(defun conf-space-keywords (keywords) (defun conf-space-keywords (keywords)
@ -553,16 +534,16 @@ See `conf-space-mode'."
(conf-space-mode)) (conf-space-mode))
(if (string-equal keywords "") (if (string-equal keywords "")
(setq keywords nil)) (setq keywords nil))
(setq conf-space-keywords keywords) (setq-local conf-space-keywords keywords)
(conf-space-mode-internal) (conf-space-mode-internal)
(run-mode-hooks)) (run-mode-hooks))
(defun conf-space-mode-internal () (defun conf-space-mode-internal ()
(make-local-variable 'conf-assignment-regexp) (setq-local conf-assignment-regexp
(setq conf-assignment-regexp (if conf-space-keywords
(if conf-space-keywords (concat "\\(?:" conf-space-keywords
(concat "\\(?:" conf-space-keywords "\\)[ \t]+.+?\\([ \t]+\\|$\\)") "\\)[ \t]+.+?\\([ \t]+\\|$\\)")
".+?\\([ \t]+\\|$\\)")) ".+?\\([ \t]+\\|$\\)"))
;; If Font Lock is already enabled, reenable it with new ;; If Font Lock is already enabled, reenable it with new
;; conf-assignment-regexp. ;; conf-assignment-regexp.
(when (and font-lock-mode (when (and font-lock-mode
@ -596,17 +577,13 @@ For details see `conf-mode'. Example:
<Multi_key> <exclam> <exclam> : \"\\241\" exclamdown <Multi_key> <exclam> <exclam> : \"\\241\" exclamdown
<Multi_key> <c> <slash> : \"\\242\" cent" <Multi_key> <c> <slash> : \"\\242\" cent"
(conf-mode-initialize "#" 'conf-colon-font-lock-keywords) (conf-mode-initialize "#" 'conf-colon-font-lock-keywords)
(set (make-local-variable 'conf-assignment-space) (setq-local conf-assignment-space conf-colon-assignment-space)
conf-colon-assignment-space) (setq-local conf-assignment-column conf-colon-assignment-column)
(set (make-local-variable 'conf-assignment-column) (setq-local conf-assignment-sign ?:)
conf-colon-assignment-column) (setq-local conf-assignment-regexp ".+?\\([ \t]*:[ \t]*\\)")
(set (make-local-variable 'conf-assignment-sign) (setq-local imenu-generic-expression
?:) `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)
(set (make-local-variable 'conf-assignment-regexp) ,@(cdr imenu-generic-expression))))
".+?\\([ \t]*:[ \t]*\\)")
(setq imenu-generic-expression
`(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)
,@(cdr imenu-generic-expression))))
;;;###autoload ;;;###autoload
(define-derived-mode conf-ppd-mode conf-colon-mode "Conf[PPD]" (define-derived-mode conf-ppd-mode conf-colon-mode "Conf[PPD]"