Emacs Lisp功能可以在4和amp之间切换变量'tab-width' 8 [英] Emacs Lisp function to toggle variable 'tab-width' between 4 & 8
本文介绍了Emacs Lisp功能可以在4和amp之间切换变量'tab-width' 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谢谢。 / p>
解决方案
;;很明显,将您的首选键替换为< f8>
(global-set-key(kbd< f8>)'tf-toggle-tab-width-setting); '修复突出显示
(defun tf-toggle-tab-width-setting()
切换设置标签宽度在4和8之间
(交互式)
(setq tab-width(if(= tab-width 8)4 8))
(redraw-display))
根据建议的修改添加重绘显示
The source tree that I work on has files indented with different tab values, (not to mention spaces) and the best I can do is to set emacs to use the style found in the region of code I am modifying. Instead of doing M-x set-variable tab-width to 4 or 8, a key binding to toggle the tab-width among these two value would help immensely.
Thanks.
解决方案
;; Obviously substitute your preferred key for <f8>
(global-set-key (kbd "<f8>") 'tf-toggle-tab-width-setting) ; ' "fix" highlighting
(defun tf-toggle-tab-width-setting ()
"Toggle setting tab widths between 4 and 8"
(interactive)
(setq tab-width (if (= tab-width 8) 4 8))
(redraw-display))
Edited to add redraw-display as per comment suggested
这篇关于Emacs Lisp功能可以在4和amp之间切换变量'tab-width' 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文