summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buffer.c3
-rw-r--r--src/thread.c19
-rw-r--r--src/thread.h2
3 files changed, 24 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 4d24f970792..b7b471d6d46 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1726,6 +1726,9 @@ cleaning up all windows currently displaying the buffer to be killed. */)
if (!BUFFER_LIVE_P (b))
return Qnil;
+ if (thread_check_current_buffer (b))
+ return Qnil;
+
/* Query if the buffer is still modified. */
if (INTERACTIVE && !NILP (BVAR (b, filename))
&& BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
diff --git a/src/thread.c b/src/thread.c
index 551f3de10e4..7de260ee3c0 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -881,6 +881,25 @@ DEFUN ("all-threads", Fall_threads, Sall_threads, 0, 0, 0,
+int
+thread_check_current_buffer (struct buffer *buffer)
+{
+ struct thread_state *iter;
+
+ for (iter = all_threads; iter; iter = iter->next_thread)
+ {
+ if (iter == current_thread)
+ continue;
+
+ if (iter->m_current_buffer == buffer)
+ return 1;
+ }
+
+ return 0;
+}
+
+
+
static void
init_primary_thread (void)
{
diff --git a/src/thread.h b/src/thread.h
index 97bdb2c805c..47fa87c77fa 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -248,4 +248,6 @@ int thread_select (select_func *func, int max_fds, SELECT_TYPE *rfds,
SELECT_TYPE *wfds, SELECT_TYPE *efds, EMACS_TIME *timeout,
sigset_t *sigmask);
+int thread_check_current_buffer (struct buffer *);
+
#endif /* THREAD_H */