By skimming the comments section of the John Kitchin's post, adding
#+PROPERTY: header-args:sh :prologue "exec 2>&1" :epilogue ":"
globally, at the top of the file, should do the job (it works in my side).
In some circumstances, having the trailing forward slash for the default-directory is necessary. My recollection is that this may depend upon the OS. It is possible to pass commands to the shell buffer under-the-hood with comint-send-string and comint-send-input, but that appears to be unnecessary in this particular use-case. The beginning directory in ...
comint-buffer-maximum-size is a variable defined in ‘comint.el’.
Its value is 1024
The maximum size in lines for Comint buffers.
Comint buffers are truncated from the top to be no greater than this number, if
the function ‘comint-truncate-buffer’ is on ‘comint-output-filter-functions’.
You can customize this variable.
The problem arises because the M-x compile command uses the dumb terminal type and invokes .cshrc before running the command make -k. My .cshrc loads modules with the module command. The module command uses a pager which does not work properly with the dumb terminal type. The solution is to include the following in the .cshrc before the module command. The ...