Edi Weitz edi@agharta.de writes:
I suspect this has something to do with funny property inheritance near the prompt. Do the symptoms go a away if you try this?
No, unfortunately not.
I think I found the cause of the problem. Apparently an Emacs bug/particularity related to timers. The first command after the execution of a timer function seems to be looked up in the buffer in which the timer was started and not in the current buffer, e.g., the form
(run-at-time 2 nil (lambda () (with-current-buffer (generate-new-buffer "x.x") (emacs-lisp-mode) (insert "(+ 1 2)") (pop-to-buffer (current-buffer)) (setq unread-command-events (append (listify-key-sequence "\C-j") unread-command-events)))))
creates a buffer with contents
(+ 1 2) 3
when executed from the Emacs *scratch* buffer. The binding of C-j in the *scratch* buffer is used and not the one in the x.x buffer. Subsequent commands work correctly. As a workaround, I generate a synthetic C-l event, which only performs redisplay.
Helmut.