aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/sql.el
diff options
context:
space:
mode:
authorKaroly Lorentey2007-01-01 17:38:32 +0000
committerKaroly Lorentey2007-01-01 17:38:32 +0000
commit65e86587ab836aaa86b12ce30b219bcb4fcbaa06 (patch)
tree7e13feee7387635f52df3613cf1bba4414781aab /lisp/progmodes/sql.el
parent8c778e28bcf16b4baef6400a124ec2403941e940 (diff)
parent1fc8c92b50100da709c94a0faa47deed5603634f (diff)
downloademacs-65e86587ab836aaa86b12ce30b219bcb4fcbaa06.tar.gz
emacs-65e86587ab836aaa86b12ce30b219bcb4fcbaa06.zip
Merged from emacs@sv.gnu.org.
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-536 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-537 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-538 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-539 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-540 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-541 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-542 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-543 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-544 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-545 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-546 Update from erc--emacs--22 * emacs@sv.gnu.org/emacs--devo--0--patch-547 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-548 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-549 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-550 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-551 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-552 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-553 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-554 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-555 erc-iswitchb: Temporarily enable iswitchb mode * emacs@sv.gnu.org/emacs--devo--0--patch-556 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-557 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-558 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-559 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-560 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-561 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-562 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-563 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-564 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-565 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-566 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-567 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-568 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-569 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-570 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-571 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-572 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-573 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-574 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-575 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-576 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-577 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-578 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-579 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-580 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-581 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-582 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-583 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-584 Fix admin/quick-install-emacs to work with recent versions of autoconf * emacs@sv.gnu.org/gnus--rel--5.10--patch-171 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-172 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-173 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-174 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-175 Update from CVS: lisp/legacy-gnus-agent.el: Add Copyright notice. * emacs@sv.gnu.org/gnus--rel--5.10--patch-176 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-177 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-178 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-179 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-180 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-181 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-182 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-183 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-184 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-185 Merge from emacs--devo--0 git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-590
Diffstat (limited to 'lisp/progmodes/sql.el')
-rw-r--r--lisp/progmodes/sql.el98
1 files changed, 58 insertions, 40 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index ff5493de364..afc0f35f26c 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -5,7 +5,7 @@
5 5
6;; Author: Alex Schroeder <alex@gnu.org> 6;; Author: Alex Schroeder <alex@gnu.org>
7;; Maintainer: Michael Mauger <mmaug@yahoo.com> 7;; Maintainer: Michael Mauger <mmaug@yahoo.com>
8;; Version: 2.0.1 8;; Version: 2.0.2
9;; Keywords: comm languages processes 9;; Keywords: comm languages processes
10;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el 10;; URL: http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/progmodes/sql.el
11;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode 11;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?SqlMode
@@ -30,26 +30,40 @@
30;;; Commentary: 30;;; Commentary:
31 31
32;; Please send bug reports and bug fixes to the mailing list at 32;; Please send bug reports and bug fixes to the mailing list at
33;; sql.el@gnu.org. If you want to subscribe to the mailing list, send 33;; help-gnu-emacs@gnu.org. If you want to subscribe to the mailing
34;; mail to sql.el-request@gnu.org with `subscribe sql.el FIRSTNAME 34;; list, see the web page at
35;; LASTNAME' in the mail body. 35;; http://lists.gnu.org/mailman/listinfo/help-gnu-emacs for
36 36;; instructions. I monitor this list actively. If you send an e-mail
37;; This file provides a sql-mode and a sql-interactive-mode. My goals 37;; to Alex Schroeder it usually makes it to me when Alex has a chance
38;; were two simple modes providing syntactic hilighting. The 38;; to forward them along (Thanks, Alex).
39;; interactive mode had to provide a command-line history; the other 39
40;; mode had to provide "send region/buffer to SQL interpreter" 40;; This file provides a sql-mode and a sql-interactive-mode. The
41;; functions. "simple" in this context means easy to use, easy to 41;; original goals were two simple modes providing syntactic
42;; maintain and little or no bells and whistles. 42;; highlighting. The interactive mode had to provide a command-line
43;; history; the other mode had to provide "send region/buffer to SQL
44;; interpreter" functions. "simple" in this context means easy to
45;; use, easy to maintain and little or no bells and whistles. This
46;; has changed somewhat as experience with the mode has accumulated.
47
48;; Support for different flavors of SQL and command interpreters was
49;; available in early versions of sql.el. This support has been
50;; extended and formalized in later versions. Part of the impetus for
51;; the improved support of SQL flavors was borne out of the current
52;; maintainer's consulting experience. In the past fifteen years, I
53;; have used Oracle, Sybase, Informix, MySQL, Postgres, and SQLServer.
54;; On some assignments, I have used two or more of these concurrently.
43 55
44;; If anybody feels like extending this sql mode, take a look at the 56;; If anybody feels like extending this sql mode, take a look at the
45;; above mentioned modes and write a sqlx-mode on top of this one. If 57;; above mentioned modes and write a sqlx-mode on top of this one. If
46;; this proves to be difficult, please suggest changes that will 58;; this proves to be difficult, please suggest changes that will
47;; facilitate your plans. 59;; facilitate your plans. Facilities have been provided to add
60;; products and product-specific configuration.
48 61
49;; sql-interactive-mode is used to interact with a SQL interpreter 62;; sql-interactive-mode is used to interact with a SQL interpreter
50;; process in a SQLi buffer (usually called `*SQL*'). The SQLi buffer 63;; process in a SQLi buffer (usually called `*SQL*'). The SQLi buffer
51;; is created by calling a SQL interpreter-specific entry function. Do 64;; is created by calling a SQL interpreter-specific entry function or
52;; *not* call sql-interactive-mode by itself. 65;; sql-product-interactive. Do *not* call sql-interactive-mode by
66;; itself.
53 67
54;; The list of currently supported interpreters and the corresponding 68;; The list of currently supported interpreters and the corresponding
55;; entry function used to create the SQLi buffers is shown with 69;; entry function used to create the SQLi buffers is shown with
@@ -847,23 +861,24 @@ Based on `comint-mode-map'.")
847(defvar sql-mode-abbrev-table nil 861(defvar sql-mode-abbrev-table nil
848 "Abbrev table used in `sql-mode' and `sql-interactive-mode'.") 862 "Abbrev table used in `sql-mode' and `sql-interactive-mode'.")
849(unless sql-mode-abbrev-table 863(unless sql-mode-abbrev-table
850 (define-abbrev-table 'sql-mode-abbrev-table nil) 864 (define-abbrev-table 'sql-mode-abbrev-table nil))
851 (mapcar 865
852 ;; In Emacs 21.3+, provide SYSTEM-FLAG to define-abbrev. 866(mapcar
853 '(lambda (abbrev) 867 ;; In Emacs 22+, provide SYSTEM-FLAG to define-abbrev.
854 (let ((name (car abbrev)) 868 '(lambda (abbrev)
855 (expansion (cdr abbrev))) 869 (let ((name (car abbrev))
856 (condition-case nil 870 (expansion (cdr abbrev)))
857 (define-abbrev sql-mode-abbrev-table name expansion nil 0 t) 871 (condition-case nil
858 (error 872 (define-abbrev sql-mode-abbrev-table name expansion nil 0 t)
859 (define-abbrev sql-mode-abbrev-table name expansion))))) 873 (error
860 '(("ins" "insert") 874 (define-abbrev sql-mode-abbrev-table name expansion)))))
861 ("upd" "update") 875 '(("ins" . "insert")
862 ("del" "delete") 876 ("upd" . "update")
863 ("sel" "select") 877 ("del" . "delete")
864 ("proc" "procedure") 878 ("sel" . "select")
865 ("func" "function") 879 ("proc" . "procedure")
866 ("cr" "create")))) 880 ("func" . "function")
881 ("cr" . "create")))
867 882
868;; Syntax Table 883;; Syntax Table
869 884
@@ -872,13 +887,15 @@ Based on `comint-mode-map'.")
872 ;; C-style comments /**/ (see elisp manual "Syntax Flags")) 887 ;; C-style comments /**/ (see elisp manual "Syntax Flags"))
873 (modify-syntax-entry ?/ ". 14" table) 888 (modify-syntax-entry ?/ ". 14" table)
874 (modify-syntax-entry ?* ". 23" table) 889 (modify-syntax-entry ?* ". 23" table)
875 ;; double-dash starts comment 890 ;; double-dash starts comments
876 (modify-syntax-entry ?- ". 12b" table) 891 (modify-syntax-entry ?- ". 12b" table)
877 ;; newline and formfeed end coments 892 ;; newline and formfeed end comments
878 (modify-syntax-entry ?\n "> b" table) 893 (modify-syntax-entry ?\n "> b" table)
879 (modify-syntax-entry ?\f "> b" table) 894 (modify-syntax-entry ?\f "> b" table)
880 ;; single quotes (') quotes delimit strings 895 ;; single quotes (') delimit strings
881 (modify-syntax-entry ?' "\"" table) 896 (modify-syntax-entry ?' "\"" table)
897 ;; double quotes (") don't delimit strings
898 (modify-syntax-entry ?\" "." table)
882 ;; backslash is no escape character 899 ;; backslash is no escape character
883 (modify-syntax-entry ?\\ "." table) 900 (modify-syntax-entry ?\\ "." table)
884 table) 901 table)
@@ -887,12 +904,13 @@ Based on `comint-mode-map'.")
887;; Font lock support 904;; Font lock support
888 905
889(defvar sql-mode-font-lock-object-name 906(defvar sql-mode-font-lock-object-name
890 (list (concat "^\\s-*\\(create\\|drop\\|alter\\)\\s-+" ;; lead off with CREATE, DROP or ALTER 907 (eval-when-compile
891 "\\(\\w+\\s-+\\)*" ;; optional intervening keywords 908 (list (concat "^\\s-*\\(?:create\\|drop\\|alter\\)\\s-+" ;; lead off with CREATE, DROP or ALTER
892 "\\(table\\|view\\|package\\(\\s-+body\\)?\\|proc\\(edure\\)?" 909 "\\(?:\\w+\\s-+\\)*" ;; optional intervening keywords
893 "\\|function\\|trigger\\|sequence\\|rule\\|default\\)\\s-+" 910 "\\(?:table\\|view\\|\\(?:package\\|type\\)\\(?:\\s-+body\\)?\\|proc\\(?:edure\\)?"
894 "\\(\\w+\\)") 911 "\\|function\\|trigger\\|sequence\\|rule\\|default\\)\\s-+"
895 6 'font-lock-function-name-face) 912 "\\(\\w+\\)")
913 1 'font-lock-function-name-face))
896 914
897 "Pattern to match the names of top-level objects. 915 "Pattern to match the names of top-level objects.
898 916