branch: externals/sql-indent
commit 97d45d6eef6cf106ebd40b0eb03230cb937c0e86
Merge: 30cf40a 2e43a73
Author: Alex Harsanyi <[email protected]>
Commit: Alex Harsanyi <[email protected]>

    Merge branch 'master' of github.com:alex-hhh/emacs-sql-indent
---
 sql-indent.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/sql-indent.el b/sql-indent.el
index af71edb..53d7c44 100644
--- a/sql-indent.el
+++ b/sql-indent.el
@@ -2010,7 +2010,7 @@ determine how to indent each type of syntactic element."
 ;;;; Alignment rules
 
 (defvar sqlind-align-rules
-  '(;; Line up the two side of arrow =>
+  `(;; Line up the two side of arrow =>
     (sql-arrow-lineup
      (regexp . "\\(\\s-*\\)=>\\(\\s-*\\)")
      (modes quote (sql-mode))
@@ -2044,6 +2044,17 @@ determine how to indent each type of syntactic element."
      (modes quote (sql-mode))
      (group 1 2)
      (case-fold . t)
+     (valid . ,(function (lambda ()
+                          (save-excursion
+                            (goto-char (match-end 1))
+                            (not (nth 3 (syntax-ppss (point))))))))
+     (repeat . t))
+    ;; Line up the two sides of piped string
+    (sql-pipes
+     (regexp . "[^:]\\(\\s-*\\)||\\(\\s-*\\)[^>]")
+     (modes quote (sql-mode))
+     (group 1 2)
+     (case-fold . t)
      (repeat . t))
     ;; lineup the column aliases (the "as name" part) in a select statement
     (sql-select-lineup-column-names

Reply via email to