From 97e53006f6c56bcbe190c56dadb350759644bfaa Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 11 Apr 2010 12:15:09 -0400 Subject: [PATCH] * process.c (exec_sentinel): Preserve current-buffer. --- src/ChangeLog | 2 ++ src/process.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 6f0e2a73ccf..92a05505d91 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2010-04-11 Stefan Monnier + * process.c (exec_sentinel): Preserve current-buffer. + * process.c (read_process_output): Move the save-current-buffer to apply to both the filter and the non-filter branches. diff --git a/src/process.c b/src/process.c index 69cd0d99c8a..4a1f31f66e7 100644 --- a/src/process.c +++ b/src/process.c @@ -6840,6 +6840,11 @@ exec_sentinel (proc, reason) XSETBUFFER (obuffer, current_buffer); okeymap = current_buffer->keymap; + /* There's no good reason to let sentinels change the current + buffer, and many callers of accept-process-output, sit-for, and + friends don't expect current-buffer to be changed from under them. */ + record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); + sentinel = p->sentinel; if (NILP (sentinel)) return; -- 2.39.5