如何使Emacs sql模式识别MySQL#评论? [英] How to make Emacs sql-mode recognize MySQL #-style comments?

查看:208
本文介绍了如何使Emacs sql模式识别MySQL#评论?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读一堆使用#(到行尾)注释的MySQL文件,但是我的sql模式不支持它们。我发现sql.el的语法表部分定义/ ** /和 - 评论,但根据,Emacs语法表只支持2种注释样式。

I'm reading a bunch of MySQL files that use # (to end-of-line) comments, but my sql-mode doesn't support them. I found the syntax-table part of sql.el that defines /**/ and -- comments, but according to this, Emacs syntax tables support only 2 comment styles.

有一种方法可以在sql中添加#注释。 el容易吗?

Is there a way to add support for # comments in sql.el easily?

推荐答案

Rolf的答案似乎不适合我。备选注释样式的用于开始注释的字符类别AFAIK应该是< b,而不是b。这是我使用的:

The answer by Rolf did not seem to work for me. AFAIK, the character class for starting comments, of the alternative comment style should be "< b", not " b". This what I use:

    (add-hook 'sql-mode-hook 'my-sql-mode-hook) 
    (defun my-sql-mode-hook ()   
      ;; Make # start a new line comment in SQL. This is MySQL-specific
      ;; syntax.
      (modify-syntax-entry ?# "< b" sql-mode-syntax-table))

这篇关于如何使Emacs sql模式识别MySQL#评论?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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