我知道您可以使用set-frame-width
或(add-to-list 'default-frame-alist '(width . 80))
更改.emacs文件中的帧大小但是如何在Emacs启动后更改宽度(除了拖动框架的边缘) ?
答案 0 :(得分:17)
好吧,转到*scratch*
缓冲区并使用set-frame-width
。
(set-frame-width (selected-frame) 100) ;; ^J to execute.
set-frame-width
不是交互式的,所以你不能用M-x
运行它,但你可以轻而易举地写一个set-frame-width-interactive,比如
(defun set-frame-width-interactive (arg)
(interactive "p")
(set-frame-width (selected-frame) arg))
现在C-u 8 0 M-x set-frame-width-interactive
会将宽度设置为80。
这是你想要做的吗?
答案 1 :(得分:6)
此库包含许多供您使用的交互式命令:http://www.emacswiki.org/emacs/frame-cmds.el
以下是一些相关的内容:
enlarge-frame
enlarge-frame-horizontally
hide-frame
mouse-show-hide-mark-unmark
move-frame-down
move-frame-left
move-frame-right
move-frame-up
show-a-frame-on
show-frame
shrink-frame
shrink-frame-horizontally
tile-frames
答案 2 :(得分:5)
除了查理马丁的建议,你可以做到
M-: (set-frame-width (selected-frame) N)
答案 3 :(得分:3)
要轻松切换2种帧大小,您可以定义类似的内容(例如,将其添加到“.emacs”文件中)(根据屏幕和字体调整大小)
(defvar myfullscreen '()
"non-nil if current frame is in fullscreen mode. See myfullscreen-on, myfullscreen-off, myfullscreen-toggle")
(defun myfullscreen-on ()
"Sets fullscreen on (based on ???display??? with font ???)"
(interactive)
(set-frame-width (selected-frame) 177); adapt size
(set-frame-height (selected-frame) 58); adapt size
(setq myfullscreen t)
)
(defun myfullscreen-off ()
"Sets fullscreen off (based on ???display??? with font ???)"
(interactive)
(set-frame-width (selected-frame) 110); adapt size
(set-frame-height (selected-frame) 58); adapt size
(setq myfullscreen nil)
)
(defun myfullscreen-toggle ()
"Toggles fullscreen on/off (based on ???Display??? with font ???)"
(interactive)
(if (eq myfullscreen 'nil)
(myfullscreen-on)
;else
(myfullscreen-off)
)
)
然后,您可以使用
M-x myfullscreen-on
M-x myfullscreen-off
M-x myfullscreen-toggle
和/或将它们绑定到您最喜欢的键绑定