]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
Adding some derived modes of sql-mode.
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Thu, 26 May 2016 18:22:50 +0000 (20:22 +0200)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Thu, 26 May 2016 18:22:50 +0000 (20:22 +0200)
Now I can create yasnippets specific for MySQL, PostgreSQL, Vertica or
Oracle SQL.

bba.org
snippets/org-mode/sqlmysql
snippets/org-mode/sqlora
snippets/org-mode/sqlvertica

diff --git a/bba.org b/bba.org
index 572270d743be3ef4c99a03078eb3d18f06c5678e..b3e046349dd8f9e79775f10aeb54df713245160a 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -504,6 +504,35 @@ Default to snippet-mode if we are in a sub directory of snippets:
   (add-to-list 'auto-mode-alist '("\\.emacs.d/snippets/[^/]*/" . snippet-mode))
 #+END_SRC
 
+* define some major modes for yasnippets
+[2016-05-25 Wed 10:26]
+
+I use yasnippet for sql a lot.
+Languages differ and I need different templates.
+
+#+BEGIN_SRC emacs-lisp
+  (define-derived-mode sql-oracle-mode sql-mode "OracleSQL"
+    "Major mode for ORACLE SQL"
+    (setq sql-product 'oracle)
+    )
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+    (define-derived-mode sql-vertica-mode sql-mode "VerticaSQL"
+      "Major mode for Vertica"
+      (setq sql-product 'ansi)
+      )
+
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+  (define-derived-mode sql-mysql-mode sql-mode "MySQL"
+    "Major mode for MySQL"
+    (setq sql-product 'mysql)
+    )
+
+#+END_SRC
+
 * [[https://github.com/flycheck/flycheck][flycheck]]
 
 modified puppet-lint definition to include no-80chars-check and fixed
index e1b1e461b715da704e5556f9be3e235242898fe9..e5c9c455bbec4f0f5b1667baa135b7c666461ac8 100644 (file)
@@ -15,6 +15,6 @@
 
 (setq $3 "$5")$0
 
-#+BEGIN_SRC sql
+#+BEGIN_SRC sql-mysql
 
 #+END_SRC
index 1f6992c1246780fc4bd0f6e681b21370e237a79c..492e3c2e9fb7ec1bf669fbf665f6b6890e3d24d1 100644 (file)
@@ -8,4 +8,8 @@
 :cmdline: dbi:Oracle://${1:localhost}:${2:1521}/${3:SID} ${4:user} ${5:password}
 :exports: both
 :END:
-$0
\ No newline at end of file
+$0
+
+#+BEGIN_SRC sql-oracle
+
+#+END_SRC
\ No newline at end of file
index da873d74d6b0b594b7b04243bba8eaadd4a8a5f0..d8a396b199d10c1303604e73044ca2b8f3dc628b 100644 (file)
@@ -14,6 +14,6 @@
 
 (setq $3 "$5")$0
 
-#+BEGIN_SRC sql
+#+BEGIN_SRC sql-vertica
 
 #+END_SRC