this post was submitted on 28 Nov 2023
2 points (100.0% liked)

Emacs

305 readers
3 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

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!

top 2 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 9 months 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.

[–] [email protected] 1 points 9 months 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"))))