millejoh / emacs-ipython-notebook

Jupyter notebook client in Emacs
http://millejoh.github.io/emacs-ipython-notebook/
GNU General Public License v3.0
1.47k stars 122 forks source link

Function to remove *only* the stdout or stderr from a cell output #826

Closed MatthewZMD closed 2 years ago

MatthewZMD commented 2 years ago

Hi, I'm wondering if you can create a function to only remove the stdout or stderr from a cell output.

From skimming through the source code I'm aware of the ein:cell-clear-output function, but I tried to play around with it but cannot get it to remove only stderr output from the ipynb. I am likely just not understanding the codebase well enough.

MatthewZMD commented 2 years ago

Looking at the codebase, apparently (ein:cell-clear-output cell t t t) and replace any t into nil run two completely different chunks of code, separating by the (if (and stdout stderr other). (ein:cell-clear-output cell t t t) works very nicely that removes all outputs from the cell, but if I want to remove a single kind of output, it somehow just doesn't work.

It seems to me that the else condition is broken, and git blaming tells me that part of the code is from 10 years ago, could a maintainer could please verify that what I'm running into is reproducible? @dickmao

dickmao commented 2 years ago

Starting in cfd0e8a the pre-2016 distinction between stdout and stderr was quashed at the server level (https://jupyter-client.readthedocs.io/en/stable/messaging.html). So the answer to your question is "no."