From: Andrey I. <and...@ma...> - 2024-01-25 14:56:50
|
Hello all, I hope the following may be of interest both to users and developers. 1. CSL version of Reduce, when used inside Emacs via Reduce-IDE interface simply terminates on SIGINT (interrupt) signal generated, e.g., by C-c C-c keystroke. Very similar behaviour is observed for CSL Reduce in TeXmacs session when the calculation is interrupted by pressing to the 'Stop' button. I find this behaviour of redcsl inside above-mentioned very useful Reduce interfaces quite inconvenient. Below I suggest a couple of simple hacks that allow to get rid of this for Emacs Reduce-IDE. 2. First of all, this behaviour is not specific to Reduce-IDE. The same is observed when 'redcsl -w' is run inside Emacs shell (M-x shell) buffer. Moreover, it is not specific to Emacs at all since it manifests themselves when Reduce is run inside ordinary terminal via command 'env TERM=dumb redcsl -w' which sets environment variable TERM to 'dumb'. Inside Emacs shell the variable TERM is also set to 'dumb' by default. 3. The idea of the hack is to trick redcsl to think that it was run inside more sophisticated terminal when a 'dumb' terminal. You can archive this by setting 'reduce-run-commands Reduce-IDE variable to (("CSL" . "env TERM=<termname> redcsl --nogui") ("PSL" . "redpsl")) with <termname> replaced by one of the terminals known to your system. For example, you can try "eterm-color", the default value of TERM variable inside Emacs terminal (M-x term). With this modification Reduce-IDE (M-x run-reduce) now reacts properly to C-c C-c interrupts. However, Reduce-IDE does not handle terminal color codes now emitted by redcsl. There are two solution to this problem. First, one can use <termname> corresponding to terminal that does not support color codes, e.g. "vt100" or "vremote". Second, one can modify source code of Reduce-IDE by commenting out the following two lines (remove-hook (make-local-variable 'comint-output-filter-functions) 'ansi-color-process-output t) ; remove locally! in "reduce-run.el" file, thus allowing Reduce-ide to process color codes. Above these two lines there is the following comment ;; ansi-color-process-output causes an error when CSL is terminated ;; and is probably irrelevant anyway, so ... However, I do not observe any errors with CSL termination on Emacs 28.2. Maybe the time has come to remove these lines from Reduce-IDE package? Regards, Andrey Ignatenko |