emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 70825a4 1/2: Fix problem with /- incorrectly starting a comment i


From: Lars Ingebrigtsen
Subject: master 70825a4 1/2: Fix problem with /- incorrectly starting a comment in SQL mode
Date: Mon, 10 Aug 2020 09:18:25 -0400 (EDT)

branch: master
commit 70825a4d313fddd6f80a1840d775384e848daf9f
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix problem with /- incorrectly starting a comment in SQL mode
    
    * lisp/progmodes/sql.el (sql-mode): Move all the syntax setup
    stuff here (bug#35646).  Add handling of -* and /- from Kristian
    Hole <kristian@hole.priv.no>.
---
 lisp/progmodes/sql.el | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 7c4feb3..e554b2b 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -1508,22 +1508,6 @@ Based on `comint-mode-map'.")
     table)
   "Syntax table used in `sql-mode' and `sql-interactive-mode'.")
 
-;;; Syntax Properties
-
-;; `sql--syntax-propertize-escaped-apostrophe', as follows, was
-;; (analysed and) adapted from `pascal--syntax-propertize' in
-;; pascal.el because basic syntax parsing cannot handle the SQL ''
-;; construct within strings.
-
-(defconst sql--syntax-propertize-escaped-apostrophe
-  (syntax-propertize-rules
-   ("''"
-    (0
-     (if (save-excursion (nth 3 (syntax-ppss (match-beginning 0))))
-        (string-to-syntax ".")
-       (forward-char -1)
-       nil)))))
-
 ;; Font lock support
 
 (defvar sql-mode-font-lock-object-name
@@ -4226,10 +4210,18 @@ must tell Emacs.  Here's how to do that in your init 
file:
   (setq-local abbrev-all-caps 1)
   ;; Contains the name of database objects
   (set (make-local-variable 'sql-contains-names) t)
-  ;; Activate punctuation syntax table property for
-  ;; escaped apostrophes within strings:
   (setq-local syntax-propertize-function
-              sql--syntax-propertize-escaped-apostrophe)
+              (syntax-propertize-rules
+               ;; Handle escaped apostrophes within strings.
+               ("''"
+                (0
+                 (if (save-excursion (nth 3 (syntax-ppss (match-beginning 0))))
+                    (string-to-syntax ".")
+                   (forward-char -1)
+                   nil)))
+               ;; Propertize rules to not have /- and -* start comments.
+               ("\\(/-\\)" (1 "."))
+               ("\\(-\\*\\)" (1 "."))))
   ;; Set syntax and font-face highlighting
   ;; Catch changes to sql-product and highlight accordingly
   (sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591



reply via email to

[Prev in Thread] Current Thread [Next in Thread]