8

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.

2 Answers 2

15

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)
1
  • Also it may be useful to set initial-scratch-message
    – muffinmad
    Commented Nov 20, 2019 at 7:29
1

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. :-)

REPL article at Wikipedia

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.