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

When I use %reset in a cell I get prompted for confirmation. Can this be avoided somehow (answering always yes)? #810

Closed falematte closed 3 years ago

dickmao commented 3 years ago
(advice-add 'ein:kernel--handle-stdin-reply :around
            (lambda (f &rest args)
          (let ((yessir (lambda (f prompt &rest args)
                  (if (cl-search "y/[n]" prompt)
                  "y"
                (apply f prompt args)))))
        (unwind-protect
            (progn
              (add-function :around (symbol-function 'read-string) yessir)
              (apply f args))
          (remove-function (symbol-function 'read-string) yessir)))))