mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 01:21:38 -05:00
Treat discarding case better in ein:notebook-ask-before-kill-buffer
Note that the test ein:notebook-to-json-after-closing-a-worksheet fails now.
This commit is contained in:
parent
2c8b8cce31
commit
d25f6a1c02
2 changed files with 13 additions and 4 deletions
|
@ -930,10 +930,15 @@ Note that print page is not supported in IPython 0.12.1."
|
|||
(defun ein:notebook-ask-before-kill-buffer ()
|
||||
"Return `nil' to prevent killing the notebook buffer.
|
||||
Called via `kill-buffer-query-functions'."
|
||||
(not (and ein:notebook-kill-buffer-ask
|
||||
(not (or (and ein:notebook-kill-buffer-ask
|
||||
(ein:worksheet-p ein:%worksheet%) ; it's not `ein:scratchsheet'
|
||||
(ein:notebook-modified-p)
|
||||
(not (y-or-n-p "You have unsaved changes. Discard changes?")))))
|
||||
(not (y-or-n-p
|
||||
"You have unsaved changes. Discard changes?")))
|
||||
(when (ein:worksheet-p ein:%worksheet%)
|
||||
;; To make `ein:worksheet-save-cells' no-op.
|
||||
(ein:worksheet-detach-from-buffer ein:%worksheet%)
|
||||
nil))))
|
||||
|
||||
(add-hook 'kill-buffer-query-functions 'ein:notebook-ask-before-kill-buffer)
|
||||
|
||||
|
|
|
@ -159,6 +159,10 @@ this value."
|
|||
((buffer-live-p buffer)))
|
||||
buffer))
|
||||
|
||||
(defmethod ein:worksheet-detach-from-buffer ((ws ein:worksheet))
|
||||
"Deactivate worksheet WS without killing buffer."
|
||||
(slot-makeunbound ws :ewoc))
|
||||
|
||||
(defmethod ein:worksheet--buffer-name ((ws ein:worksheet))
|
||||
(format ein:worksheet-buffer-name-template
|
||||
(ein:worksheet-url-or-port ws)
|
||||
|
|
Loading…
Add table
Reference in a new issue