I use emacs for editing my sql code. I work 99% of time on postgresql plpgsql code. All my files with extension .sql contain postgresql. I'm curious is there a way to set sql-highlight-postgres-keywords SQL highlighting default instead of ANSI SQL, because it's pretty annoying to switch mode every time I open a file.
相关问题
- Symbol's function definition is void: declare-
- Django distinct is not working
- PostgreSQL: left outer join syntax
- Connecting Python to a Heroku PostgreSQL DB?
- PostgreSQL - Deleting data that are older than an
相关文章
- postgresql 关于使用between and 中是字符串的问题
- postgresql 月份差计算问题
- Using boolean expression in order by clause
- ess-rdired: I get this error “no ESS process is as
- Table valued Parameter Equivalent in Postgresql
- in redshift postgresql can I skip columns with the
- Oracle equivalent of PostgreSQL INSERT…RETURNING *
- Emacs/xterm color annoyance on Linux
If you need to work with different databases, rather than using a hook to always switch to PostgreSQL highlighting when you open a .sql file, you can use Emacs' file variables feature to set the product on a file-by-file basis.
For example, if the first line of your .sql file is
sql-mode will automatically use PostgreSQL highlighting.
Full details on Emacs file variables here (you can also set them in a block anywhere in the file), and the list of product names is probably eaiest found by doing
M-x sql-set-product
, backspacing theansi
default, and hitting TAB to see the completion list. Examples are "mysql", "oracle", "sqlite", etc (about a dozen in my install).Usually in emacs, if you want to change the settings every time some mode is opened, you use a hook. Something similar to this should work: