diff options
Diffstat (limited to 'lisp/progmodes/sql.el')
| -rw-r--r-- | lisp/progmodes/sql.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index c86fc59ac16..a70b5ed60d6 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el | |||
| @@ -1508,6 +1508,22 @@ Based on `comint-mode-map'.") | |||
| 1508 | table) | 1508 | table) |
| 1509 | "Syntax table used in `sql-mode' and `sql-interactive-mode'.") | 1509 | "Syntax table used in `sql-mode' and `sql-interactive-mode'.") |
| 1510 | 1510 | ||
| 1511 | ;;; Syntax Properties | ||
| 1512 | |||
| 1513 | ;; `sql--syntax-propertize-escaped-apostrophe', as follows, was | ||
| 1514 | ;; (analysed and) adapted from `pascal--syntax-propertize' in | ||
| 1515 | ;; pascal.el because basic syntax parsing cannot handle the SQL '' | ||
| 1516 | ;; construct within strings. | ||
| 1517 | |||
| 1518 | (defconst sql--syntax-propertize-escaped-apostrophe | ||
| 1519 | (syntax-propertize-rules | ||
| 1520 | ("''" | ||
| 1521 | (0 | ||
| 1522 | (if (save-excursion (nth 3 (syntax-ppss (match-beginning 0)))) | ||
| 1523 | (string-to-syntax ".") | ||
| 1524 | (forward-char -1) | ||
| 1525 | nil))))) | ||
| 1526 | |||
| 1511 | ;; Font lock support | 1527 | ;; Font lock support |
| 1512 | 1528 | ||
| 1513 | (defvar sql-mode-font-lock-object-name | 1529 | (defvar sql-mode-font-lock-object-name |
| @@ -4210,6 +4226,10 @@ must tell Emacs. Here's how to do that in your init file: | |||
| 4210 | (setq-local abbrev-all-caps 1) | 4226 | (setq-local abbrev-all-caps 1) |
| 4211 | ;; Contains the name of database objects | 4227 | ;; Contains the name of database objects |
| 4212 | (set (make-local-variable 'sql-contains-names) t) | 4228 | (set (make-local-variable 'sql-contains-names) t) |
| 4229 | ;; Activate punctuation syntax table property for | ||
| 4230 | ;; escaped apostrophes within strings: | ||
| 4231 | (setq-local syntax-propertize-function | ||
| 4232 | sql--syntax-propertize-escaped-apostrophe) | ||
| 4213 | ;; Set syntax and font-face highlighting | 4233 | ;; Set syntax and font-face highlighting |
| 4214 | ;; Catch changes to sql-product and highlight accordingly | 4234 | ;; Catch changes to sql-product and highlight accordingly |
| 4215 | (sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591 | 4235 | (sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591 |