I have a simple set of emacs lisp lines that I use to insert my initials and a time/datestamp, but this has stopped working in some modes (e.g., python-mode). In these modes it throws the error comint-send-string: Buffer *spam* has no process, where 'spam' is the buffer I'm trying to add my timestamp to.
The lisp lines are:
(defun msl-insert-datetime () (interactive) (insert (format-time-string "%Y-%m-%d %H:%M ABC: ")))
(global-set-key [(control c)(control d)] 'msl-insert-datetime)
This works fine in buffers of various modes (text mode, lisp mode, etc.), inserting something like 2020-05-20 21:44 ABC:. But in Python mode (where I do much of my programming) I get the message above instead.
Any suggestions would be most welcome! I'm running Emacs 26.3 (build 2) on Ubuntu 20.04.