命令M-a (backward-sentence)
和分别M-e (forward-sentence)
移至当前句子的开头和结尾。如果有换行符,我想结束一句话。因此,我希望emacs将以下文本视为两行(即使没有句点)。使用默认配置,emacs将其视为一个句子。
This is line one
This is line two
我为什么需要这个?
我用visual-line-mode
。所以我的句子从不包含换行符。我正在使用sentence hilight mode
依赖emacs的“句子结尾”。在没有时间段的情况下,这会带来问题。例如程序源清单。(整个程序被emacs视为一行。)
\n
在regexp的末尾添加sentence-end
应该可以实现您想要的目标-通过添加一个看起来像这样的定界符\\|
然后添加\n
。
这是默认的regexp sentence-highlight-mode
:
(setq sentence-end "[^.].[.?!]+\\([]\"')}]*\\|<[^>]+>\\)\\($\\| $\\|\t\\| \\)[ \t\n]*")
这是修订后的regexp sentence-highlight-mode
:
(setq sentence-end "[^.].[.?!]+\\([]\"')}]*\\|<[^>]+>\\)\\($\\| $\\|\t\\| \\)[ \t\n]*\\|\n")
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句