When I test some codes in scratch buffer, usually first set it as org mode manually.
How could config it as 'org mode' rather than fundamental mode by default.
Here is a link to another thread you may be interested in, entitled "Is it possible to create an org-mode scratch buffer?":
Is it possible to create an org-mode *scratch* buffer?
New buffers that are not the *scratch*
buffer, should default to fundamental-mode
; e.g., when calling get-buffer-create
. As to the *scratch*
buffer, you can customize the initial-major-mode
variable:
initial-major-mode is a variable defined in ‘startup.el’.
Its value is ‘lisp-interaction-mode’
Documentation:
Major mode command symbol to use for the initial ‘*scratch*’ buffer.
You can customize this variable.
Thus, use the following:
(setq initial-major-mode 'org-mode)
Just to be sure you know: M-x ielm
will open IELM: a proper read-eval-print loop (REPL) for Elisp. Take a look at its documentation string (C-h f ielm RET
) to get an idea of how powerful and flexible it is.
I find IELM much more useful and usable than either lisp-interaction-mode
-- the default mode for *scratch*
, as noted by @lawlist -- or Org mode. Coding is about the only thing Org is not good for. :-)