Klimi's new dotfiles with stow.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

48 líneas
1.3 KiB

hace 4 años
  1. ;;; slime-scratch.el
  2. (require 'slime)
  3. (require 'cl-lib)
  4. (define-slime-contrib slime-scratch
  5. "Imitate Emacs' *scratch* buffer"
  6. (:authors "Helmut Eller <heller@common-lisp.net>")
  7. (:license "GPL")
  8. (:on-load
  9. (def-slime-selector-method ?s "*slime-scratch* buffer."
  10. (slime-scratch-buffer))))
  11. ;;; Code
  12. (defvar slime-scratch-mode-map
  13. (let ((map (make-sparse-keymap)))
  14. (set-keymap-parent map lisp-mode-map)
  15. map))
  16. (defun slime-scratch ()
  17. (interactive)
  18. (slime-switch-to-scratch-buffer))
  19. (defun slime-switch-to-scratch-buffer ()
  20. (set-buffer (slime-scratch-buffer))
  21. (unless (eq (current-buffer) (window-buffer))
  22. (pop-to-buffer (current-buffer) t)))
  23. (defvar slime-scratch-file nil)
  24. (defun slime-scratch-buffer ()
  25. "Return the scratch buffer, create it if necessary."
  26. (or (get-buffer (slime-buffer-name :scratch))
  27. (with-current-buffer (if slime-scratch-file
  28. (find-file slime-scratch-file)
  29. (get-buffer-create (slime-buffer-name :scratch)))
  30. (rename-buffer (slime-buffer-name :scratch))
  31. (lisp-mode)
  32. (use-local-map slime-scratch-mode-map)
  33. (slime-mode t)
  34. (current-buffer))))
  35. (slime-define-keys slime-scratch-mode-map
  36. ("\C-j" 'slime-eval-print-last-expression))
  37. (provide 'slime-scratch)