Mercurial > emacs
comparison src/buffer.c @ 12076:ee38e93ccf7e
(Fkill_buffer): When killing indirect buffer,
unchain that buffer's markers (only) from the common chain.
Don't rekill this buffer's indirect buffers that are dead.
Do nothing if this buffer is already dead.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 05 Jun 1995 17:32:51 +0000 |
parents | 1067ddd12dfc |
children | 30adadd79bf9 |
comparison
equal
deleted
inserted
replaced
12075:4e06c01054aa | 12076:ee38e93ccf7e |
---|---|
887 if (NILP (buf)) | 887 if (NILP (buf)) |
888 nsberror (bufname); | 888 nsberror (bufname); |
889 | 889 |
890 b = XBUFFER (buf); | 890 b = XBUFFER (buf); |
891 | 891 |
892 /* Avoid trouble for buffer already dead. */ | |
893 if (NILP (b->name)) | |
894 return Qnil; | |
895 | |
892 /* Query if the buffer is still modified. */ | 896 /* Query if the buffer is still modified. */ |
893 if (INTERACTIVE && !NILP (b->filename) | 897 if (INTERACTIVE && !NILP (b->filename) |
894 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) | 898 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) |
895 { | 899 { |
896 GCPRO2 (buf, bufname); | 900 GCPRO2 (buf, bufname); |
944 struct buffer *other; | 948 struct buffer *other; |
945 | 949 |
946 GCPRO1 (buf); | 950 GCPRO1 (buf); |
947 | 951 |
948 for (other = all_buffers; other; other = other->next) | 952 for (other = all_buffers; other; other = other->next) |
949 if (other->base_buffer == b) | 953 /* all_buffers contains dead buffers too; |
954 don't re-kill them. */ | |
955 if (other->base_buffer == b && !NILP (other->name)) | |
950 { | 956 { |
951 Lisp_Object buf; | 957 Lisp_Object buf; |
952 XSETBUFFER (buf, other); | 958 XSETBUFFER (buf, other); |
953 Fkill_buffer (buf); | 959 Fkill_buffer (buf); |
954 } | 960 } |
990 tem = Fsymbol_value (intern ("delete-auto-save-files")); | 996 tem = Fsymbol_value (intern ("delete-auto-save-files")); |
991 if (! NILP (tem)) | 997 if (! NILP (tem)) |
992 internal_delete_file (b->auto_save_file_name); | 998 internal_delete_file (b->auto_save_file_name); |
993 } | 999 } |
994 | 1000 |
995 if (! b->base_buffer) | 1001 if (b->base_buffer) |
996 { | 1002 { |
997 /* Unchain all markers of this buffer | 1003 /* Unchain all markers that belong to this indirect buffer. |
1004 Don't unchain the markers that belong to the base buffer | |
1005 or its other indirect buffers. */ | |
1006 for (tem = BUF_MARKERS (b); !NILP (tem); ) | |
1007 { | |
1008 Lisp_Object next; | |
1009 m = XMARKER (tem); | |
1010 next = m->chain; | |
1011 if (m->buffer == b) | |
1012 unchain_marker (tem); | |
1013 tem = next; | |
1014 } | |
1015 } | |
1016 else | |
1017 { | |
1018 /* Unchain all markers of this buffer and its indirect buffers. | |
998 and leave them pointing nowhere. */ | 1019 and leave them pointing nowhere. */ |
999 for (tem = BUF_MARKERS (b); !EQ (tem, Qnil); ) | 1020 for (tem = BUF_MARKERS (b); !NILP (tem); ) |
1000 { | 1021 { |
1001 m = XMARKER (tem); | 1022 m = XMARKER (tem); |
1002 m->buffer = 0; | 1023 m->buffer = 0; |
1003 tem = m->chain; | 1024 tem = m->chain; |
1004 m->chain = Qnil; | 1025 m->chain = Qnil; |