Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 line
1.1 KiB

4 年之前
  1. (eval-and-compile
  2. (require 'slime))
  3. (define-slime-contrib slime-snapshot
  4. "Save&restore memory images without disconnecting"
  5. (:authors "Helmut Eller <heller@common-lisp.net>")
  6. (:license "GPL v3")
  7. (:swank-dependencies swank-snapshot))
  8. (defun slime-snapshot (filename &optional background)
  9. "Save a memory image to the file FILENAME."
  10. (interactive (list (read-file-name "Image file: ")
  11. current-prefix-arg))
  12. (let ((file (expand-file-name filename)))
  13. (when (and (file-exists-p file)
  14. (not (yes-or-no-p (format "File exists %s. Overwrite it? "
  15. filename))))
  16. (signal 'quit nil))
  17. (slime-eval-with-transcript
  18. `(,(if background
  19. 'swank-snapshot:background-save-snapshot
  20. 'swank-snapshot:save-snapshot)
  21. ,file))))
  22. (defun slime-restore (filename)
  23. "Restore a memory image stored in file FILENAME."
  24. (interactive (list (read-file-name "Image file: ")))
  25. ;; bypass event dispatcher because we don't expect a reply. FIXME.
  26. (slime-net-send `(:emacs-rex (swank-snapshot:restore-snapshot
  27. ,(expand-file-name filename))
  28. nil t nil)
  29. (slime-connection)))
  30. (provide 'slime-snapshot)