sql: change blacklist to only accept list

This commit is contained in:
Eivind Fonn 2017-05-24 12:13:13 +02:00
parent 7cb9c1924a
commit 6ba353a8d8
3 changed files with 13 additions and 9 deletions

View File

@ -45,10 +45,16 @@ you can set the variable =sql-capitalize-keywords-disable-interactive= to =t=.
[[https://github.com/Trevoke/sqlup-mode.el][sqlup-mode]] can be configured to ignore certain keywords. For example if you use
=name= as column name it would be annoying to have it upcased. You can prevent
this behaviour by setting the variable =sql-capitalize-keywords-blacklist= to
string with one keyword (like ="name"=) or to list with multiple keywords (like
='("name" "varchar")=) to ignore.
a list with keywords to ignore, e.g.
This layer is blacklisting =name= by default as it is very common name for
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '(
(sql :variables
sql-capitalize-keywords t
sql-capitalize-keywords-blacklist '("name" "varchar"))))
#+END_SRC
This layer is blacklisting =name= by default as it is a very common name for
column and NAME is non-reserved SQL keyword.
* Key bindings

View File

@ -15,5 +15,5 @@
(defvar sql-capitalize-keywords-disable-interactive nil
"Do not capitalize keywords in interactive session (e.g. psql).")
(defvar sql-capitalize-keywords-blacklist "name"
"Keyword or list of keywords to ignore during capitalization.")
(defvar sql-capitalize-keywords-blacklist '("name")
"List of keywords to ignore during capitalization.")

View File

@ -136,7 +136,5 @@
:config
(progn
(spacemacs|diminish sqlup-mode)
(when sql-capitalize-keywords-blacklist
(if (listp sql-capitalize-keywords-blacklist)
(setq sqlup-blacklist (append sqlup-blacklist sql-capitalize-keywords-blacklist))
(add-to-list 'sqlup-blacklist sql-capitalize-keywords-blacklist))))))
(setq sqlup-blacklist (append sqlup-blacklist
sql-capitalize-keywords-blacklist)))))