*Scratch*
缓冲区的初始主模式由变量控制initial-major-mode
-值必须是一个符号(用外行的话来说,这意味着在主模式名前加一个单引号): http://www.gnu。 org / software / emacs / manual / html_node / elisp / Auto-Major-Mode.html
(setq initial-major-mode 'org-mode)
编辑:基于原始发布者的评论,这是一个示例函数,该函数以以下主要模式按顺序创建非文件访问缓冲区org-mode
:
(defun my-scratch-buffer ()
"Create a new scratch buffer -- \*hello-world\*"
(interactive)
(let ((n 0)
bufname buffer)
(catch 'done
(while t
(setq bufname (concat "*hello-world"
(if (= n 0) "" (int-to-string n))
"*"))
(setq n (1+ n))
(when (not (get-buffer bufname))
(setq buffer (get-buffer-create bufname))
(with-current-buffer buffer
(org-mode))
;; When called non-interactively, the `t` targets the other window (if it exists).
(throw 'done (display-buffer buffer t))) ))))
M-x
org-mode
时有什么不便之处*scratch*
吗?