尝试在Emacs中捕获块缩进

Ste*_*rke 5 emacs dot-emacs

我在emacs中使用bsd缩进样式,我想稍微修改一下.我的.emacs文件的相关部分如下.当我用try catch块编写函数时,大括号会缩进.我希望他们不要像函数那样缩进.

它现在在做什么.

try 
    {
    }
catch 
    {
    }
Run Code Online (Sandbox Code Playgroud)

我想要它做什么.

try 
{
}
catch 
{
}
Run Code Online (Sandbox Code Playgroud)

.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)
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激.

sco*_*zer 7

转到你要更改的缩进行并按Cc Co.这将运行c-set-offset并默认为当前行的语法(在本例中为substatement-open).'+'表示一级缩进,' - '表示一级无意义,'0'表示没有额外缩进.你想要0.为了使它永久化,将(c-set-offset'subcatement-open 0)添加到你的钩子.