Mercurial > emacs
annotate lisp/eshell/em-script.el @ 52242:f5ada28bb9f0
Patch by Michael Mauger <mmaug@yahoo.com>
Version 1.8.0 of sql-mode.
Simplify selection of SQL products to define highlighting and
interactive mode. Includes detailed instructions on adding
support for new products.
* sql.el (sql-product): New variable. Identifies SQL product for
use in highlighting and interactive mode.
(sql-interactive-product): New variable. SQL product for
sql-interactive-mode.
(sql-product-support): New variable. Specifies product-specific
parameters to drive highlighting and interactive mode.
(sql-imenu-generic-expression): Add more object types.
(sql-sqlite-options): Correct comment.
(sql-ms-program): Use "osql" rather than "isql".
(sql-prompt-regexp, sql-prompt-length): Update comment.
(sql-mode-menu): Add "Start SQLi session" entry. Replace
Highlighting submenu with Product menu. Fix Send Region entry.
(sql-mode-abbrev-table): Add abbreviations. Support of
SYSTEM-FLAG on define-abbrev. Support was removed with last
check-in; it now handles older Emacsen without the SYSTEM-FLAG.
(sql-mode-font-lock-object-name): Add font-lock pattern for object
names.
(sql-mode-ansi-font-lock-keywords): Set as default value.
(sql-mode-oracle-font-lock-keywords): Set as default value.
Support Oracle 9i keywords.
(sql-mode-postgres-font-lock-keywords): Set as default value.
(sql-mode-linter-font-lock-keywords): Set as default value.
(sql-mode-ms-font-lock-keywords): New variable. Support Microsoft
SQLServer 2000.
(sql-mode-sybase-font-lock-keywords)
(sql-mode-interbase-font-lock-keywords)
(sql-mode-sqlite-font-lock-keywords)
(sql-mode-strong-font-lock-keywords)
(sql-mode-mysql-font-lock-keywords)
(sql-mode-db2-font-lock-keywords): New variables. Default to ANSI
keywords.
(sql-mode-font-lock-defaults): Update comment.
(sql-product-feature): New function. Returns feature associated
with a product from `sql-product-support' alist.
(sql-product-font-lock): New function. Set font-lock support
based on `sql-product'.
(sql-add-product-keywords): New function. Add font-lock rules to
product-specific keyword variables.
(sql-set-product): New function. Set `sql-product' and apply
appropriate font-lock highlighting.
(sql-highlight-product): New function. Set font-lock support
based on a product. Also set mode name to include product name.
(sql-highlight-ansi-keywords, sql-highlight-oracle-keywords)
(sql-highlight-postgres-keywords, sql-highlight-linter-keywords):
Use `sql-set-product'.
(sql-highlight-ms-keywords)
(sql-highlight-sybase-keywords)
(sql-highlight-interbase-keywords)
(sql-highlight-strong-keywords)
(sql-highlight-mysql-keywords)
(sql-highlight-sqlite-keywords)
(sql-highlight-db2-keywords): New functions. Use
`sql-set-product'.
(sql-get-login): Prompt in the same order as the tokens.
(sql-mode): Uses `sql-product-highlight' and
`sql-product-font-lock'.
(sql-product-interactive): New function. Common portions of
product-specific interactive mode wrappers.
(sql-interactive-mode): Rewritten to use product features.
(sql-oracle, sql-sybase, sql-informix, sql-sqlite, sql-mysql)
(sql-solid, sql-ingres, sql-ms, sql-postgres, sql-interbase)
(sql-db2, sql-linter): Use `sql-product-interactive'.
(sql-connect-oracle, sql-connect-sybase, sql-connect-informix)
(sql-connect-sqlite, sql-connect-mysql, sql-connect-solid)
(sql-connect-ingres, sql-connect-postgres)
(sql-connect-interbase, sql-connect-db2, sql-connect-linter): New
functions. Format command line parameters and invoke comint on
the appropriate interpreter. Code was in the corresponding
`sql-xyz' function before.
(sql-connect-ms): New function. Support -E argument to use
operating system credentials for authentication.
| author | Alex Schroeder <alex@gnu.org> |
|---|---|
| date | Mon, 18 Aug 2003 17:29:23 +0000 |
| parents | bd778a4f4ece |
| children | 695cf19ef79e d7ddb3e565de |
| rev | line source |
|---|---|
|
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Jan?k <Pavel@Janik.cz>
parents:
37661
diff
changeset
|
1 ;;; em-script.el --- Eshell script files |
| 29876 | 2 |
|
29934
34b1ab9d583d
Change spelling of the Free Software Foundation.
Gerd Moellmann <gerd@gnu.org>
parents:
29876
diff
changeset
|
3 ;; Copyright (C) 1999, 2000 Free Software Foundation |
| 29876 | 4 |
| 32526 | 5 ;; Author: John Wiegley <johnw@gnu.org> |
| 6 | |
| 29876 | 7 ;; This file is part of GNU Emacs. |
| 8 | |
| 9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
| 10 ;; it under the terms of the GNU General Public License as published by | |
| 11 ;; the Free Software Foundation; either version 2, or (at your option) | |
| 12 ;; any later version. | |
| 13 | |
| 14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
| 15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 ;; GNU General Public License for more details. | |
| 18 | |
| 19 ;; You should have received a copy of the GNU General Public License | |
| 20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
| 21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 22 ;; Boston, MA 02111-1307, USA. | |
| 23 | |
| 24 (provide 'em-script) | |
| 25 | |
| 26 (eval-when-compile (require 'esh-maint)) | |
| 27 | |
| 48578 | 28 (require 'eshell) |
| 29 | |
| 29876 | 30 (defgroup eshell-script nil |
| 31 "This module allows for the execution of files containing Eshell | |
| 32 commands, as a script file." | |
| 33 :tag "Running script files." | |
| 34 :group 'eshell-module) | |
| 35 | |
| 36 ;;; Commentary: | |
| 37 | |
| 38 ;;; User Variables: | |
| 39 | |
| 40 (defcustom eshell-script-load-hook '(eshell-script-initialize) | |
| 41 "*A list of functions to call when loading `eshell-script'." | |
| 42 :type 'hook | |
| 43 :group 'eshell-script) | |
| 44 | |
| 45 (defcustom eshell-login-script (concat eshell-directory-name "login") | |
| 46 "*If non-nil, a file to invoke when starting up Eshell interactively. | |
| 47 This file should be a file containing Eshell commands, where comment | |
| 48 lines begin with '#'." | |
| 49 :type 'file | |
| 50 :group 'eshell-script) | |
| 51 | |
| 52 (defcustom eshell-rc-script (concat eshell-directory-name "profile") | |
| 53 "*If non-nil, a file to invoke whenever Eshell is started. | |
| 54 This includes when running `eshell-command'." | |
| 55 :type 'file | |
| 56 :group 'eshell-script) | |
| 57 | |
| 58 ;;; Functions: | |
| 59 | |
| 60 (defun eshell-script-initialize () | |
| 61 "Initialize the script parsing code." | |
| 62 (make-local-variable 'eshell-interpreter-alist) | |
| 63 (setq eshell-interpreter-alist | |
| 64 (cons '((lambda (file) | |
| 65 (string= (file-name-nondirectory file) | |
| 66 "eshell")) . eshell/source) | |
| 67 eshell-interpreter-alist)) | |
| 33020 | 68 (make-local-variable 'eshell-complex-commands) |
| 69 (setq eshell-complex-commands | |
| 70 (append '("source" ".") eshell-complex-commands)) | |
| 29876 | 71 ;; these two variables are changed through usage, but we don't want |
| 72 ;; to ruin it for other modules | |
| 73 (let (eshell-inside-quote-regexp | |
| 74 eshell-outside-quote-regexp) | |
| 75 (and (not eshell-non-interactive-p) | |
| 76 eshell-login-script | |
| 77 (file-readable-p eshell-login-script) | |
| 78 (eshell-do-eval | |
| 79 (list 'eshell-commands | |
| 80 (catch 'eshell-replace-command | |
| 81 (eshell-source-file eshell-login-script))) t)) | |
| 82 (and eshell-rc-script | |
| 83 (file-readable-p eshell-rc-script) | |
| 84 (eshell-do-eval | |
| 85 (list 'eshell-commands | |
| 86 (catch 'eshell-replace-command | |
| 87 (eshell-source-file eshell-rc-script))) t)))) | |
| 88 | |
| 89 (defun eshell-source-file (file &optional args subcommand-p) | |
| 90 "Execute a series of Eshell commands in FILE, passing ARGS. | |
| 91 Comments begin with '#'." | |
| 92 (interactive "f") | |
| 93 (let ((orig (point)) | |
| 94 (here (point-max)) | |
| 95 (inhibit-point-motion-hooks t) | |
| 96 after-change-functions) | |
| 97 (goto-char (point-max)) | |
| 98 (insert-file-contents file) | |
| 99 (goto-char (point-max)) | |
| 100 (throw 'eshell-replace-command | |
| 101 (prog1 | |
| 102 (list 'let | |
| 103 (list (list 'eshell-command-name (list 'quote file)) | |
| 104 (list 'eshell-command-arguments | |
| 105 (list 'quote args))) | |
| 106 (let ((cmd (eshell-parse-command (cons here (point))))) | |
| 107 (if subcommand-p | |
| 108 (setq cmd (list 'eshell-as-subcommand cmd))) | |
| 109 cmd)) | |
| 110 (delete-region here (point)) | |
| 111 (goto-char orig))))) | |
| 112 | |
| 113 (defun eshell/source (&rest args) | |
| 114 "Source a file in a subshell environment." | |
| 115 (eshell-eval-using-options | |
| 116 "source" args | |
| 117 '((?h "help" nil nil "show this usage screen") | |
| 118 :show-usage | |
| 119 :usage "FILE [ARGS] | |
| 120 Invoke the Eshell commands in FILE in a subshell, binding ARGS to $1, | |
| 121 $2, etc.") | |
| 122 (eshell-source-file (car args) (cdr args) t))) | |
| 123 | |
|
37661
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
33020
diff
changeset
|
124 (put 'eshell/source 'eshell-no-numeric-conversions t) |
|
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
33020
diff
changeset
|
125 |
| 29876 | 126 (defun eshell/. (&rest args) |
| 127 "Source a file in the current environment." | |
| 128 (eshell-eval-using-options | |
| 129 "." args | |
| 130 '((?h "help" nil nil "show this usage screen") | |
| 131 :show-usage | |
| 132 :usage "FILE [ARGS] | |
| 133 Invoke the Eshell commands in FILE within the current shell | |
| 134 environment, binding ARGS to $1, $2, etc.") | |
| 135 (eshell-source-file (car args) (cdr args)))) | |
| 136 | |
|
37661
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
33020
diff
changeset
|
137 (put 'eshell/. 'eshell-no-numeric-conversions t) |
|
6d7c89c79996
Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents:
33020
diff
changeset
|
138 |
| 29876 | 139 ;;; Code: |
| 140 | |
| 141 ;;; em-script.el ends here |
