css - Emacs 24 : is there a way to use cc-mode's indentation?

标签 css emacs cc-mode

我正在使用 Emacs 24,虽然我不是一个非常有经验的 Emacs Lisper,但我已经让事情运行得相当好。也就是说,我不知道如何让标准的 css 模式使用 cc 模式的缩进。我喜欢 cc-mode 知道如何在左大括号后缩进和在新行遇到右大括号时取消缩进的方式。

编辑:我是使用 Allman 式牙套的那些可怕的人之一,所以我将向您展示我目前拥有的东西。当我按下 时,我的光标停在方框字符处:

@media print                                                                    
{
    #table-of-contents                                                          
    {
        display: none
    }
□

但我希望它是这样的:

@media print                                                                    
{
    #table-of-contents                                                          
    {
        display: none
    }
    □

最佳答案

CC 模式对于 CSS 来说可能有点矫枉过正,但是请看这个从它派生出新语言的例子:

http://cc-mode.sourceforge.net/derived-mode-ex.el

可能会出现的一件事是在 CC 模式下取消缩进标签或类可见性说明符(后跟“:”的东西,因为这在 CSS 中很常见)。不过值得一试!

关于css - Emacs 24 : is there a way to use cc-mode's indentation?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24764694/

相关文章:

emacs - 使用 Emacs 从区域中的每一行中删除前 'x' 个字符

search - 如何从 emac 中的交互式正则表达式搜索中突出显示以保持突出显示直到停用?

Emacs c-mode无法识别utf-8?

emacs - 使 php-mode(和其他 cc-mode 派生模式)与 Emacs 23 兼容

c - Emacs 缩进

css - 如何使用 CSS 创建图像的副本、移动和缩放

html - 试图让图像在页面上的网格中布局而不影响动画

html - 去除手机上的边距

python - Emacs - 在 Python 中运行当前文件

css - 将鼠标悬停在另一个图像上时淡入和淡出图像