使用 Ctrl 键和鼠标滚动调整 Emacs 字体大小 [英] Emacs font sizing with Ctrl key and mouse scroll
本文介绍了使用 Ctrl 键和鼠标滚动调整 Emacs 字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
notepad++ 允许我在按住 Ctrl 键并将鼠标中间滚动按钮向前旋转时增加字体大小.
同样的,当我按住Ctrl并向后旋转鼠标中间滚动按钮时,大小会减小.
如何使用 Emacs 获得相同的效果?
解决方案
<前>(defun font-big ()(交互的)(set-face-attribute '默认 nil :height(+ (face-attribute 'default :height) 10)))(defun font-small ()(交互的)(set-face-attribute '默认 nil :height(- (face-attribute 'default :height) 10)))(global-set-key (kbd "最小和最大使用
<前>(defun font-big ()(交互的)(set-face-attribute '默认 nil :height(最低 720(+ (face-attribute 'default :height) 10))))(defun font-small ()(交互的)(set-face-attribute '默认 nil :height(最多 80(- (face-attribute 'default :height) 10))))notepad++ allow me to increase the font size when I hold the Ctrl Key and rotate the mouse middle scroll button to forward.
In the same way, the when I hold Ctrl and rotate the mouse middle scroll button backward, the fond size reduces.
How can I get the same with Emacs?
解决方案
code for AlexCombas' answer:
(defun font-big () (interactive) (set-face-attribute 'default nil :height (+ (face-attribute 'default :height) 10))) (defun font-small () (interactive) (set-face-attribute 'default nil :height (- (face-attribute 'default :height) 10))) (global-set-key (kbd "<C-wheel-down>") 'font-small) (global-set-key (kbd "<C-wheel-up>") 'font-big)
Edit: for a min and a max use
(defun font-big () (interactive) (set-face-attribute 'default nil :height (min 720 (+ (face-attribute 'default :height) 10)))) (defun font-small () (interactive) (set-face-attribute 'default nil :height (max 80 (- (face-attribute 'default :height) 10))))
这篇关于使用 Ctrl 键和鼠标滚动调整 Emacs 字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文