2001-11-01 Gerd Moellmann <gerd@gnu.org>
+ * buffer.c (Fset_buffer_major_mode): Use initial-major-mode for
+ *scratch*.
+
* xfaces.c (Finternal_set_lisp_face_attribute_from_resource):
Handle :box so that it is possible to specify sexprs.
}
DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0,
- "Set an appropriate major mode for BUFFER, according to `default-major-mode'.\n\
+ "Set an appropriate major mode for BUFFER.\n\
+For the *scratch* buffer use `initial-major-mode', otherwise choose a\n\
+mode according to `default-major-mode'.\n\
Use this function before selecting the buffer, since it may need to inspect\n\
the current buffer's major mode.")
(buffer)
int count;
Lisp_Object function;
- function = buffer_defaults.major_mode;
- if (NILP (function) && NILP (Fget (current_buffer->major_mode, Qmode_class)))
- function = current_buffer->major_mode;
-
+ if (STRINGP (XBUFFER (buffer)->name)
+ && strcmp (XSTRING (XBUFFER (buffer)->name)->data, "*scratch*") == 0)
+ function = find_symbol_value (intern ("initial-major-mode"));
+ else
+ {
+ function = buffer_defaults.major_mode;
+ if (NILP (function)
+ && NILP (Fget (current_buffer->major_mode, Qmode_class)))
+ function = current_buffer->major_mode;
+ }
+
if (NILP (function) || EQ (function, Qfundamental_mode))
return Qnil;