Next: , Previous: , Up: Miscellaneous  


Q5.0.5: How can I get SXEmacs to come up in text/auto-fill mode by default?

Try the following lisp in your init.el:

(setq default-major-mode 'text-mode)
(setq text-mode-hook 'turn-on-auto-fill)

WARNING: note that changing the value of default-major-mode from fundamental-mode can break a large amount of built-in code that expects newly created buffers to be in fundamental-mode. (Changing from fundamental-mode to text-mode might not wreak too much havoc, but changing to something more exotic like a lisp-mode would break many Emacs packages).

Note that Emacs by default starts up in buffer *scratch* in initial-major-mode, which defaults to lisp-interaction-mode. Thus adding the following form to your Emacs init file will cause the initial *scratch* buffer to be put into auto-fill’ed text-mode:

(setq initial-major-mode
      (lambda ()
        (text-mode)
        (turn-on-auto-fill)))

Note that after your init file is loaded, if inhibit-startup-message is nil (the default) and the startup buffer is *scratch* then the startup message will be inserted into *scratch*; it will be removed after a timeout by erasing the entire *scratch* buffer. Keep in mind this default usage of *scratch* if you desire any prior manipulation of *scratch* from within your Emacs init file. In particular, anything you insert into *scratch* from your init file will be later erased. Also, if you change the mode of the *scratch* buffer, be sure that this will not interfere with possible later insertion of the startup message (e.g. if you put *scratch* into a nonstandard mode that has automatic font lock rules, then the startup message might get fontified in a strange foreign manner, e.g. as code in some programming language).