Show execution count on header line

This commit is contained in:
Takafumi Arakaki 2012-10-09 20:24:17 +02:00
parent 28ba5e9ad1
commit eb6d0ced49

View file

@ -55,6 +55,9 @@
(defclass ein:notification () (defclass ein:notification ()
((buffer :initarg :buffer :type buffer :document "Notebook buffer") ((buffer :initarg :buffer :type buffer :document "Notebook buffer")
(tab :initarg :tab :type ein:notification-tab) (tab :initarg :tab :type ein:notification-tab)
(execution-count
:initform "y" :initarg :execution-count
:documentation "Last `execution_count' sent by `execute_reply'.")
(notebook (notebook
:initarg :notebook :initarg :notebook
:initform :initform
@ -103,6 +106,10 @@ where NS is `:kernel' or `:notebook' slot of NOTIFICATION."
"Notebook is saved" "Notebook is saved"
'notebook_saved.Notebook 'notebook_saved.Notebook
nil)) nil))
(ein:events-on events
'execution_count.Kernel
#'ein:notification--set-execution-count
notification)
(ein:events-on events (ein:events-on events
'status_restarting.Kernel 'status_restarting.Kernel
#'ein:notification--fadeout-callback #'ein:notification--fadeout-callback
@ -116,6 +123,9 @@ where NS is `:kernel' or `:notebook' slot of NOTIFICATION."
(status (cdr packed))) (status (cdr packed)))
(ein:notification-status-set ns status))) (ein:notification-status-set ns status)))
(defun ein:notification--set-execution-count (notification count)
(oset notification :execution-count count))
(defun ein:notification--fadeout-callback (packed data) (defun ein:notification--fadeout-callback (packed data)
;; FIXME: I can simplify this. ;; FIXME: I can simplify this.
;; Do not pass around message, for exmaple. ;; Do not pass around message, for exmaple.
@ -193,7 +203,8 @@ worksheet given as its argument."
(defun ein:header-line () (defun ein:header-line ()
(format (format
"IP[y]: %s" "IP[%s]: %s"
(oref ein:%notification% :execution-count)
(ein:join-str (ein:join-str
" | " " | "
(ein:filter (ein:filter