aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Tromey2013-03-18 08:48:53 -0600
committerTom Tromey2013-03-18 08:48:53 -0600
commitcbcba8ce7f980b01c18c0fd561ef6687b1361507 (patch)
tree140c65bdc6c44e7539d853cb9f66bc5a7e500351 /src
parentdad8121b0e4438e68b23d388585f703e75951337 (diff)
downloademacs-cbcba8ce7f980b01c18c0fd561ef6687b1361507.tar.gz
emacs-cbcba8ce7f980b01c18c0fd561ef6687b1361507.zip
don't let kill-buffer kill a buffer if it is current in any thread
Diffstat (limited to 'src')
-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. */)
1726 if (!BUFFER_LIVE_P (b)) 1726 if (!BUFFER_LIVE_P (b))
1727 return Qnil; 1727 return Qnil;
1728 1728
1729 if (thread_check_current_buffer (b))
1730 return Qnil;
1731
1729 /* Query if the buffer is still modified. */ 1732 /* Query if the buffer is still modified. */
1730 if (INTERACTIVE && !NILP (BVAR (b, filename)) 1733 if (INTERACTIVE && !NILP (BVAR (b, filename))
1731 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) 1734 && 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,
881 881
882 882
883 883
884int
885thread_check_current_buffer (struct buffer *buffer)
886{
887 struct thread_state *iter;
888
889 for (iter = all_threads; iter; iter = iter->next_thread)
890 {
891 if (iter == current_thread)
892 continue;
893
894 if (iter->m_current_buffer == buffer)
895 return 1;
896 }
897
898 return 0;
899}
900
901
902
884static void 903static void
885init_primary_thread (void) 904init_primary_thread (void)
886{ 905{
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,
248 SELECT_TYPE *wfds, SELECT_TYPE *efds, EMACS_TIME *timeout, 248 SELECT_TYPE *wfds, SELECT_TYPE *efds, EMACS_TIME *timeout,
249 sigset_t *sigmask); 249 sigset_t *sigmask);
250 250
251int thread_check_current_buffer (struct buffer *);
252
251#endif /* THREAD_H */ 253#endif /* THREAD_H */