配置*scratch*buffer

相信大家对*scratch* buffer应该都挺熟悉了,毕竟每次启动Emacs,都会显示这个buffer. 若设置inhibit-startup-screen为t,则它会是你打开Emacs后看到的第一个buffer(除非你修改了initial- buffer-choice,这样的话,它所指的buffer会成为地一个显示的buffer)

创新互联是一家专注网站建设、网络营销策划、成都小程序开发、电子商务建设、网络推广、移动互联开发、研究、服务为一体的技术型公司。公司成立10多年以来,已经为超过千家葡萄架各业的企业公司提供互联网服务。现在,服务的超过千家客户与我们一路同行,见证我们的成长;未来,我们一起分享成功的喜悦。

scratchbuffer可以很方便的用来临时记录一些便贴,或做一些Emacs Lisp的实验, 然而很多人可能并不常写Emacs Lisp,这样的话,*scratch* buffer对他们的价值就不是那么高了.

很少人知道的是,我们可以配置*scratch* buffer的major-mode(默认为lisp-interaction-mode).

如果你是个Ruby开发人员,可以通过下面代码来让*scratch* buffer默认使用ruby-mode

(setq initial-major-mode 'ruby-mode)

当然,你也可以更改*scratch* buffer的初始内容,默认情况下初始内容为:

;; This buffer is for notes you don't want to save, and for Lisp evaluation.;; If you want to create a file, visit that file with C-x C-f,              ;; then enter the text in that file's own buffer.

而若你设置了*scratch* buffer默认为ruby-mode,则可以将初始内容修改为:

(setq initial-scratch-message "\                                     # This buffer is for notes you don't want to save, and for Ruby code.# If you want to create a file, visit that file with C-x C-f,        # then enter the text in that file's own buffer.")

当然,你也可以直接将initial-scratch-message设置为nil,则初始内容为空.


新闻名称:配置*scratch*buffer
网站网址:http://myzitong.com/article/iihssi.html