Hi, basically it is working well but I want to remove repetitive msg when evaluated to REPL.

for instance, when below code

nums = [1, 2, 3, 4, 5]
def double(x): return x * 2
list(map(double, nums))

is evaluated by C-c C-c

>>> 
__PYTHON_EL_eval("nums = [1, 2, 3, 4, 5]\ndef double(x): return x * 2\nlist(map(double, nums))", "/Users/darren/Work/ace/pyth/codi/01-iterations/binary-gap.py")
[2, 4, 6, 8, 10]

Can I remove this msg?

__PYTHON_EL_eval("nums = [1, 2, 3, 4, 5]\ndef double(x): return x * 2\nlist(map(double, nums))", "/Users/darren/Work/ace/pyth/codi/01-iterations/binary-gap.py")

So it just shows like

>>> 
[2, 4, 6, 8, 10]

Thanks in advance!

  • 7890yuiop@alien.topB
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    Check C-h v comint-process-echoes in that buffer.

    If it’s nil, try (setq-local comint-process-echoes t)

    If that fixes it, then you can use this repl’s major mode hook to do that automatically.

  • Patient_Chance_3795@alien.top
    cake
    B
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Some answers here
    https://stackoverflow.com/questions/75103221/emacs-remove-python-el-eval-message

    (defun python-comint-filter (output)
      (let* ((regexp "^.*__PYTHON_EL_\\(.*\\)\\(.*\\)[[:space:]]*$")
             (lines (split-string output "\n"))
             (filtered-lines (remove-if (lambda (line)
                                          (or (string-match-p regexp line)
                                              (string-match-p "^\\s-*$" line))) 
                                        lines)))
    
        (if (equal (length lines) (length filtered-lines))
            output
          (mapconcat 'identity filtered-lines "\n"))))