From: Gerd Moellmann Date: Tue, 16 Oct 2001 09:21:56 +0000 (+0000) Subject: (Fset_buffer_major_mode): Use initial-major-mode for X-Git-Tag: ttn-vms-21-2-B4~19410 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=71a0f2c6e418579a35d0308c11264e93a15455c3;p=emacs.git (Fset_buffer_major_mode): Use initial-major-mode for *scratch*. --- diff --git a/src/buffer.c b/src/buffer.c index 5fd52c8cbaa..2bb785bda99 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1449,7 +1449,9 @@ record_buffer (buf) } 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'. + /* Set an appropriate major mode for BUFFER. +For the *scratch* buffer, use `initial-major-mode', otherwise chose a mode +according to `default-major-mode'. Use this function before selecting the buffer, since it may need to inspect the current buffer's major mode. */ (buffer)) @@ -1458,10 +1460,17 @@ the current buffer's major mode. */ 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;