使emacs默认突出显示postgresql语法 [英] Making emacs to highlight postgresql syntax by default

查看:118
本文介绍了使emacs默认突出显示postgresql语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用emacs编辑我的sql代码。我在postgresql plpgsql代码上工作99%的时间。所有我的扩展名为.sql的文件都包含postgresql。我很好奇有一种方法来设置SQL注入默认值而不是ANSI SQL,因为每次打开文件时切换模式非常烦人。

解决方案

通常在emacs中,如果要在每次打开某个模式时更改设置,都可以使用挂钩。与此类似的应该有效:

 (add-to-list'auto-mode-alist 
' \\.psql $(lambda()
(sql-mode)
(sql-highlight-postgres-keywords))))
/ pre>

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.

解决方案

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:

(add-to-list 'auto-mode-alist
             '("\\.psql$" . (lambda ()
                              (sql-mode)
                              (sql-highlight-postgres-keywords))))

这篇关于使emacs默认突出显示postgresql语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆