diff options
| author | Karl Heuer | 1995-06-05 17:32:51 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-06-05 17:32:51 +0000 |
| commit | 4a4a9db5efbcda09cfeba8fb5cb842b83931e315 (patch) | |
| tree | cd82be143f3a7ae0e6145cfd968350346ac1fc5e | |
| parent | 434727b6d680e9d12edc23c6545d44f99afd3781 (diff) | |
| download | emacs-4a4a9db5efbcda09cfeba8fb5cb842b83931e315.tar.gz emacs-4a4a9db5efbcda09cfeba8fb5cb842b83931e315.zip | |
(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.
| -rw-r--r-- | src/buffer.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/buffer.c b/src/buffer.c index e743425052f..61cd2f9bd47 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -889,6 +889,10 @@ with `delete-process'.") | |||
| 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)) |
| @@ -946,7 +950,9 @@ with `delete-process'.") | |||
| 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); |
| @@ -992,11 +998,26 @@ with `delete-process'.") | |||
| 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) |
| 1002 | { | ||
| 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 | ||
| 996 | { | 1017 | { |
| 997 | /* Unchain all markers of this buffer | 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; |