尝试在Emacs中捕获块缩进

尝试在Emacs中捕获块缩进,emacs,dot-emacs,Emacs,Dot Emacs,我在emacs中使用了bsd风格的缩进&我想稍微修改一下。下面是my.emacs文件的相关部分。当我用try-catch块编写函数时,大括号是缩进的。我希望它们不要像函数那样缩进 它现在在做什么 try { } catch { } 我想要它做什么 try { } catch { } .emacs文件 (defun my-c-mode-common-hook () ;; my customizations for all of c-mode and

我在emacs中使用了bsd风格的缩进&我想稍微修改一下。下面是my.emacs文件的相关部分。当我用try-catch块编写函数时,大括号是缩进的。我希望它们不要像函数那样缩进

它现在在做什么

try 
    {
    }
catch 
    {
    }
我想要它做什么

try 
{
}
catch 
{
}
.emacs文件

(defun my-c-mode-common-hook ()
  ;; my customizations for all of c-mode and related modes
  ;; other customizations can go here
  (setq c-default-style "bsd")
  (setq c-basic-offset 4)
  (setq indent-tabs-mode nil)
  )

(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

任何帮助都将不胜感激

转到要更改缩进的行,然后按C-C-o。这将运行c-set-offset并默认为当前行的语法(在本例中为substation open)。“+”表示一级缩进,“-”表示一级未缩进,“-0”表示无额外缩进。你想要0。要使其永久化,请将(c-set-offset'substatement open 0)添加到钩子中。

谢谢,这正是我想要的。什么语言?不同的语言使用不同的模式和不同的缩进逻辑。