+2012-08-28 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Do not allow to set major mode for a dead buffer.
+ * buffer.c (Fset_buffer_major_mode): Signal an error
+ if the buffer is dead.
+ (Fother_buffer, other_buffer_safely): Remove redundant
+ nested declaration.
+
2012-08-28 Dmitry Antipov <dmantipov@yandex.ru>
Always use set_buffer_if_live to restore original buffer at unwind.
exists, return the buffer `*scratch*' (creating it if necessary). */)
(register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame)
{
- Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
Lisp_Object tail, buf, pred;
Lisp_Object notsogood = Qnil;
Lisp_Object
other_buffer_safely (Lisp_Object buffer)
{
- Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
Lisp_Object tail, buf;
tail = Vbuffer_alist;
CHECK_BUFFER (buffer);
- if (STRINGP (BVAR (XBUFFER (buffer), name))
- && strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0)
+ if (NILP (BVAR (XBUFFER (buffer), name)))
+ error ("Attempt to set major mode for a dead buffer");
+
+ if (strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0)
function = find_symbol_value (intern ("initial-major-mode"));
else
{