larsbrinkhoff / forth-mode

Wants to be the SLIME of Forth
GNU General Public License v3.0
61 stars 17 forks source link

Escape sequences in comint output #98

Open doyougnu opened 11 months ago

doyougnu commented 11 months ago

Just added this to my doom emacs and am getting ANSI escape sequences in the comint output:

Gforth 0.7.9_20220127
Authors: Anton Ertl, Bernd Paysan, Jens Wilke et al., for more type `authors'
Copyright © 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `help' for basic help

7
7<0>                                                                                                                                                                                       | order: Forth Forth Root     Forth 8

in particular: ^[7 and ^[8. My install is just straight forward use-package (but hooked into Doom's package system):

(use-package! forth-mode
  :defer t
  :config

  (set-repl-handler! 'forth-mode 'forth-mode-switch-to-output-buffer)

  (set-lookup-handlers! 'forth-mode
    :documentation #'forth-spec-lookup-2012)

  (setq forth-executable "gforth")

  (map! :after forth-mode
        :map forth-mode-map
        :localleader
        "," #'run-forth
        "." #'forth-eval-last-expression-display-output
        "u" #'forth-eval-last-expression
        "'" #'forth-load-file
        "r" #'forth-eval-region
        "s" #'forth-see
        "S" #'forth-switch-to-output-buffer
        "e" #'forth-eval-defun
        "R" #'forth-restart
        "H" #'forth-spec-lookup-1994
        "h" #'forth-spec-lookup-2012
        ))

From reading the source I would have expected forth-scrub to filter these out but that doesn't seem to be the case. I do use:

(add-to-list 'comint-output-filter-functions 'ansi-color-process-output)

to process the sequences for other modes but this does not work for forth-interactive-mode

larsbrinkhoff commented 11 months ago

Thanks for the bug report. Unfortunately I'm busy with other things, so I don't have time to look into this now.