更改emacs文本模式的边距 [英] Changing margin for emacs text-mode

查看:118
本文介绍了更改emacs文本模式的边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现在没有任何有趣的事情的情况下改变emacs的利润的唯一方法是:

The only way I found to change margins in emacs to my liking without things acting funny is this:

(add-hook 'window-configuration-change-hook
          (lambda ()
            (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 24 24)))

我希望仅在文本模式下调用此设置,并在更改时返回到其他模式。我有点天真地尝试过这个:

I would like for this setting to be invoked only in text-mode and change back when I change to other modes. Somewhat naively I tried this:

(add-hook 'text-mode-hook
          (lambda ()
            (set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 24 24)))

但是它不起作用。

推荐答案

即使您可以设置使用 set-window-margins 的保证金,一旦您以任何方式更改窗口,它们就会丢失。更好的解决方案是设置变量 left-margin-width right-margin-width 。例如:

Even though you can set the margins using set-window-margins, they are lost as soon as you change the window in any way. A better solution is to set the variables left-margin-width and right-margin-width. For example:

(defun my-set-margins ()
  "Set margins in current buffer."
  (setq left-margin-width 24)
  (setq right-margin-width 24))

(add-hook 'text-mode-hook 'my-set-margins)

这篇关于更改emacs文本模式的边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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