mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 09:01:40 -05:00
set_dirty.Notebook -> set_dirty.Worksheet
This commit is contained in:
parent
465c4a446a
commit
d461afeccb
4 changed files with 13 additions and 11 deletions
|
@ -908,7 +908,7 @@ Called from ewoc pretty printer via `ein:cell-insert-output'."
|
|||
(ein:cell-set-input-prompt cell (plist-get content :execution_count))
|
||||
(ein:cell-running-set cell nil)
|
||||
(let ((events (oref cell :events)))
|
||||
(ein:events-trigger events 'set_dirty.Notebook '(:value t))
|
||||
(ein:events-trigger events 'set_dirty.Worksheet (list :value t :cell cell))
|
||||
(ein:events-trigger events 'maybe_reset_undo.Notebook cell)))
|
||||
|
||||
(defmethod ein:cell--handle-set-next-input ((cell ein:codecell) text)
|
||||
|
|
|
@ -384,15 +384,7 @@ 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)
|
||||
;; As IPython support only supports whole-notebook saving, there is
|
||||
;; no need for finer-level `set_dirty.Notebook'. Keep this until
|
||||
;; IPython supports finer-level saving.
|
||||
(ein:events-on events
|
||||
'set_dirty.Notebook
|
||||
(lambda (notebook data)
|
||||
(setf (ein:$notebook-dirty notebook)
|
||||
(plist-get data :value)))
|
||||
notebook)
|
||||
(ein:worksheet-class-bind-events events)
|
||||
;; As calling multiple callbacks for this event does not make sense,
|
||||
;; I amadding this in notebook instead of worksheet.
|
||||
(ein:events-on events
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
|
||||
(defun ein:shared-output-bind-events (events)
|
||||
"Add dummy event handlers."
|
||||
(ein:events-on events 'set_dirty.Notebook #'ignore)
|
||||
(ein:events-on events 'set_dirty.Worksheet #'ignore)
|
||||
(ein:events-on events 'maybe_reset_undo.Notebook #'ignore))
|
||||
|
||||
(defun ein:shared-output-get-cell ()
|
||||
|
|
|
@ -82,6 +82,10 @@
|
|||
(mapc (lambda (cell) (oset cell :events events))
|
||||
(ein:worksheet-get-cells ws))))
|
||||
|
||||
(defun ein:worksheet-class-bind-events (events)
|
||||
"Binds event handlers which are not needed to be bound per instance."
|
||||
(ein:events-on events 'set_dirty.Worksheet #'ein:worksheet--set-dirty))
|
||||
|
||||
(defmethod ein:worksheet--set-next-input ((ws ein:worksheet) data)
|
||||
(destructuring-bind (&key cell text) data
|
||||
(if (eq (oref cell :ewoc) (oref ws :ewoc)) ; CELL is in this WS
|
||||
|
@ -91,6 +95,12 @@
|
|||
(ein:log 'debug
|
||||
"WORKSHEET--SET-NEXT-INPUT: CELL is not in this buffer."))))
|
||||
|
||||
(defun ein:worksheet--set-dirty (-ignore- data)
|
||||
"Set dirty flag of worksheet in which CELL in DATA locates."
|
||||
(destructuring-bind (&key value cell) data
|
||||
(ein:with-live-buffer (ein:cell-buffer cell)
|
||||
(oset ein:%worksheet% :dirty value))))
|
||||
|
||||
(defmethod ein:worksheet-notebook-name ((ws ein:worksheet))
|
||||
(ein:notebook-name (oref ws :notebook)))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue