Emacs shell 模式下注释缩进

问题描述 投票:0回答:1

Emacs 在 sh-mode 下默认注释缩进(M-x

indent-region
之后)

# command --with --many --options \
    #         --after --backslah

我该怎么做?

# command --with --many --options \
#         --after --backslah

顺便说一句,带管道一切都OK(正如我所期望的)

# command --with -options |
#     command2 --after --pipe

要重现,请输入

command --with --many --options \
        --after --backslash

(注意 Emacs 如何正确缩进第二行),然后选择这些行和

M-x
comment-region
(工作正常),然后
M-x
indent-region

emacs indentation
1个回答
0
投票

用户选项的文档字符串

sh-indent-comment
状态

注释行如何缩进。

nil 表示保持原样;
t 表示将其缩进为普通行,将其与之前的非空白非注释行对齐;
数字表示与该列对齐,例如0 表示 第一栏。

据此,我们可以预期禁用此用户选项会导致所要求的行为。即:

(setq sh-indent-comment nil)

但这似乎并没有达到预期的效果。因此,我建议

M-x report-emacs-bug
进行澄清。

© www.soinside.com 2019 - 2024. All rights reserved.