bibtex-fill-entry
Emacs 的 BibTeX-Mode 的( )命令C-c C-q会自动对齐和包装格式混乱的 BibTeX 条目。例如,它可以将如下条目
@Article{smith1980,
author = {John Smith},
title = {How I Weave Baskets Underwater},
journal = {Journal of
Underwater Basket
Weaving and Nonsensical Latin Placeholder Texts},
year = 1980,
abstract = {Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.},
}
并将其美化成
@Article{smith1980,
author = {John Smith},
title = {How I Weave Baskets Underwater},
journal = {Journal of Underwater Basket Weaving and Nonsensical
Latin Placeholder Texts},
year = 1980,
abstract = {Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.},
}
我喜欢字段和值对齐,但如果值不换行,我会更喜欢它。也就是说,如果bibtex-fill-entry
上例中的输出是
@Article{smith1980,
author = {John Smith},
title = {How I Weave Baskets Underwater},
journal = {Journal of Underwater Basket Weaving and Nonsensical Latin Placeholder Texts},
year = 1980,
abstract = {Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.},
}
这样,我就可以更轻松地使用toggle-truncate-lines
或任何其他截断而不是换行的文本编辑器浏览较长的 BibTeX 文件。我有什么方法可以配置 BibTeX-Mode 来执行此操作吗?
答案1
只需设置fill-column
为一个非常大的数字(例如 999999)。
命令C-x f( M-x set-fill-column
RET) 执行此操作(提示输入数字)。
要将其作为默认值,请将其添加到您的.emacs
文件中(或 Emacs 中具有此功能的任何文件):
(add-hook 'bibtex-mode-hook
(lambda () (setq fill-column 999999)))