Skip to content

Instantly share code, notes, and snippets.

@ymattu
Created May 15, 2017 01:38
Show Gist options
  • Save ymattu/6413865b009ad8a6b801edc81daa20a0 to your computer and use it in GitHub Desktop.
Save ymattu/6413865b009ad8a6b801edc81daa20a0 to your computer and use it in GitHub Desktop.
Emacs Ipython Notebook で保存できないエラーをなんとかする
(defun save-buffer (&optional arg)
(interactive "p")
(if (eq major-mode 'ein:notebook-multilang-mode)
(ein:notebook-save-notebook-command)
(let ((modp (buffer-modified-p))
(make-backup-files (or (and make-backup-files (not (eq arg 0)))
(memq arg '(16 64)))))
(and modp (memq arg '(16 64)) (setq buffer-backed-up nil))
(if (and modp (buffer-file-name))
(message "Saving file %s..." (buffer-file-name)))
(basic-save-buffer)
(and modp (memq arg '(4 64)) (setq buffer-backed-up nil))))
;;; advice /defadvice that fails
(defun save-ein()
(if (eq major-mode 'ein:notebook-multilang-mode)
(ein:notebook-save-notebook-command))))
(advice-add 'save-buffer :before #'save-ein)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment