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

Disabling Openning Notebooks in Other Window #781

Closed nakkaya closed 3 years ago

nakkaya commented 3 years ago

Currently when opening a notebook ein will switch to other window and open it. (This also happens when the kernel is restarted.) When working with multiple windows this messes up the order of buffers also the notebook itself will jump from window to window. Is there an option to disable this behavior?

dickmao commented 3 years ago
(use-package ein
  :config
  (with-eval-after-load 'ein-notebook
    (add-function :filter-args (symbol-function 'ein:notebook-open)
                  (lambda (args)
                    (let ((olen (length args))
                          (nlen 6))
                      (setcdr (last args) (make-list (max 0 (- nlen olen)) nil))
                      (setcar (nthcdr (1- nlen) args) t)
                      args)))))