如何为特定模式设置Emacs填充列? [英] How do I set the Emacs fill-column for a specific mode?

查看:92
本文介绍了如何为特定模式设置Emacs填充列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Emacs中的 fill-column 设置为120,而将Clojure模式设置为默认值(80)。

I would like to set the fill-column in Emacs to 120 for Clojure-mode, but leave it at the default (80) otherwise.

如何在 .emacs 文件中执行此操作?

How can I do this in my .emacs file?

推荐答案

添加对 set-fill-column 的调用 clojure-mode-hook

(add-hook 'clojure-mode-hook
          (lambda ()
            (set-fill-column 120)))


$ b b

As fill-column 是缓冲区本地的,它不会影响其他缓冲区。实际上,您可以调用 Mx set-fill-column RET 120 ,以交互方式在任何Emacs缓冲区中设置填充列。

As fill-column is buffer local, it won't affect other buffers. In fact, you can invoke M-x set-fill-column RET 120 to set the fill column in any Emacs buffer interactively.

您可以通过调用帮助来检查变量是否为本地缓冲区: Ch v fill-column 指定:

You can check if a variable is buffer local by invoking the help: C-h v fill-column specifies:

以任何方式设置时自动变为缓冲区局部。

Automatically becomes buffer-local when set in any fashion.

这篇关于如何为特定模式设置Emacs填充列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆