Mercurial > emacs
comparison src/buffer.c @ 28417:4b675266db04
* lisp.h (XCONS, XSTRING, XSYMBOL, XFLOAT, XPROCESS, XWINDOW, XSUBR, XBUFFER):
Verify correct object type before returning pointer, using eassert.
* frame.h (XFRAME): Likewise.
* buffer.c (Frename_buffer, Fset_buffer_multibyte,
swap_out_buffer_local_variables, Fmove_overlay): Don't apply XSYMBOL, XBUFFER,
etc, to values that may be nil or of the wrong type.
* data.c (set_internal): Likewise.
* dispextern.h (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P): Likewise.
* fileio.c (auto_save_1): Likewise.
* insdel.c (check_markers): Likewise.
* marker.c (buf_charpos_to_bytepos, unchain_marker): Likewise.
* undo.c (record_insert): Likewise.
* vmsproc.c (child_sig): Likewise.
* window.c (unshow_buffer, window_loop): Likewise.
* xterm.c (x_erase_phys_cursor): Likewise.
author | Ken Raeburn <raeburn@raeburn.org> |
---|---|
date | Thu, 30 Mar 2000 09:56:31 +0000 |
parents | 1555145f8c35 |
children | 5da961b04d97 |
comparison
equal
deleted
inserted
replaced
28416:24ba809218ad | 28417:4b675266db04 |
---|---|
885 | 885 |
886 if (XSTRING (newname)->size == 0) | 886 if (XSTRING (newname)->size == 0) |
887 error ("Empty string is invalid as a buffer name"); | 887 error ("Empty string is invalid as a buffer name"); |
888 | 888 |
889 tem = Fget_buffer (newname); | 889 tem = Fget_buffer (newname); |
890 /* Don't short-circuit if UNIQUE is t. That is a useful way to rename | |
891 the buffer automatically so you can create another with the original name. | |
892 It makes UNIQUE equivalent to | |
893 (rename-buffer (generate-new-buffer-name NEWNAME)). */ | |
894 if (NILP (unique) && XBUFFER (tem) == current_buffer) | |
895 return current_buffer->name; | |
896 if (!NILP (tem)) | 890 if (!NILP (tem)) |
897 { | 891 { |
892 /* Don't short-circuit if UNIQUE is t. That is a useful way to | |
893 rename the buffer automatically so you can create another | |
894 with the original name. It makes UNIQUE equivalent to | |
895 (rename-buffer (generate-new-buffer-name NEWNAME)). */ | |
896 if (NILP (unique) && XBUFFER (tem) == current_buffer) | |
897 return current_buffer->name; | |
898 if (!NILP (unique)) | 898 if (!NILP (unique)) |
899 newname = Fgenerate_new_buffer_name (newname, current_buffer->name); | 899 newname = Fgenerate_new_buffer_name (newname, current_buffer->name); |
900 else | 900 else |
901 error ("Buffer name `%s' is in use", XSTRING (newname)->data); | 901 error ("Buffer name `%s' is in use", XSTRING (newname)->data); |
902 } | 902 } |
1813 ZV = ZV_BYTE; | 1813 ZV = ZV_BYTE; |
1814 GPT = GPT_BYTE; | 1814 GPT = GPT_BYTE; |
1815 TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); | 1815 TEMP_SET_PT_BOTH (PT_BYTE, PT_BYTE); |
1816 | 1816 |
1817 tail = BUF_MARKERS (current_buffer); | 1817 tail = BUF_MARKERS (current_buffer); |
1818 while (XSYMBOL (tail) != XSYMBOL (Qnil)) | 1818 while (! NILP (tail)) |
1819 { | 1819 { |
1820 XMARKER (tail)->charpos = XMARKER (tail)->bytepos; | 1820 XMARKER (tail)->charpos = XMARKER (tail)->bytepos; |
1821 tail = XMARKER (tail)->chain; | 1821 tail = XMARKER (tail)->chain; |
1822 } | 1822 } |
1823 } | 1823 } |
1878 /* This prevents BYTE_TO_CHAR (that is, buf_bytepos_to_charpos) from | 1878 /* This prevents BYTE_TO_CHAR (that is, buf_bytepos_to_charpos) from |
1879 getting confused by the markers that have not yet been updated. | 1879 getting confused by the markers that have not yet been updated. |
1880 It is also a signal that it should never create a marker. */ | 1880 It is also a signal that it should never create a marker. */ |
1881 BUF_MARKERS (current_buffer) = Qnil; | 1881 BUF_MARKERS (current_buffer) = Qnil; |
1882 | 1882 |
1883 while (XSYMBOL (tail) != XSYMBOL (Qnil)) | 1883 while (! NILP (tail)) |
1884 { | 1884 { |
1885 XMARKER (tail)->bytepos | 1885 XMARKER (tail)->bytepos |
1886 = advance_to_char_boundary (XMARKER (tail)->bytepos); | 1886 = advance_to_char_boundary (XMARKER (tail)->bytepos); |
1887 XMARKER (tail)->charpos = BYTE_TO_CHAR (XMARKER (tail)->bytepos); | 1887 XMARKER (tail)->charpos = BYTE_TO_CHAR (XMARKER (tail)->bytepos); |
1888 | 1888 |
1994 { | 1994 { |
1995 sym = XCAR (XCAR (alist)); | 1995 sym = XCAR (XCAR (alist)); |
1996 | 1996 |
1997 /* Need not do anything if some other buffer's binding is now encached. */ | 1997 /* Need not do anything if some other buffer's binding is now encached. */ |
1998 tem = XBUFFER_LOCAL_VALUE (XSYMBOL (sym)->value)->buffer; | 1998 tem = XBUFFER_LOCAL_VALUE (XSYMBOL (sym)->value)->buffer; |
1999 if (XBUFFER (tem) == current_buffer) | 1999 if (BUFFERP (tem) && XBUFFER (tem) == current_buffer) |
2000 { | 2000 { |
2001 /* Symbol is set up for this buffer's old local value. | 2001 /* Symbol is set up for this buffer's old local value. |
2002 Set it up for the current buffer with the default value. */ | 2002 Set it up for the current buffer with the default value. */ |
2003 | 2003 |
2004 tem = XBUFFER_LOCAL_VALUE (XSYMBOL (sym)->value)->cdr; | 2004 tem = XBUFFER_LOCAL_VALUE (XSYMBOL (sym)->value)->cdr; |
3164 | 3164 |
3165 specbind (Qinhibit_quit, Qt); | 3165 specbind (Qinhibit_quit, Qt); |
3166 | 3166 |
3167 obuffer = Fmarker_buffer (OVERLAY_START (overlay)); | 3167 obuffer = Fmarker_buffer (OVERLAY_START (overlay)); |
3168 b = XBUFFER (buffer); | 3168 b = XBUFFER (buffer); |
3169 ob = XBUFFER (obuffer); | 3169 ob = BUFFERP (obuffer) ? XBUFFER (obuffer) : (struct buffer *) 0; |
3170 | 3170 |
3171 /* If the overlay has changed buffers, do a thorough redisplay. */ | 3171 /* If the overlay has changed buffers, do a thorough redisplay. */ |
3172 if (!EQ (buffer, obuffer)) | 3172 if (!EQ (buffer, obuffer)) |
3173 { | 3173 { |
3174 /* Redisplay where the overlay was. */ | 3174 /* Redisplay where the overlay was. */ |