1444 |
} |
} |
1445 |
|
|
1446 |
DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0, |
DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0, |
1447 |
"Set an appropriate major mode for BUFFER, according to `default-major-mode'.\n\ |
"Set an appropriate major mode for BUFFER.\n\ |
1448 |
|
For the *scratch* buffer use `initial-major-mode', otherwise choose a\n\ |
1449 |
|
mode according to `default-major-mode'.\n\ |
1450 |
Use this function before selecting the buffer, since it may need to inspect\n\ |
Use this function before selecting the buffer, since it may need to inspect\n\ |
1451 |
the current buffer's major mode.") |
the current buffer's major mode.") |
1452 |
(buffer) |
(buffer) |
1455 |
int count; |
int count; |
1456 |
Lisp_Object function; |
Lisp_Object function; |
1457 |
|
|
1458 |
function = buffer_defaults.major_mode; |
if (STRINGP (XBUFFER (buffer)->name) |
1459 |
if (NILP (function) && NILP (Fget (current_buffer->major_mode, Qmode_class))) |
&& strcmp (XSTRING (XBUFFER (buffer)->name)->data, "*scratch*") == 0) |
1460 |
function = current_buffer->major_mode; |
function = find_symbol_value (intern ("initial-major-mode")); |
1461 |
|
else |
1462 |
|
{ |
1463 |
|
function = buffer_defaults.major_mode; |
1464 |
|
if (NILP (function) |
1465 |
|
&& NILP (Fget (current_buffer->major_mode, Qmode_class))) |
1466 |
|
function = current_buffer->major_mode; |
1467 |
|
} |
1468 |
|
|
1469 |
if (NILP (function) || EQ (function, Qfundamental_mode)) |
if (NILP (function) || EQ (function, Qfundamental_mode)) |
1470 |
return Qnil; |
return Qnil; |
1471 |
|
|