From 8ac0b90bf9b76b2cf62ec6f2248e82c0c077f0b8 Mon Sep 17 00:00:00 2001 From: John Miller Date: Sun, 9 Feb 2020 21:01:17 -0700 Subject: [PATCH] Missing pieces for pager support. --- lisp/ein-classes.el | 4 ++++ lisp/ein-notebook.el | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lisp/ein-classes.el b/lisp/ein-classes.el index 3de6412..700fd5c 100644 --- a/lisp/ein-classes.el +++ b/lisp/ein-classes.el @@ -112,6 +112,9 @@ `ein:$notebook-kernelinfo' : `ein:kernelinfo' `ein:kernelinfo' instance. +`ein:$notebook-pager' + Variable for `ein:pager-*' functions. See ein-pager.el. + `ein:$notebook-dirty' : boolean Set to `t' if notebook has unsaved changes. Otherwise `nil'. @@ -145,6 +148,7 @@ kernel kernelinfo kernelspec + pager dirty metadata notebook-name diff --git a/lisp/ein-notebook.el b/lisp/ein-notebook.el index 6d608f9..2f7ddda 100644 --- a/lisp/ein-notebook.el +++ b/lisp/ein-notebook.el @@ -48,6 +48,7 @@ (require 'ein-scratchsheet) (require 'ein-notification) (require 'ein-completer) +(require 'ein-pager) (require 'ein-events) (require 'ein-notification) (require 'ein-kill-ring) @@ -130,6 +131,7 @@ Current buffer for these functions is set to the notebook buffer.") ;; is at: ;; https://github.com/ipython/ipython/wiki/IPEP-16%3A-Notebook-multi-directory-dashboard-and-URL-mapping +(defvar ein:notebook-pager-buffer-name-template "*ein:pager %s/%s*") (defvar ein:notebook-buffer-name-template "*ein: %s/%s*") (ein:deflocal ein:%notebook% nil @@ -381,7 +383,14 @@ of minor mode." (defun ein:notebook-bind-events (notebook events) "Bind events related to PAGER to the event handler EVENTS." (setf (ein:$notebook-events notebook) events) - (ein:worksheet-class-bind-events events)) + (ein:worksheet-class-bind-events events) + ;; Bind events for sub components: + (setf (ein:$notebook-pager notebook) + (ein:pager-new + (format ein:notebook-pager-buffer-name-template + (ein:$notebook-url-or-port notebook) + (ein:$notebook-notebook-name notebook)) + (ein:$notebook-events notebook)))) (defalias 'ein:notebook-reconnect-kernel 'ein:notebook-reconnect-session-command "The distinction between kernel and session is a bit mysterious, all the action is now occurring in `ein:notebook-reconnect-session-command' these days, for which this function is now an alias.")