diff options
| author | Gerd Moellmann | 2001-10-16 09:21:56 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-10-16 09:21:56 +0000 |
| commit | 71a0f2c6e418579a35d0308c11264e93a15455c3 (patch) | |
| tree | abdcaa475b82aacfa810278dfe44efcf677f2685 /src/buffer.c | |
| parent | f3fbd1553534bb85c75baf891c0ca9aaa4c3fa6f (diff) | |
| download | emacs-71a0f2c6e418579a35d0308c11264e93a15455c3.tar.gz emacs-71a0f2c6e418579a35d0308c11264e93a15455c3.zip | |
(Fset_buffer_major_mode): Use initial-major-mode for
*scratch*.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 19 |
1 files changed, 14 insertions, 5 deletions
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) | |||
| 1449 | } | 1449 | } |
| 1450 | 1450 | ||
| 1451 | DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0, | 1451 | DEFUN ("set-buffer-major-mode", Fset_buffer_major_mode, Sset_buffer_major_mode, 1, 1, 0, |
| 1452 | /* Set an appropriate major mode for BUFFER, according to `default-major-mode'. | 1452 | /* Set an appropriate major mode for BUFFER. |
| 1453 | For the *scratch* buffer, use `initial-major-mode', otherwise chose a mode | ||
| 1454 | according to `default-major-mode'. | ||
| 1453 | Use this function before selecting the buffer, since it may need to inspect | 1455 | Use this function before selecting the buffer, since it may need to inspect |
| 1454 | the current buffer's major mode. */ | 1456 | the current buffer's major mode. */ |
| 1455 | (buffer)) | 1457 | (buffer)) |
| @@ -1458,10 +1460,17 @@ the current buffer's major mode. */ | |||
| 1458 | int count; | 1460 | int count; |
| 1459 | Lisp_Object function; | 1461 | Lisp_Object function; |
| 1460 | 1462 | ||
| 1461 | function = buffer_defaults.major_mode; | 1463 | if (STRINGP (XBUFFER (buffer)->name) |
| 1462 | if (NILP (function) && NILP (Fget (current_buffer->major_mode, Qmode_class))) | 1464 | && strcmp (XSTRING (XBUFFER (buffer)->name)->data, "*scratch*") == 0) |
| 1463 | function = current_buffer->major_mode; | 1465 | function = find_symbol_value (intern ("initial-major-mode")); |
| 1464 | 1466 | else | |
| 1467 | { | ||
| 1468 | function = buffer_defaults.major_mode; | ||
| 1469 | if (NILP (function) | ||
| 1470 | && NILP (Fget (current_buffer->major_mode, Qmode_class))) | ||
| 1471 | function = current_buffer->major_mode; | ||
| 1472 | } | ||
| 1473 | |||
| 1465 | if (NILP (function) || EQ (function, Qfundamental_mode)) | 1474 | if (NILP (function) || EQ (function, Qfundamental_mode)) |
| 1466 | return Qnil; | 1475 | return Qnil; |
| 1467 | 1476 | ||