Suppose I am using Prolog mode with the Prolog REPL started as an inferior process using CtrlcEnter. Whenever I "consult" (i.e. evaluate) the Prolog mode buffer using CtrlcCtrlb ((prolog-consult-buffer)
), I will end up in the Prolog REPL. Is there a way to prevent this? I want to stay in the source code when I "consult" the buffer; I don't want to go to the REPL.
Unfortunately, it seems that this behavior is hardcoded into prolog.el. The function responsible for moving to the REPL is prolog-goto-prolog-process-buffer
. For the moment, I will be adding this hack into ~/.emacs
as a stopgap solution:
(eval-after-load
"prolog"
(advice-add 'prolog-consult-buffer
:around
(lambda (f &rest args)
(cl-letf (((symbol-function 'prolog-goto-prolog-process-buffer)
(lambda () nil)))
(apply f args)))))
This effectively disables the call to prolog-goto-prolog-process-buffer
in prolog-consult-buffer
by redefining prolog-goto-prolog-process-buffer
to do nothing ((lambda () nil)
) when it is used by prolog-consult-buffer
.